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.2.0.tar.gz
(6.8 kB
view details)
Built Distribution
cabina-0.2.0-py3-none-any.whl
(13.6 kB
view details)
File details
Details for the file cabina-0.2.0.tar.gz
.
File metadata
- Download URL: cabina-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
acbeea4925b01cab36dde880bb8b98d42c202bb36b0f2451ed4500319e521bd0
|
|
MD5 |
f1d4060de124f4e1595312fbf1eb178d
|
|
BLAKE2b-256 |
f3de650ea5339d6b4229756d13b92fc8cede71e3a5e398b2d01b5ddb1156113c
|
File details
Details for the file cabina-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: cabina-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f0585fa0d636943c9db9903808786c48d95060a818828ba37673cff2b1f936b6
|
|
MD5 |
d0716e92187ebe9476a14cc16386a410
|
|
BLAKE2b-256 |
144c1732e350af4a253ffe5069e79d0c984c1a62762279cbb80fe45b62243269
|