Setting management library
Project description
Seth
A setting management library. By grouping all your application settings in one class, it's easier to document.
First, define a class for your settings. It must be a dataclass (or even better,
a frozen dataclass) and inherit from seth.Settings.
from dataclasses import dataclass
from typing import Optional
from bl_seth import Settings
@dataclass
class MySettings(Settings):
MANDATORY: str
"A mandatory string."
DEFAULT: str = "default"
"""A string that defaults to '"default"'."""
INTEGER: int = 1
"An integer that defaults to '1'."
OPTIONAL: Optional[str] = None
"An optional value."
Then instantiate it using its from_dict class method. Most probably, the dictionary
is built from the environment.
import os
settings = MySettings.from_dict(os.environ)
You can now directly access its attributes.
settings.DEFAULT == "default"
settings.OPTIONAL is None
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bl-seth-0.2.0.tar.gz.
File metadata
- Download URL: bl-seth-0.2.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/6.3.7-gnu
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea6288d05c2c91f7d5997dad4e68bd1bf54db5a830e680072fa027f2cc7240f8
|
|
| MD5 |
c2f938e28a889b0a58f2409845065284
|
|
| BLAKE2b-256 |
86a4c6d02005a0e2f113a15398e2761fd7c64f902d3c7e193c440211dd875d51
|
File details
Details for the file bl_seth-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bl_seth-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/6.3.7-gnu
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e460132c18b7c44969093ec84b8a63692349279c080bb70fbac6fef9717db8
|
|
| MD5 |
3f50a2bee5a831851d5aadd5ad3d2109
|
|
| BLAKE2b-256 |
5aeb31e57de76ad60f17a6296e09d32ad9819226354a6e701fec4984b4803957
|