prefect.settings.models.root

Functions

canonical_environment_prefix

canonical_environment_prefix(settings: 'Settings') -> str

Classes

Settings

Settings for Prefect using Pydantic settings.

See https://docs.pydantic.dev/latest/concepts/pydantic_settings

Methods:

post_hoc_settings

post_hoc_settings(self) -> Self

Handle remaining complex default assignments that aren’t yet migrated to dependent settings.

With Pydantic 2.10’s dependent settings feature, we’ve migrated simple path-based defaults to use default_factory. The remaining items here require access to the full Settings instance or have complex interdependencies that will be migrated in future PRs.

emit_warnings

emit_warnings(self) -> Self

More post-hoc validation of settings, including warnings for misconfigurations.

copy_with_update

copy_with_update(self: Self, updates: Optional[Mapping['Setting', Any]] = None, set_defaults: Optional[Mapping['Setting', Any]] = None, restore_defaults: Optional[Iterable['Setting']] = None) -> Self

Create a new Settings object with validation.

Args:

  • updates: A mapping of settings to new values. Existing values for the given settings will be overridden.
  • set_defaults: A mapping of settings to new default values. Existing values for the given settings will only be overridden if they were not set.
  • restore_defaults: An iterable of settings to restore to their default values.

Returns:

  • A new Settings object.

hash_key

hash_key(self) -> str

Return a hash key for the settings object. This is needed since some settings may be unhashable, like lists.