Skip to main content

structconfig

CI

Strongly-typed configuration for Python, powered by msgspec.

load configuration from multiple sources with clear precedence:

  • CLI arguments (highest priority)
  • Environment variables
  • .env files
  • TOML / JSON / YAML files
  • Struct field defaults (lowest priority)

Quick Start

from structconfig import Struct, field, load_config


class DatabaseConfig(Struct):
    host: str = "localhost"
    port: int = 5432


class AppConfig(Struct):
    api_key: str  # required field
    debug: bool = False
    db: DatabaseConfig = field(default_factory=DatabaseConfig)


# load_config from TOML file + env vars
config = load_config(
    AppConfig,
    files=["config.toml"],
    env_prefix="APP",
)
print(config.api_key)

License

This project is a modified fork of saneconfig, licensed under MIT.

Download files

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

Source Distribution

structconfig-0.1.0.tar.gz (90.5 kB view details)

Uploaded Source

Built Distribution

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

structconfig-0.1.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file structconfig-0.1.0.tar.gz.

File metadata

  • Download URL: structconfig-0.1.0.tar.gz
  • Upload date:
  • Size: 90.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for structconfig-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dffc6c6b0301248109f16494acfd97aca296600308121aed82262df84392f2e7
MD5 88a091beeeb0f9ad2acc2096cb13501a
BLAKE2b-256 6817230bcdb67d6069ad5b6fb07cf5d0bf04c295866dec66c4959f2639fa6830

See more details on using hashes here.

File details

Details for the file structconfig-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: structconfig-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for structconfig-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf50c0211d5e89fd1476a41ebe176774b2f059852028869bfda5fee676fd6a5
MD5 7ef9b13d7ff578dd92ee4bcedbc17b5e
BLAKE2b-256 a728907d3ec18cf82dbdfd7ed78cf923bb0f196cf2a6f68667a8fc750fc924ec

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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