envmix
Typed environment loader for Pydantic v2 models.
Features
- Simple:
from_env()fills fields from overrides > env vars > defaults - Typed: ships
py.typed; works nicely with type checkers - Robust casting: JSON-first via TypeAdapter; CSV and k=v fallbacks
Install
pip install envmix
Quick start
from pydantic import BaseModel
from envmix import EnvMixModel
class DB(BaseModel):
host: str
port: int
class Settings(EnvMixModel):
__env_prefix__ = "APP_"
host: str = "127.0.0.1"
port: int = 8080
debug: bool = False
# export APP_PORT=5000 APP_DEBUG=true
s = Settings.from_env()
print(s.port) # 5000
print(s.debug) # True
Custom env key per field
from pydantic import Field
class Settings(EnvMixModel):
server_host: str = Field("0.0.0.0", json_schema_extra={"env": "SERVER_HOST"})
License MIT
Metadata
Release files for envmix 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| envmix-0.1.2.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| envmix-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / envmix-0.1.2.tar.gz
| Download URL | envmix-0.1.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c429799fdb929762875b8b9fd8cd0b0b84c17b7156ced57e9b6f2aa5f0a66c4
|
|
BLAKE2b-256 checksum How to use checksums |
6df30f803f6709141ed2f8dd363a6e070a0505f0eaad26ebb441d6b1eca7ca33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / envmix-0.1.2-py3-none-any.whl
| Download URL | envmix-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9402845fb06d4a02b434e393fb7e18b0995dc8f47d613a01cc4a9ba5c3383a4
|
|
BLAKE2b-256 checksum How to use checksums |
e8614ded333aa7ad990ad30de52a6d45b6b1d0c59968212483633c0a1d5f53cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|