Skip to main content

pipeline status coverage report

Typed Settings

PoC for library for managing (typed) settings – for server processes as well as commandline programms.

Requirements

  • Default settings are defined by app and can be overridden by config files, environment variables and click options.

  • You define settings as attrs class with types, converters and validators.

  • Attributes are basic data types (bool, int, float, str), lists of basic types, or nested settings classes.

  • Settings can be loaded from multiple config files.

  • Config files are allowed to contain settings for multiple apps (like pyproject.toml)

  • Paths to config files have to be explicitly named. Most defaults are not useful in many cases and have to be changed anyways.

  • Additional paths for config files can be specified via an environment variable. As in PATH, multiple paths are separated by a :. The last file in the list has the highest priority.

  • Environment variables with a defined prefix override settings from config files. This can optionally be disabled.

  • Click options for some or all settings can be generated. They are passed to the cli function as a single object (instead of individually).

  • Settings must be explicitly loaded, either via typed_settings.load_settings() or via typed_settings.click_options().

  • Both functions allow you to customize config file paths, prefixes et cetera.

Example

import click

import typed_settings as ts


@ts.settings
class Host:
    name: str
    port: int = ts.option(converter=int)


@ts.settings(kw_only=True)
class Settings:
    url: str
    default: int = 3
    host: Host = ts.option(converter=lambda d: Host(**d))


settings = ts.load_settings(
    settings_cls=Settings, appname='example', config_files=['settings.toml']
)
print(settings)


@click.command()
@ts.click_options(Settings, 'example', ['settings.toml'])
def main(settings):
    print(settings)


if __name__ == '__main__':
    main()

Metadata

Release files for typed-settings 0.4

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

Source distribution (sdist)

Source distribution for typed-settings 0.4
File Size Uploaded Provenance Actions
typed-settings-0.4.tar.gz 14.7 kB Without provenance Details for typed-settings-0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typed-settings 0.4
File Interpreter ABI Platform Actions
typed_settings-0.4-py3-none-any.whl Python 3 none any Details for typed_settings-0.4-py3-none-any.whl

Total release size: 23.9 kB

Release files / typed-settings-0.4.tar.gz

Download URL typed-settings-0.4.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0bcfd91f0f9655d233e27caddd711e795a1aceff971f29fff51ed1575e8474c3
BLAKE2b-256 checksum
How to use checksums
fb4d7b0bc1fdd3bff684c561b310bcbd97a3cdc0c75fee273cb376740372ab52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6

Release files / typed_settings-0.4-py3-none-any.whl

Download URL typed_settings-0.4-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44459a079b7e3af70d8f880ae959703080427fc1e767ee195d889b826c9f72ab
BLAKE2b-256 checksum
How to use checksums
40614d5bfece72b43ced65c8191c031242cf8e877caf1c3c25cd51adf9fecbb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6

Security for typed-settings 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files No provenance

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