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
Prefect's settings.py is roughly ~150 custom Setting objects which is dynamically collected into a BaseSettings object at runtime. By dynamically collecting these at runtime, this
obfuscates typing and
makes it difficult to ergonomically inherit from in derivative frameworks (like ControlFlow).
For instance, it's difficult to change the default value of a single setting given it's current design, but could be trivial if PrefectBaseSetting was a simple static subclass of Pydantic's BaseSetting.
From examining it's original PRs, the current design was taken on:
to attach validators to fields themselves, and not as field_validators on the Settings object.
to create settings dependent on the value of other settings.
These two outcomes required a sophisticated design two years ago, but are now first-class concepts in Pydantic: AfterValidator and computed_field, respectively.
Describe the proposed behavior
I propose having Prefect's BaseSetting's object be a canonical subclass of Pydantic's BaseSetting:
I'm adding this to our Settings milestone not necessarily as a complete acceptance, but either way I want to have a strong stance on why we did or did not accept this (my instinct is that we'll ultimately accept it, for the record).
Describe the current behavior
Prefect's
settings.py
is roughly ~150 customSetting
objects which is dynamically collected into aBaseSettings
object at runtime. By dynamically collecting these at runtime, thisFor instance, it's difficult to change the default value of a single setting given it's current design, but could be trivial if
PrefectBaseSetting
was a simple static subclass of Pydantic'sBaseSetting
.From examining it's original PRs, the current design was taken on:
settings dependent on the value of other settings
.These two outcomes required a sophisticated design two years ago, but are now first-class concepts in Pydantic:
AfterValidator
andcomputed_field
, respectively.Describe the proposed behavior
I propose having Prefect's BaseSetting's object be a canonical subclass of Pydantic's BaseSetting:
Example Use
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: