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, 'config.yaml')

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.0.7.tar.gz (88.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.0.7-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eyconf-0.0.7.tar.gz
  • Upload date:
  • Size: 88.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.0.7.tar.gz
Algorithm Hash digest
SHA256 d5af5f69231655d2a49ef16b0474cc51d74866f9ef50b82191923f9b18b3bad8
MD5 861adcbb17a9edf799c75c9e2880a4e9
BLAKE2b-256 7609bacdcb5888d124791ef595e7b760391dadf540c5aec42339f991647b626f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eyconf-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 22.5 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.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e0496b987b6eb824fdae91744d45b0af8e1a2e760f02805d16834cc5b2e490ec
MD5 877d8e2a7b396fbe31ee15cea4582a55
BLAKE2b-256 86b93e2e80c437ba459c5d2f38361bc8a278c5711f3b4c4bb502355228f32c9b

See more details on using hashes here.

Provenance

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