--- id: cabina version: "1.1.2" license: Apache-2.0 license_treatment: permissive maintenance: dormant --- # cabina — Configuration with typed env vars License: permissive · Maintenance: dormant · Downloads: 96.1K/mo ## 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 above — 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 pip install cabina uv add cabina poetry add cabina ## Installing 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_current - Install friction: low - Maintenance: dormant - Downloads: 96.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags environment variable configuration, typed config management, hierarchical settings, env var parsing, configuration with defaults, computed config values, class-based configuration, configuration-management, environment-variables, type-safe [View on SkillFed](https://skillfed.io/packages/cabina) · [View on PyPI](https://pypi.org/project/cabina/)