Import Hooks (xonsh.imphooks)

Import hooks for importing xonsh source files.

This module registers the hooks it defines when it is imported.

class xonsh.imphooks.XonshImportHook(*args, **kwargs)[source]

Implements the import hook for xonsh source files.

create_module(spec)[source]

Create a xonsh module with the appropriate attributes.

find_spec(fullname, path, target=None)[source]

Finds the spec for a xonsh module if it exists.

get_code(fullname)[source]

Gets the code object for a xonsh file.

get_data(path)[source]

Gets the bytes for a path.

get_filename(fullname)[source]

Returns the filename for a module’s fullname.

execer
xonsh.imphooks.install_hook()[source]

Install Xonsh import hook in sys.metapath in order for .xsh files to be importable.

Can safely be called many times, will be no-op if a xonsh import hook is already present.