Registry / devops / typed-config

typed-config

JSON →
library2.0.3pypypi✓ verified 81d ago

Typed, extensible, dependency-free configuration reader for Python projects supporting multiple config sources (YAML, JSON, TOML, environment variables, etc.) and providing IDE-friendly autocomplete via type hints. Current version: 2.0.3 (requires Python >=3.6). Release cadence is irregular.

pip install typed-config
INSTALL
IMPORT
SIG · TYPED-CONFIG
T
typed-config
devopspythonv2.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Config
from typedconfig import Config
from typed_config import TypedConfig

Define a config class with type annotations, load from multiple sources (YAML file, environment vars). The load_config function returns an instance with attributes populated from sources.

from typed_config import TypedConfig, load_config class MyConfig(TypedConfig): name: str = "default" count: int = 0 config = load_config(MyConfig, sources=["config.yaml", "env://"]) print(config.name, config.count)
Debug
Known issues
breakingIn v2, the top-level API changed: `load_config` replaces `ConfigLoader`. The `ConfigLoader` class is removed.
fix
Use `from typed_config import load_config` instead of `ConfigLoader`.
affects: >=2.0.0
deprecatedThe `from_env` method on config classes is deprecated since v2.0.0.
fix
Use environment variable sources via the `env://` or `env` source in `load_config`.
affects: >=2.0.0
gotchaIf a source file (e.g., YAML) is missing, `load_config` will raise a `FileNotFoundError` by default. Use `allow_missing=True` or handle the exception.
fix
`load_config(MyConfig, sources=[...], allow_missing=True)`
affects: all
gotchaField names must be valid Python identifiers; environment variable names are automatically derived by uppercasing (e.g., `my_field` -> `MY_FIELD`). Conflicts with other env vars can cause unexpected overrides.
fix
Use explicit env mappings via `field(env='OTHER_NAME')` in the config class.
affects: all
Upgrade
Version history
2.0.3latest on PyPI · released Apr 2, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
typed-config — pip install typed-config · libregistry