Skip to main content

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

You can display the documentation for a setting class from the command line:

seth bl_seth.utils:DemoSettings

jedi needs to be available for variable documentation to be displayed. This can be done by installing seth[all] or jedi separately.

Release files for bl-seth 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bl-seth 0.3.1
File Size Uploaded
bl_seth-0.3.1.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bl-seth 0.3.1
File Interpreter ABI Platform
bl_seth-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.4 kB

Release files / bl_seth-0.3.1.tar.gz

Download URL bl_seth-0.3.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9e930d1e84300412fb6d7e0d92743126dbcc9581ce8306aa9df83d6bd2118be
BLAKE2b-256 checksum
How to use checksums
cd6792f7d68fe62eb9dd1797447090a64f750d21d4b57eaebef9d34bdf6079f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.12 Linux/7.0.14-gnu

Release files / bl_seth-0.3.1-py3-none-any.whl

Download URL bl_seth-0.3.1-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3eb3b5d6eb2b3ccc796334d8ec07255a3d64bd79e3e9bc51fc9949c2ecc64dc
BLAKE2b-256 checksum
How to use checksums
18b17906e400b28fe835b46067c5a0439d4a9cc04957047e818381e3b0ca0595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.12 Linux/7.0.14-gnu

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page