project_path()
An absolute path inside the project, from parts relative to its root.
Like R's project_path() and here::here(): the same call gives the same file from a
notebook in notebooks/, a script in the root, or a subfolder. Python never changes the
working directory, so Path("outputs/tables/x.csv").exists() in a notebook looks under
notebooks/; fw.project_path("outputs/tables/x.csv").exists() looks under the root::
if not fw.project_path("outputs", "tables", "incidence.csv").exists():
...
Usage
project_path(*parts: str | PathLike[str]) -> Path
Arguments
| Name | Type | Description |
|---|---|---|
| *parts | str | PathLike[str] |
Path parts relative to the project root, joined in order. A part may hold slashes ( |
Value
The absolute path. The file need not exist.
Raises
ProjectNotFoundError: Not inside a Framework project.ValueError: A part is absolute or rooted ("/etc","C:\data","~/x").