1 Example
Steffo edited this page 2026-10-01 02:59:06 +00:00

Example

With the code:

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()

You can run:

$ 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 =====