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 details)
Built Distribution
cabina-0.3.0-py3-none-any.whl
(14.9 kB
view details)
File details
Details for the file cabina-0.3.0.tar.gz
.
File metadata
- Download URL: cabina-0.3.0.tar.gz
- Upload date:
- Size: 8.1 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.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f580b4ba7a71e917a3e7b4a24f451b73011e91adbbc8fdd96872c2a9e57c77d1
|
|
MD5 |
8a6ecf3198cd494c03ee2d210a3fa93b
|
|
BLAKE2b-256 |
51ce89bb6d31d039e373cfa63f6ffc81f9b5704f297542a32da5d3c1962fd83d
|
File details
Details for the file cabina-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: cabina-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.9 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.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0e66e7cf69e379dfb273aad6dcc57e81a80141a2fec7a45274c0a82deef5be85
|
|
MD5 |
0639c9cbc870a2af4cd0601c56ec0f90
|
|
BLAKE2b-256 |
a9513f9a9f4315bb1678785b7c081a7b081661b454f6e2db9d4476054db1931a
|