pippen.paths¶
pippen.paths ¶
Resolution of on-disk locations for cached data and build artifacts.
Layout, relative to the data root::
raw/ unmodified downloads, exactly as retrieved
interim/ intermediate tables produced during processing
processed/ analysis-ready tables published in dataset releases
sources/ archived bibliography
The data root is chosen in this order:
- the
PIPPEN_DATA_DIRenvironment variable, if set; - a
data/directory beside the repository root, when running from a checkout; - the platform user-cache directory, for installed copies of the package.
data_root ¶
Return the root directory for cached data.
Returns:
| Type | Description |
|---|---|
Path
|
The resolved data root. The directory is not created by this call. |
Source code in src/pippen/paths.py
stage_dir ¶
Return the directory for one pipeline stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
One of |
required |
create
|
bool
|
When true, create the directory and its parents if missing. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The resolved stage directory. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/pippen/paths.py
dataset_file ¶
Return the path for a dataset file that is not split by season.
Some sources publish one file covering every season rather than one file per season. The hoopR schedule is one: a single table spanning 2002 to 2027. Giving it a season-numbered path would mean storing the same file once per season.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
Pipeline stage, as accepted by :func: |
required |
dataset
|
str
|
Dataset name, for example |
required |
filename
|
str
|
File name without an extension, for example
|
required |
create
|
bool
|
When true, create the parent directory if missing. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The full path to the dataset's Parquet file. |
Source code in src/pippen/paths.py
season_file ¶
Return the Parquet path for one dataset and one season.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
Pipeline stage, as accepted by :func: |
required |
dataset
|
str
|
Dataset name, for example |
required |
season
|
int
|
Season end year, for example 2024 for the 2023-24 season. |
required |
create
|
bool
|
When true, create the parent directory if missing. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The full path to the season's Parquet file. |