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.3.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.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yaml_pydantic_dataclass-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 8a7904f16b1eb6b651467aa60aa017272986a357fc9ea76dec63fcf2858c8673
MD5 891eef54dfe157ddd80da171b7a0ef7b
BLAKE2b-256 3016f82b96d357bac9d67a4b5bbb13e71a1831095573f02e321edb90bc41115a

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_pydantic_dataclass-0.1.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_pydantic_dataclass-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83280b4a2def73fbd8a8241a172a87553f508f99ff1af73bb5644b9f978fd9d3
MD5 b5de4ec0d2d51fb5975d3ae6cbdbe859
BLAKE2b-256 c269da04e943e98619e8e746dabfb5b64f2050e31797539cfda16f28d2a50b7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_pydantic_dataclass-0.1.3-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