radiens_drive_catalog.config
config.py
Configuration management for radiens-drive-catalog.
Config is loaded from a JSON file. The file is located using the following resolution order (first match wins):
- Explicit path argument to
Config.from_file(). RADIENS_DRIVE_CATALOG_CONFIGenvironment variable..secrets/config.jsonin the current working directory.config.jsonin the current working directory.
Example config JSON: { "credentials_path": "/path/to/service_account.json", "root_folder_id": "1aBcDeFgHiJkLmNoPqRsTuVw", "local_data_dir": "/data/neural", "catalog_path": "/data/neural/catalog.json" }
Classes
Config
dataclass
Configuration for radiens-drive-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.
Attributes:
| Name | Type | Description |
|---|---|---|
credentials_path |
str
|
Path to the Google service account credentials JSON file. |
root_folder_id |
str
|
Google Drive folder ID of the data root folder. |
local_data_dir |
str
|
Local directory where datasets will be downloaded. |
catalog_path |
str
|
Path to the catalog JSON file (created by |
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_DRIVE_CATALOG_CONFIGenvironment variable..secrets/config.jsonin the current working directory.config.jsonin the current working directory.~/.config/radiens-drive/config.jsonin the user's home directory./etc/radiens-drive/config.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | None
|
Path to the config JSON file. When |
None
|
Returns:
| Type | Description |
|---|---|
Config
|
A |
Raises:
| Type | 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 |