Skip to main content

Easy Yaml based Configuration for Python

Project description

EYConf

Easy Yaml based Configuration for Python

build status docs License: GPL v3

Features

  • Generate: Automatically convert a schema to a yaml configuration file, including comments!
  • Validate: Validate a given configuration file against your schema and raise human readable errors!
  • Extend: Introduce custom logic by extending the EYConf class!
  • Reload: Reload your configuration on the fly without restarting your application!

Installation

You can install EYConf from PyPI using pip.

pip install eyconf

Example Usage

from dataclasses import dataclass
from eyconf import EYConf

@dataclass
class Transport:
    """Email transport configuration"""
    host: str = 'imap.example.com'
    port: int = 993
    username: str = 'user'
    password: str = 'password'
    use_ssl: bool = False

@dataclass
class Other:
    """Other configuration options"""
    bar: int | None = None

@dataclass
class ConfigSchema:
    """My configuration schema

    Docstrings are used as comments in the generated yaml file!
    """
    transport: Transport
    other: Other


config = EYConf(ConfigSchema)

This generate the following config.yaml file in your current working directory:

# My configuration schema
# Docstrings are used as comments in the generated yaml file!

transport:
  # Email transport configuration

  host: imap.example.com
  port: 993
  username: user
  password: password
  use_ssl: false

other:
  # Other configuration options

  bar: null

Please refer to the documentation for more information.

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

eyconf-0.1.0.tar.gz (91.1 kB view details)

Uploaded Source

Built Distribution

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

eyconf-0.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file eyconf-0.1.0.tar.gz.

File metadata

  • Download URL: eyconf-0.1.0.tar.gz
  • Upload date:
  • Size: 91.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eyconf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 21484de09a4d6d94f7e16ef7d7643d8cc7428c33158b24eff3255ee1216d4c4c
MD5 fcb91a407143ad6dbe9397b0dd7caff1
BLAKE2b-256 9b9bba17499062408fb18c479f0f813b1cf242a6462f240ada5a04c2f7836875

See more details on using hashes here.

Provenance

The following attestation bundles were made for eyconf-0.1.0.tar.gz:

Publisher: publish.yml on semohr/eyconf

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

File details

Details for the file eyconf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eyconf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eyconf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3658c16a4a155ec29b6bb67414ff6d58c3fb81778438e1b6417b5f17bf05bbb6
MD5 42e03a1cf4a168694337f6322dce0f61
BLAKE2b-256 6d3bc6f80db4405fdd0f3d41dd82fa7f5b76e8e79643bed0584cff9526148e10

See more details on using hashes here.

Provenance

The following attestation bundles were made for eyconf-0.1.0-py3-none-any.whl:

Publisher: publish.yml on semohr/eyconf

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