Skip to main content
Downloads this month Linux tests (Travis) Windows tests (Appveyor) Test coverage (coverall.io) Latest version License

Confix

About

Confix is a language-agnostic configuration parser for Python. It lets you define the default configuration of an app as a standard Python class, then overwrite its attributes from a static configuration file (be it YAML, JSON, INI or TOML) and / or via environment variables. In doing so it validates the overridden settings by:

  • making sure they are of the same type

  • (optional) marking them as mandatory (useful for passwords)

  • (optional) validating them via a callable

Example:

config file:

# config.yml
password: secret

python file:

# main.py
from confix import register, parse

@register()
class config:
    username = 'ftp'
    password = None

parse('config.yaml')
print(config.username)
print(config.password)

shell:

$ python main.py
ftp
secret

For more examples see docs.

Main features

  • supports YAML, JSON, INI and TOML serialization formats.

  • can be easily extended to support other formats.

  • support for Python 3

  • small code base

  • 100% test coverage

  • allows you to define ‘schemas’ in order to validate fields and mark them as required:

# ftp.py
from confix import register, schema

@register()
class config:
    port = schema(default=21, validator=lambda x: isinstance(x, int))
    password = schema(required=True)

Status

Code is solid and fully tested (100% coverage). Its API may change (break) between major versions though.

Release files for confix 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for confix 0.2.2
File Size Uploaded
confix-0.2.2.tar.gz 44.8 kB Details

Release files / confix-0.2.2.tar.gz

Download URL confix-0.2.2.tar.gz
Size 44.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e993af189ed64898c152c1444c129d1f4056d6e5cec3dbc9675574fc1da2c92e
BLAKE2b-256 checksum
How to use checksums
d540d972a8d9dc02ff4ac2cad4bbbd7936a2344a22aae0d820515c72e34c3e6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page