Skip to main content

didactic-settings

Typed application settings on top of dx.Model.

PyPI Python License CI Docs

Contributes didactic.settings to the namespace package.

Install

pip install didactic-settings
pip install 'didactic-settings[yaml]'   # adds YAML support

The package depends on didactic. The optional yaml extra adds PyYAML for .yaml / .yml config files.

Quickstart

import didactic.api as dx
from didactic.settings import Settings, EnvSource, FileSource


class AppSettings(Settings):
    debug: bool = False
    db_url: str
    port: int = 8080

    __sources__ = (
        FileSource(path="config.toml"),
        EnvSource(prefix="APP_"),
    )


cfg = AppSettings.load()
cfg.port                      # the resolved value
cfg.__provenance__["port"]    # 'env' / 'file' / 'default' / 'override'

Settings inherits from dx.Model, so every Model feature works: type checks, axioms, validators, JSON Schema export.

Sources

source reads from
EnvSource(prefix="APP_") environment variables
DotEnvSource(path=".env", prefix="APP_") dotenv file
FileSource(path="config.toml") JSON, TOML, or YAML by suffix
CliSource(args=ns) parsed argparse.Namespace or dict

Sources are walked in declaration order; later sources override earlier ones. Keyword overrides at Settings.load(...) win over every source.

Documentation

See Guides > Settings for the full source documentation, coercion rules, and provenance reporting.

License

Released under the MIT License.

Download files

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

Source Distribution

didactic_settings-0.9.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

didactic_settings-0.9.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file didactic_settings-0.9.1.tar.gz.

File metadata

  • Download URL: didactic_settings-0.9.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for didactic_settings-0.9.1.tar.gz
Algorithm Hash digest
SHA256 32dc6e6ff6b75f34e05fc4534da492bfaf584aee376a50fa51076520cd19d882
MD5 397411f3a882424ff48845a38e54dccf
BLAKE2b-256 02d042860ab0429c40e4a056221651f36f999da4f9a427bb31d70e8f0d2780e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for didactic_settings-0.9.1.tar.gz:

Publisher: release.yml on panproto/didactic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file didactic_settings-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for didactic_settings-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86b459dca54261ad1ca8a3b7138a434866d8f6874ccbdc950cdca7084451a946
MD5 77769640a678ab161f7c719c3130cfaf
BLAKE2b-256 aab2843c9d15f25ce0ea83a7e93d403a0b0b89cea40409cb4b5d66f20def829e

See more details on using hashes here.

Provenance

The following attestation bundles were made for didactic_settings-0.9.1-py3-none-any.whl:

Publisher: release.yml on panproto/didactic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.10.0

2 files

This release

0.9.1 This release

2 files

0.9.0

2 files

0.8.0

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

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