You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In one of my newer projects I plan to use pydantic-settings paired with pydanclick for a declarative way to load settings from cli args and other sources such as pyproject.toml at the same time.
When thinking about it I noticed there could be cases where I don't want users to configure things from a specific source. For instance a --clean or --clear for creating a clean build in a build tool should only be possible via cli args in my opinion. Taking in this arg from other sources could lead to potentially destructive behaviour.
I think using an annotation would be the best way to implement this. I imagined it as something like this:
jvllmr
changed the title
Disable loading field from certain sources via annotation
Allow disabling loading field from certain sources via annotation
Jan 11, 2025
In one of my newer projects I plan to use
pydantic-settings
paired withpydanclick
for a declarative way to load settings from cli args and other sources such aspyproject.toml
at the same time.When thinking about it I noticed there could be cases where I don't want users to configure things from a specific source. For instance a
--clean
or--clear
for creating a clean build in a build tool should only be possible via cli args in my opinion. Taking in this arg from other sources could lead to potentially destructive behaviour.I think using an annotation would be the best way to implement this. I imagined it as something like this:
SettingsFieldOpts would be a new type which could hold more options for a field if needed in the future.
The text was updated successfully, but these errors were encountered: