dlgforge.utils.env¶
Environment variable parsing and dotenv loading helpers.
env_flag(name, default=False)
¶
Env flag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
str value used by this operation. |
required |
default
|
bool
|
bool value used by this operation. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Boolean indicator describing the evaluated condition. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.utils.env import env_flag
>>> env_flag(...)
env_int(name, default)
¶
Env int.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
str value used by this operation. |
required |
default
|
int
|
int value used by this operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Value produced by this API. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.utils.env import env_int
>>> env_int(...)
env_float(name, default)
¶
Env float.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
str value used by this operation. |
required |
default
|
float
|
float value used by this operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Value produced by this API. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.utils.env import env_float
>>> env_float(...)
load_dotenv_files(project_root)
¶
Load dotenv files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
Path
|
Resolved project directory context. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
No value is returned. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.utils.env import load_dotenv_files
>>> load_dotenv_files(...)