Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings object #4

Open
berislavlopac opened this issue May 2, 2020 · 0 comments
Open

Add settings object #4

berislavlopac opened this issue May 2, 2020 · 0 comments

Comments

@berislavlopac
Copy link
Owner

Right now, the settings are supposed to be read from a source and kept in (a kind of) a dictionary. The typing is limited, and there is no enforcing types if the source keeps everything in string, like it's the case for environment variables or ini files.

The idea is to add the support for specifying a set of predefined settings, in a form similar to a dataclass or attr.s, something like:

@dataclass
class Config:
    some_value: int
    some_value_with_default: str = "foo bar"

config = configuration(Config)

... or something similar.

Basically it would "enrich" the class with various functionalities useful for configuration:

  • Methods to ingest values from files and environment, similar to what we have now, but with full conversion to the right types.
  • Option to allow or ban values not defined in the specification, and how to convert them.
  • Automatic construction of argument parsers for CLI applications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant