SYS_PATH_CONF
The SYS_PATH_CONF
configuration allows you explicitly specify which paths you want to include in your project's sys.path
. Doing so can allow users to import modules and packages from sources outside of their direct project.
If this option is not specified, Prism throws a warning and automatically adds the project directory
To see why this is useful, suppose you had the following directory structure:
By default, each project directory is added to each Prism project's sys.path
at runtime. That means that prism_project_1
can access utils1.py
, prism_project_2
can access utils2.py
, and so on. However, the parent directory (i.e., all_prism_projects/
) is not added to the project's sys.path
by default, so common_utils.py
would not be accessible to any of the projects.
This can easily be remedied with SYS_PATH_CONF
. For example:
Now, a module in prism_project_1
can import common_utils
at runtime:
Important: we recommend specifying paths as relative paths rather than absolute paths (i.e., hard-coded string paths). This enables reproducibility across different machines.
More information on sys.path
can be found here.
Last updated