Merged
Conversation
15d52f2 to
220731d
Compare
65822ea to
c3ab74e
Compare
Advantages: - Explicit declaration of what is expected A default value alone doesn't explain which shape a setting needs to take. - Rich type library Pydantic offers lots of expressive, convenient types out of the box, such as "writeable directory". - Type checking before startup Instead of running into runtime issues, all settings are validated before the application can do anything. - Transparent handling of structured data via JSON Settings can be arbitrarily complex data, which needs to be encoded to strings anyway when passing to the application. With Pydantic we can go directly from Nix attrsets as JSON in an environment variable, instead of taking the detour via Python expressions. Note though that it's inconvenient to use plain attrsets converted to environment variables, since Nix will translate `false` to empty string (which requires extra code to handle that on the Pydantic side), and nested structures, however rare, would need to be handled manually anyway.
Make explicit that this needs to be set deliberately: Enabling or disabling it by default will break either tests or production at runtime if the caller doesn't know the setting exists. Making it required will at least inform the caller early on that there is a decision to be made. This fixes the VM tests (and showcases how cool `pydantic-settings` is).
c3ab74e to
eba5af0
Compare
Collaborator
Author
|
Working towards #464 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.