Skip to main content

Easy Yaml based Configuration for Python

Project description

EYConf

Easy Yaml based Configuration for Python

PyPI - Version 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.1.tar.gz (94.7 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.1-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eyconf-0.2.1.tar.gz
  • Upload date:
  • Size: 94.7 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.1.tar.gz
Algorithm Hash digest
SHA256 405ce203ba1c1746cec99fcc31c64f88e33c3280558f6f47a55a8d64b7879170
MD5 852e7056de0e7ea53c03f5937bb7efe7
BLAKE2b-256 def27e22a0a714d1939ec1d782096866c92c3afdc2025a6ad7988b988236c7e4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eyconf-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5f1f4e25577fd86381d8c3c1115e0ffde3d98cabf1e39edd891dd7338a98aa3
MD5 b1a5a55b86859f61628c7930791aa20f
BLAKE2b-256 3a3fea948101d8bdc24a7f518076c38e07b427789bb27f432c42af89e6b8454b

See more details on using hashes here.

Provenance

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