Skip to main content

A simple library to map YAML data into Python dataclasses

Project description

yaml-dataclass

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

Installation

pip install yaml-pydantic-dataclass

Usage

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

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

    port: int
    debug: bool

if __name__ == '__main__':
    config = AppConfig.read_config()
    print(config.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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yaml_pydantic_dataclass-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0462fb5a8e71eff9ba913e37fe2bb209985365690ce425d0712812606f7d31b1
MD5 8528d1053a36e105af038796254c8d3f
BLAKE2b-256 c3c84376e0232ebc3ed8ea40f5d1a2baceea684ae97a718b10f7711c772a2df9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for yaml_pydantic_dataclass-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ec75cbd08692bfd45f36651e8748c01268d56560e2940a3c932f4834ec7cea5
MD5 aaf6a5ffc289bb96017bed7e0db1bada
BLAKE2b-256 e376a7883581c8c4023c601048852160a5568a51956f78920f8272f9fa608d42

See more details on using hashes here.

Provenance

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