skillfed

cabina

Configuration with typed env vars

cabina v1.1.2 96.1K downloads/30d#13,234 on PyPI8
Permissive license Apache-2.0 DORMANT released

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 cabina

uv

uv add cabina

poetry

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 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

License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Tags

environment variable configurationtyped config managementhierarchical settingsenv var parsingconfiguration with defaultscomputed config valuesclass-based configuration
configuration-managementenvironment-variablestype-safe

More Software Development packages