Skip to main content

A simple library to map YAML data into Python dataclasses

Project description

yaml-dataclass

A basic Python library for mapping YAML data to Python dataclasses.

Installation

pip install yaml-pydantic-dataclass

Usage

# config.yaml
app:
  api:
    port: 8080
  debug: false
from pydantic.dataclasses import dataclass
from yaml_dataclass import YamlConfig


@dataclass
class AppApiConfig:
    port: int


@dataclass
class AppConfig(YamlConfig):
    __path__ = "app"
    __config_file__ = "./config.yaml"

    api: AppApiConfig
    debug: bool


if __name__ == '__main__':
    config = AppConfig.read_config()
    print(config.api.port)  # 8080
    print(config.debug)  # False

Project details


Download files

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

Source Distribution

yaml_pydantic_dataclass-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

yaml_pydantic_dataclass-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file yaml_pydantic_dataclass-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for yaml_pydantic_dataclass-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bafefa0377be3c04bff181ce9a3e2b92077ef39f02f6fbe82baac25fc25dc2bd
MD5 abc5c9c032e872f2625392d1ea96c572
BLAKE2b-256 7adda01adf91a10f7305c413fd49076f0227e37f749c026b174d6638d90e2ae8

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_pydantic_dataclass-0.1.2.tar.gz:

Publisher: python-publish.yml on atrivisc/yaml-pydantic-dataclass

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

File details

Details for the file yaml_pydantic_dataclass-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_pydantic_dataclass-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b20c85e0e4e0d32a761e6ffb68adcd7ecc0c8581fb4f65edc8529af2b584fb30
MD5 30172e4c2897c64f5e4814ad2731ab96
BLAKE2b-256 2b51ef8cd59d98e89a44414947b7ab7e088373e9298ff0508b86df0c4ba3e169

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_pydantic_dataclass-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on atrivisc/yaml-pydantic-dataclass

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

Supported by

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