poprox_recommender.paths#
Functions
|
Get the path of a model file. |
Find the project root directory (when we are running in the project). |
- poprox_recommender.paths.project_root() Path #
- poprox_recommender.paths.project_root(*, require: bool) Path | None
Find the project root directory (when we are running in the project).
This searches upwards from the current working directory to find the root of the project, which it identifies by the
pyproject.toml
file. If this function is called from a directory that is not within a checkout of thepoprox-recommender
repository, it will raise an error.- Parameters:
require – Whether to fail when the project root is not found, or return
None
. Ifrequire=False
this function will stil fail on a defective project root (contains an invalidpyproject.toml
).- Returns:
The full path to the project root directory. If the project root is not found and
require=False
, returnsNone
.
- poprox_recommender.paths.model_file_path(name)#
Get the path of a model file. It looks in the following locations, in order:
The path specified by the
POPROX_MODELS
environment variable.The
models
directory under theproject_root()
.$CONDA_PREFIX/models
(if env varCONDA_PREFIX
is defined, which is done byconda activate
).