Configuration with typed env vars
Project description
cabina
Installation
pip3 install cabina
Usage
import cabina
from cabina import computed, env
class Config(cabina.Config):
class Main(cabina.Section):
API_HOST: str = env.str("API_HOST", default="localhost")
API_PORT: int = env.int("API_PORT", default=8080)
@computed
def API_URL(cls) -> str:
return f"http://{cls.API_HOST}:{cls.API_PORT}"
class Kafka(cabina.Section):
BOOTSTRAP_SERVERS: tuple = env.tuple("KAFKA_BOOTSTRAP_SERVERS")
AUTO_COMMIT: bool = env.bool("KAFKA_AUTO_COMMIT", True)
assert Config.Main.API_URL == "http://localhost:8080"
assert Config["Main"]["API_URL"] == "http://localhost:8080"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cabina-0.3.0.tar.gz
(8.1 kB
view hashes)
Built Distribution
cabina-0.3.0-py3-none-any.whl
(14.9 kB
view hashes)