Xonsh API

The xonsh.api package is a set of public libraries that can be used in third-party projects as well as in xonsh extensions (xontribs). If you are writing a xontrib, using xonsh.api is the recommended way to interact with xonsh internals.

Warning

The API is under development and currently has a small number of methods. Contributions are welcome!

For the full internal library reference, see Xonsh Library.

xonsh.api.subprocess

Drop-in replacements for subprocess functions that use xonsh’s subprocess pipeline under the hood.

xonsh.api.subprocess.run(cmd, cwd=None, check=False)[source]

Drop in replacement for subprocess.run like functionality

xonsh.api.subprocess.check_call(cmd, cwd=None)[source]

Drop in replacement for subprocess.check_call like functionality

xonsh.api.subprocess.check_output(cmd, cwd=None)[source]

Drop in replacement for subprocess.check_output like functionality

xonsh.api.os

Xonsh-powered utilities inspired by the os module.

xonsh.api.os.rmtree(dirname, force=False)[source]

Remove a directory, even if it has read-only files (Windows). Git creates read-only files that must be removed on teardown. See https://stackoverflow.com/questions/2656322 for more info.

Parameters:
dirnamestr

Directory to be removed

forcebool

If True force removal, defaults to False

xonsh.api.os.indir = <function with_pushd>

alias to push_d context manager