Skip to main content

StructConf

PyPI Codecov

Config your project with yaml and validation.

Enjoy wirting your code with IDEs python type hint

Simple Usage

  1. Define your configuration class, with attribute type and default value
from structconf import StructConf

class SimpleConf(StructConf):
    a: int = 1
    b: str = "b"
  1. write your yaml config file (e.g simple.yaml)
a: 2
b: "123"
  1. load yaml config file to your struct class
conf = SimpleConf.load("simple.yaml")
assert conf.a == 2
assert conf.b == "123"

Advanced Usage

StructConf use pydantic to validate your yaml and python class. So we can use recursive modelto build complex configuration.

from structconf import StructConf

class AConf(StructConf):
    a: int = 1


class BConf(StructConf):
    b: int = 2


class ComplexConf(StructConf):
    aconf: AConf = AConf()
    bconf: BConf = BConf()

Metadata

Release files for structconf 0.3.0

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

Source distribution (sdist)

Source distribution for structconf 0.3.0
File Size Uploaded
structconf-0.3.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for structconf 0.3.0
File Interpreter ABI Platform
structconf-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / structconf-0.3.0.tar.gz

Download URL structconf-0.3.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
56623142de6e6c5395efdf8267a5f1b1e5e821ac71cc700df5a5c3e3413f2836
BLAKE2b-256 checksum
How to use checksums
e002ad390bcd2709ba953179027efb34b44d776a95b036296decfbfdc47698f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.7.10 Darwin/20.3.0

Release files / structconf-0.3.0-py3-none-any.whl

Download URL structconf-0.3.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e521ae24764f4da532be9777c346e95819c803f814eacc8117d4dc235f91825f
BLAKE2b-256 checksum
How to use checksums
7811da08514c48f8ef9e6b43e6d1d24e07f7ae913fd09337f97980244f8e11b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.5 CPython/3.7.10 Darwin/20.3.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.0.2

2 release files

0.0.1

2 release 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