-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow annotations to define settings #60
Comments
You mean class MySettings(AppSettings):
my_foo: str = "my_default"
my_bar: int ? Well yeah, that would be great 😄 ! We would just need to make sure that every feature (setting) of the app can be translated using type annotations. Then refactor 🙂 Not sure what would validators become though 😕 |
While this can work for the simple type settings, I can't imagine any sensible syntax for nested settings. I believe that current notation is succinct enough for all practical intents and purposes. However, I wouldn't mind adding this notation as an alternative as long as I still have access to |
As a middle step, I would propose to translate current The problem I was recently facing, was enabling |
I'm looking again at pydantic: https://pydantic-docs.helpmanual.io/usage/settings/ and https://pydantic-docs.helpmanual.io/usage/validators/. I think you'll find it interesting as well. |
Since
Settings
are basically smartdataclass
, we might use annotations in settings definition to allow even simpler setup.The goal would be
or even yet simpler version
What do you think?
The text was updated successfully, but these errors were encountered: