env-proxy¶
env-proxy reads environment variables with type hints, type conversion, and a
declarative config layer. Define your environment-driven configuration once
as a typed class, then access fields like any other attribute — with eager
validation, optional freezing, and sample .env generation included.
Quickstart¶
import os
from env_proxy import EnvConfig, Field
os.environ["MYAPP_DEBUG"] = "true"
os.environ["MYAPP_DATABASE_URL"] = "sqlite:///data.db"
os.environ["MYAPP_CACHE_BACKENDS"] = "redis,memcached"
class MyConfig(EnvConfig):
env_prefix: str = "MYAPP"
debug: bool = Field(description="Enable debug mode", default=False)
database_url: str = Field(description="Database connection URL")
cache_backends: list[str] = Field(description="Cache backends", type_hint="list")
config = MyConfig()
print(config.debug) # True
print(config.database_url) # "sqlite:///data.db"
print(config.cache_backends) # ["redis", "memcached"]
Where to go next¶
The documentation is organised by the Diátaxis framework:
- Tutorial — start here if you're new. A
guided walkthrough from install to your first
EnvConfig. - How-to guides — task-oriented recipes:
reading env vars ·
defining configs ·
overriding values ·
validating & freezing ·
custom converters ·
sample
.env· tuning the key cache · handling errors. - Reference — look-up material: Field options · type hints · exceptions · library env vars · key transformations · auto-generated API.
- Explanation — the "why": why EnvConfig? · override semantics · lazy vs frozen.