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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bl_seth-0.3.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bl_seth-0.3.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file bl_seth-0.3.1.tar.gz.

File metadata

  • Download URL: bl_seth-0.3.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.12 Linux/7.0.14-gnu

File hashes

Hashes for bl_seth-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f9e930d1e84300412fb6d7e0d92743126dbcc9581ce8306aa9df83d6bd2118be
MD5 e38083802140af28dd5fa346d77c2e01
BLAKE2b-256 cd6792f7d68fe62eb9dd1797447090a64f750d21d4b57eaebef9d34bdf6079f7

See more details on using hashes here.

File details

Details for the file bl_seth-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: bl_seth-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.12 Linux/7.0.14-gnu

File hashes

Hashes for bl_seth-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3eb3b5d6eb2b3ccc796334d8ec07255a3d64bd79e3e9bc51fc9949c2ecc64dc
MD5 f1be8ce3821a6dcb4dd97c475c142887
BLAKE2b-256 18b17906e400b28fe835b46067c5a0439d4a9cc04957047e818381e3b0ca0595

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page