Configuration helper for Python
Find a file
Steffo f110c99986
All checks were successful
Test with Pytest the Python package using Poetry / Run tests (push) Successful in 13s
Change package description
2025-11-14 04:44:23 +01:00
.forgejo/workflows Change deploy path 2025-10-22 00:57:20 +02:00
.idea Add -m cfig.sample.usage run config 2022-09-06 04:52:06 +02:00
.media Add new icons 2025-11-14 04:32:07 +01:00
.vscode Recommend tamasfe.even-better-toml for VSCode 2025-11-14 04:40:36 +01:00
cfig Display a fancy error message if cfig.errors.BatchResolutionFailure is raised 2022-09-06 04:51:43 +02:00
docs Advanced docs: describe how to access the result_dict 2022-09-06 04:26:49 +02:00
.editorconfig Add .editorconfig 2025-11-14 04:39:51 +01:00
.gitattributes Include documentation in project languages 2025-11-14 04:41:54 +01:00
.gitignore 🎉 First commit 2022-04-13 17:54:53 +02:00
cfig.iml 💥 Yay more changes 2022-04-20 04:15:10 +02:00
LICENSE.txt Rename LICENSE to LICENSE.txt 2022-04-28 18:15:28 +02:00
poetry.lock Rewrite pyproject.toml in new format 2025-10-07 07:57:31 +02:00
pyproject.toml Change package description 2025-11-14 04:44:23 +01:00
README.md Update README 2025-11-14 04:39:20 +01:00

Cfig

Configuration helper for Python

Example

import cfig

config = cfig.Configuration()

@config.required()
def MAX_USERS(val: str) -> int:
    """The maximum number of users that will be able to login to this application."""
    try:
        return int(val)
    except (ValueError, TypeError):
        raise cfig.InvalidValueError("Not an int.")

if __name__ == "__main__":
    config.cli()
$ python -m myproject.mydefinitionmodule
===== Configuration =====

MAX_USERS       → Required, but not set.
The maximum number of users that will be able to login to this application.

===== End =====

See the quickstart guide for more information.

Why?

To make containerizing applications less of a pain.

Tools

Written in Python Prose with Sphinx Testing with pytest

Packaging

Available on PyPI Available on Forgejo Packages

Documentation

Documentation available Licensed under MIT license

Development

Code repository Releases Issues Pull requests