API Reference
Decorators
Decorator factory. Bind once, reuse as a decorator on every command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
Typer
|
The Typer application to register commands on. |
required |
base_settings
|
Dynaconf
|
Base Dynaconf settings instance. |
required |
output_dir
|
Path
|
Root directory for run artifacts. |
Path('outputs')
|
Returns:
| Type | Description |
|---|---|
Callable[[Callable[..., Any]], Callable[..., Any]]
|
A decorator that registers the function as a Typer command with |
Callable[[Callable[..., Any]], Callable[..., Any]]
|
automatic config merging and run logging. |
Example::
cmd = command(app, settings)
@cmd
def my_command(settings=None, run_dir=None):
...
Source code in src/iolaus/decorators.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
Settings
Merge base settings, an optional extra config file, and CLI overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base
|
Dynaconf
|
The base Dynaconf settings instance. |
required |
extra_config
|
Path | None
|
Optional path to an additional config file to layer on top. |
required |
overrides
|
list[str]
|
List of |
required |
Returns:
| Type | Description |
|---|---|
Dynaconf
|
A new Dynaconf instance with all sources merged. |
Source code in src/iolaus/settings.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Logging
Create a timestamped run directory and configure logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command_name
|
str
|
Name of the command (used as a subdirectory). |
required |
base_dir
|
Path
|
Root output directory. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created run directory. |
Source code in src/iolaus/logging.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
Write the full merged config as a JSON snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Dynaconf
|
The merged Dynaconf settings instance. |
required |
run_dir
|
Path
|
Directory to write |
required |
Source code in src/iolaus/logging.py
38 39 40 41 42 43 44 45 46 | |