basilisp.main

basilisp.main is a Python module which includes functions for Bootstrapping the Basilisp runtime.

basilisp.main.bootstrap(target: str, opts: IPersistentMap[Keyword, bool] | None = None) None

Import a Basilisp namespace or function identified by target. If a function reference is given, the function will be called with no arguments.

Basilisp only needs to be initialized once per Python VM invocation. Subsequent imports of Basilisp namespaces will work using Python’s standard import statement and importlib.import_module function.

target must be a string naming a Basilisp namespace. Namespace references may be given exactly as they are found in Basilisp code. target may optionally include a trailing function reference, delimited by “:”, which will be executed after the target namespace is imported.

opts is a mapping of compiler options that may be supplied for bootstrapping. This setting should be left alone unless you know what you are doing.

basilisp.main.bootstrap_python(site_packages: List[str] | None = None) None

Bootstrap a Python installation by installing a .pth file in the first available site-packages directory (as by site.getsitepackages()).

Subsequent startups of the Python interpreter will have Basilisp already bootstrapped and available to run.

basilisp.main.init(opts: IPersistentMap[Keyword, bool] | None = None) None

Initialize the runtime environment for Basilisp code evaluation.

Basilisp only needs to be initialized once per Python VM invocation. Subsequent imports of Basilisp namespaces will work using Python’s standard import statement and importlib.import_module function.

If you want to execute a Basilisp file which is stored in a well-formed package or module structure, you probably want to use bootstrap().

basilisp.main.unbootstrap_python(site_packages: List[str] | None = None) List[str]

Remove any basilispbootstrap.pth files found in any Python site-packages directory (as by site.getsitepackages()). Return a list of removed filenames.