Back to Prefect

__init__

docs/v3/api-ref/python/prefect-settings-__init__.mdx

3.6.30.dev3758 B
Original Source

prefect.settings

Prefect settings are defined using BaseSettings from pydantic_settings. BaseSettings can load setting values from system environment variables and each additionally specified env_file.

The recommended user-facing way to access Prefect settings at this time is to import specific setting objects directly, like from prefect.settings import PREFECT_API_URL; print(PREFECT_API_URL.value()).

Importantly, we replace the callback mechanism for updating settings with an "after" model_validator that updates dependent settings. After https://github.com/pydantic/pydantic/issues/9789 is resolved, we will be able to define context-aware defaults for settings, at which point we will not need to use the "after" model_validator.