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.2.0.tar.gz (92.0 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.2.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for eyconf-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2a55193f1c213d0e6830e60031b24f9fbe47d0daf7bc86568970b402d0553b69
MD5 f62953afefb15573af686491abd27953
BLAKE2b-256 84a567e46d2f091aed5c0cf0f93ce3a03bef02de53101c2132973b16f2b933ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for eyconf-0.2.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.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for eyconf-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de46cf8d4146d9a26bb406ffddb57bfa05beb2f687fdb51a658d7b357851e68f
MD5 53a4ef6d8fd71df50d12eece9a2eaace
BLAKE2b-256 b6b2ca47db98d8d1552ed86f137bb494b274bbb7f7aa33306b51947251731773

See more details on using hashes here.

Provenance

The following attestation bundles were made for eyconf-0.2.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