root
orchard.core.paths.root
¶
Project Root Discovery and Derived Path Constants.
Dynamically locates the project root by searching for anchor files (.git, pyproject.toml) and derives all core directory paths from it.
Attributes:
| Name | Type | Description |
|---|---|---|
PROJECT_ROOT |
Final[Path]
|
Dynamically resolved absolute path to the project root. |
DATASET_DIR |
Final[Path]
|
Absolute path to the raw datasets directory. |
OUTPUTS_ROOT |
Final[Path]
|
Default root directory for all experiment results. |
MLRUNS_DB |
Final[Path]
|
SQLite database path for MLflow experiment tracking. |
STATIC_DIRS |
Final[list[Path]]
|
list of directories that must exist at startup. |
get_project_root()
¶
Dynamically locate the project root by searching for anchor files.
Traverses upward from current file's directory until finding a marker file (.git or pyproject.toml). Supports Docker environments via IN_DOCKER environment variable override.
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute Path to the project root directory. |
Note:
- IN_DOCKER=1 or IN_DOCKER=TRUE returns /app
- Falls back to fixed parent traversal if no markers found
Source code in orchard/core/paths/root.py
setup_static_directories()
¶
Ensure core project directories exist at startup.
Creates DATASET_DIR and OUTPUTS_ROOT if they do not exist, preventing runtime errors during data fetching or artifact creation. Uses mkdir(parents=True, exist_ok=True) for idempotent operation.