confdaora
Configurations using python annotations
Documentation: https://dutradda.github.io/confdaora
Source Code: https://github.com/dutradda/confdaora
Key Features
- Generate a
DictDaorawith values parsed from environment variables.
Requirements
- Python 3.8+
- dictdaora
- jsondaora
Instalation
$ pip install confdaora
Basic example
from typing import TypedDict
from confdaora import confdaora_env
class AppConfig(TypedDict):
port: int
host: str
config = confdaora_env(AppConfig)
print(config)
Suposing your file calls myconf.py:
PORT=8080 HOST=localhost python myconf.py
{'port': 8080, 'host': 'localhost'}
Complex example
from dataclasses import dataclass
from typing import List
from confdaora import confdaora_env
@dataclass
class DBConfig:
__prefix__ = 'db'
host: str
port: int = 3306
@dataclass
class KeyConfig:
__prefix__ = 'keys'
name: str
values: List[int]
@dataclass
class AppConfig:
db: DBConfig
keys: List[KeyConfig]
host: str
port: int = 8080
config = confdaora_env(AppConfig)
print(config)
Suposing your file calls myconf.py:
HOST=localhost \
DB_HOST=localhost \
KEYS_0_NAME=test \
KEYS_0_VALUES=10,20 \
KEYS_1_NAME=test2 \
KEYS_1_VALUES=30,40 \
python myconf.py
AppConfig(db=DBConfig(host='localhost', port=3306), keys=[KeyConfig0(name='test', values=[10, 20]), KeyConfig1(name='test2', values=[30, 40])], host='localhost', port=8080)
Metadata
Release files for confdaora 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| confdaora-0.2.1.tar.gz | 18.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| confdaora-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / confdaora-0.2.1.tar.gz
| Download URL | confdaora-0.2.1.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0e8d8a201c6c8a57bbc99c42e509a7fcd0188950e656732b00c2317ba177577
|
|
BLAKE2b-256 checksum How to use checksums |
3e0ae5df010e7cd7295bcfd926fefba3a2a8d18c86557179de0fc5d3595e50a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Release files / confdaora-0.2.1-py3-none-any.whl
| Download URL | confdaora-0.2.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dfe5ff40120355f9a116672530ad909fb3cfd6a5db8d0c947dde5491b74f529
|
|
BLAKE2b-256 checksum How to use checksums |
810012a73cf7175a0e70f6fd426f8c90a15fedade6b0e0daec68a06c8807a06b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|