Settings management using environment variables and type annotations.
Project description
Envotate
Work in progress
Settings management using environment variables and type annotations. This intended to support both class-based and module-based configurations.
Example
Define a configuration like this:
# app/settings.py
from envotate.env import Env, env
from envotate.types import Choice, Default
@env
class Database:
DB_USER: str
DB_PASSWORD: str
DB_HOST: str
DB_PORT: int
DB_NAME: str
PY_39 = "py39"
PY_310 = "py310"
@env
class Settings:
DATABASE: Database
DEBUG: bool = False
PY_VERSION: Env[str, Choice([PY_39, PY_310]), Default(PY_39)]
Then access it in an application:
# app/main.py
from app.settings import Settings
def main():
print(Settings.DATABASE.DB_NAME)
if __name__ == "__main__":
main()
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
envotate-0.0.1.tar.gz
(8.4 kB
view details)
Built Distribution
envotate-0.0.1-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file envotate-0.0.1.tar.gz
.
File metadata
- Download URL: envotate-0.0.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9adbc51e2667c035cfa724c3cf62f74135e2db69ae3c5a9d744e19ce37e8e9 |
|
MD5 | e0174208bd2691888210bfe8c7899ede |
|
BLAKE2b-256 | af5c8b94e4f9c75870dee5ba6a6248eddedc90acc5350065bfae5f2b3a84328d |
File details
Details for the file envotate-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: envotate-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f9a11c95dff368002fb83346be37f9f74ee8668cb870c662f59a198b156a325 |
|
MD5 | d01ffb029d4314c0d2a6fa5e0c43305d |
|
BLAKE2b-256 | aab2a93241a9035b8f7eafc7e6dd037a1bc3d01e40012e0ab9036ef4d65120b4 |