<@ULVA73B9P> I'm using the Prefect 3.4.9 python sd...
# ask-marvin
n
@Marvin I'm using the Prefect 3.4.9 python sdk. Lately, every time I use a Prefect command from the CLI, I get this warning:
Copy code
/codebuild/output/src726/src/s3/00/ci/.venv/lib/python3.12/site-packages/pydantic_settings/main.py:425: UserWarning: Config key `pyproject_toml_table_header` is set in model_config but will be ignored because no PyprojectTomlConfigSettingsSource source is configured. To use this config key, add a PyprojectTomlConfigSettingsSource source to the settings sources via the settings_customise_sources hook.
  self._settings_warn_unused_config_keys(sources, self.model_config)
/codebuild/output/src726/src/s3/00/ci/.venv/lib/python3.12/site-packages/pydantic_settings/main.py:425: UserWarning: Config key `toml_file` is set in model_config but will be ignored because no TomlConfigSettingsSource source is configured. To use this config key, add a TomlConfigSettingsSource source to the settings sources via the settings_customise_sources hook.
  self._settings_warn_unused_config_keys(sources, self.model_config)
/codebuild/output/src726/src/s3/00/ci/.venv/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'default' attribute with value 'UTC' was provided to the `Field()` function, which has no effect in the context it was used. 'default' is field-specific metadata, and can only be attached to a model field using `Annotated` metadata or by assignment. This may have happened because an `Annotated` type alias using the `type` statement was used, or if the `Field()` function was attached to a single member of a union type.
  warnings.warn(
Why?
m
thought for 177.8 seconds
Short answer: it’s a known compatibility issue between Prefect 3.4.9 and newer pydantic/pydantic-settings releases. It’s harmless, and it’s fixed in newer Prefect versions. What’s happening - The “Config key … will be ignored” warnings come from pydantic-settings 2.11+. Prefect 3.4.9 uses custom TOML settings sources that confuse the new “unused config keys” check, so pydantic-settings warns even though things are working. - The “UnsupportedFieldAttributeWarning … Field(default=’UTC’)” comes from pydantic 2.12+, which changed how defaults should be declared for Annotated/union types. Fixes - Prefect added logic to avoid the pydantic-settings warnings and updated the models for pydantic 2.12+. - pydantic‑settings warning fix: PR #19029 (commit 3420da2) - pydantic 2.12 warning fix: PR #19146 (commit c3586bf1) What you can do - Best: upgrade Prefect to a version that includes both fixes (3.4.24 or newer).
Copy code
pip install --upgrade 'prefect>=3.4.24'
- If you can’t upgrade Prefect yet: - Pin dependencies to avoid the new warnings:
Copy code
pip install 'pydantic<2.12' 'pydantic-settings<2.11'
- Or temporarily suppress in CI via environment variable:
Copy code
export PYTHONWARNINGS="ignore:.*Config key .* will be ignored: pydantic_settings.main;ignore:.*UnsupportedFieldAttributeWarning: pydantic._internal._generate_schema"
Note: use PYTHONWARNINGS or run Python with -W; passing -W to the
prefect
CLI directly won’t work. If you can share whether upgrading is possible in your CodeBuild environment, I can suggest the cleanest path (upgrade vs. constraints file) for your setup.