cabina
Configuration with typed env vars
What it is and what it does
Cabina is a Python library for building typed, hierarchical configurations driven by environment variables. It lets you define config as nested classes with type annotations, automatically parsing environment variables into the correct types (string, int, bool, etc.) with sensible defaults. You can also define computed properties that derive values from other config fields, and use custom parsers for special formats like JSON or duration strings.
The library is designed to reduce boilerplate in configuration setup—instead of manually reading os.environ and casting values, you declare your config structure once as a class hierarchy and cabina handles parsing, validation, and access. It supports flat configs (inheriting both Config and Section), prefixed environment variables to avoid collisions, lazy evaluation of variables, and inheritance patterns for specializing configs across environments.
Use it for:
- Define a web service config with typed host, port, and timeout settings parsed from environment variables with sensible defaults.
- Build a hierarchical config for a microservice with separate sections for database, cache, and API settings, each with their own env var prefix.
- Create computed config values like a full API URL derived from separate host and port variables, updated automatically if either changes.
- Implement environment-specific configs (dev, staging, prod) by subclassing a base Config and overriding section values.
- Parse complex JSON or custom-format config from environment variables using custom parser functions.
- Defer config parsing until first access using lazy_env to handle variables that may not exist at import time.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Cabina provides class-based configuration management with automatic environment variable parsing, type safety, computed values, and hierarchical sections for building environment-driven configs.
Yes, if you need typed environment-driven configuration with minimal dependencies. The low install friction, permissive license, and no known vulnerabilities make it safe to adopt. However, the dormant maintenance status (584 days since last release) means you should verify it handles your specific use cases and accept that bug fixes or feature requests may move slowly. Best suited for straightforward config needs rather than highly specialized or rapidly evolving requirements.
Install
cabina on PyPI
pip
pip install cabinauv
uv add cabinapoetry
poetry add cabinaInstalling cabina
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was 584 days ago, though the repository remains active with a recent commit on 2025-01-07. No known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
pip install cabina
import cabina
from cabina import env, computed
class Config(cabina.Config, cabina.Section):
API_HOST = env.str("API_HOST", default="localhost")
API_PORT = env.int("API_PORT", default=8080)
@computed
def API_URL(cls) -> str:
return f"http://{cls.API_HOST}:{cls.API_PORT}"
print(Config.API_URL) # http://localhost:8080
Verify before relying
- Whether the dormant maintenance status (584 days since release) affects real-world reliability for production use.
- Performance characteristics when dealing with large numbers of config sections or deeply nested hierarchies.
- Whether custom parser support (e.g. pytimeparse) is production-tested or community-maintained.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — niltype |
| Maintenance | dormant — 584 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 96,060/month — #13,234 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cabina-1.1.2-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
environsenvirons parses environment variables into…
permissive · top 5,000 on PyPI
envparseParses environment variables with optional type…
permissive · top 15,000 on PyPI
configProvides hierarchical configuration management…
permissive · top 5,000 on PyPI
hierarchical-confLoads configuration from YAML files organized…
unclear · top 15,000 on PyPI
python-json-configLoads JSON configuration files and provides…
permissive · top 15,000 on PyPI
load-dotenvAutomatically loads environment variables from…
permissive · top 15,000 on PyPI
databindDatabind deserializes JSON-like nested data…
permissive · top 15,000 on PyPI
overridesProvides a @override decorator that validates…
permissive · top 1,000 on PyPI
pydantic-settingsLoads and validates application settings from…
permissive · top 100 on PyPI
consulateConsulate is a Python client library for…
permissive · top 15,000 on PyPI