radiens_data_catalog.config
Configuration loading for radiens-data-catalog.
Config.from_file lists where it looks for the config file.
Relative paths in the config file (credentials_path, local_data_dir,
catalog_path) are resolved against the config file's own directory, not
the process's current working directory, so a config works the same from a
repo-root script or a notebook in a subdirectory.
Classes
Config
dataclass
Configuration for radiens-data-catalog.
All path fields (credentials_path, local_data_dir, catalog_path) support
~ and $ENV_VAR expansion and are resolved to absolute paths on construction.
Typically created via Config.from_file() rather than directly.
When loaded via Config.from_file(), relative paths resolve against the
config file's own directory. When constructed directly (Config(...)),
relative paths resolve against the current working directory.
| ATTRIBUTE | DESCRIPTION |
|---|---|
credentials_path |
Path to the Google service account credentials JSON file.
TYPE:
|
root_folder_id |
Google Drive folder ID of the data root folder.
TYPE:
|
local_data_dir |
Local directory where datasets will be downloaded.
TYPE:
|
catalog_path |
Path to the catalog JSON file (created by
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
__post_init__ |
Expand ~ and $ENV_VARS in all path fields and resolve to absolute paths. |
from_file |
Load config from a JSON file. |
Functions
__post_init__
Expand ~ and $ENV_VARS in all path fields and resolve to absolute paths.
from_file
classmethod
Load config from a JSON file.
Resolution order when path is None:
RADIENS_DATA_CATALOG_CONFIGenvironment variable..secrets/config.json, thenconfig.json, searched starting in the current working directory and then each parent directory up to the filesystem root (closest directory wins).~/.config/radiens-data-catalog/config.jsonin the user's home directory./etc/radiens-data-catalog/config.json.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
Path to the config JSON file. When
TYPE:
|
Relative paths in the config file are resolved against the config file's own directory, not the current working directory.
| RETURNS | DESCRIPTION |
|---|---|
Config
|
A |
| RAISES | DESCRIPTION |
|---|---|
FileNotFoundError
|
If no config file can be located. |
JSONDecodeError
|
If the config file is not valid JSON. |
TypeError
|
If the JSON fields do not match the |