baenv module¶
Manage Ballistica execution environment.
This module is used to set up and/or check the global Python environment before running a Ballistica app. This includes things such as paths, logging, and app-dirs. Because these things are global in nature, this should be done before any Ballistica modules are imported.
This module can also be exec’ed directly to set up a default environment and then run the app.
Ballistica can be used without explicitly configuring the environment in order to integrate it in arbitrary Python environments, but this may cause some features to be disabled or behave differently than expected.
- class baenv.EnvConfig(config_dir: str, data_dir: str, app_python_dir: str | None, standard_app_python_dir: str, site_python_dir: str | None, user_python_dir: str | None, is_user_app_python_dir: bool, log_handler: LogHandler | None, initial_app_config: Any, launch_time: float)[source]¶
Bases:
object
Final config values we provide to the engine.
- initial_app_config: Any¶
Initial data from the config.json file in the config dir. The config file is parsed by
- is_user_app_python_dir: bool¶
We have a mechanism allowing app scripts to be overridden by placing a specially named directory in a user-scripts dir. This is true if that is enabled.
- log_handler: LogHandler | None¶
Our fancy app log handler. This handles feeding logs, stdout, and stderr into the engine so they show up on in-app consoles, etc.
- baenv.configure(*, config_dir: str | None = None, data_dir: str | None = None, user_python_dir: str | None = None, app_python_dir: str | None = None, site_python_dir: str | None = None, contains_python_dist: bool = False, setup_logging: bool = True) None [source]¶
Set up the environment for running a Ballistica app.
This includes things such as Python path wrangling and app directory creation. This must be called before any actual Ballistica modules are imported; the environment is locked in as soon as that happens.