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
importstatement andimportlib.import_module()function.targetmust be a string naming a Basilisp namespace. Namespace references may be given exactly as they are found in Basilisp code.targetmay optionally include a trailing function reference, delimited by “:”, which will be executed after the target namespace is imported.optsis 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: str | None = None) str¶
Bootstrap a Python installation by installing a
.pthfile insite-packagesdirectory (corresponding to “purelib” insysconfig.get_paths()). Returns the path to the.pthfile.Subsequent startups of the Python interpreter will have Basilisp already bootstrapped and available to run.
- basilisp.main.init(opts: IPersistentMap[Keyword, bool] | None = None, force_reload: bool = False) 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
importstatement andimportlib.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().init()may be called more than once. Only the first invocation will initialize the runtime unlessforce_reload=True.