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

Uploaded Python 3

File details

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

File metadata

  • Download URL: yaml_pydantic_dataclass-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b21501b0be59ea83305bddbe782d76fc5ba8f56f6b356487a4cc7470a0442610
MD5 93889cc5114354664d31cca44812a284
BLAKE2b-256 7d5be52f38a490bacf9ace2c18037de1ce343fce75d6150ff4446fd64107e506

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for yaml_pydantic_dataclass-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6f03acfec9d4964c6665119645b3f5e23e9ea05036808f6be91542439538600d
MD5 ff2801bebfd4a66bf00f273c92f986c4
BLAKE2b-256 8573ec6af5ce4fd2c9f20f2b14f7fcd0eed75261e3db9987c3db0e750ad2fe81

See more details on using hashes here.

Provenance

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