Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove switching logic within settings config #16961

Merged
merged 5 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ upstream dependency:
ui-replatform:
- changed-files:
- any-glob-to-any-file: ui-v2/**
- all-globs-to-all-files: !ui-v2/src/api/prefect.ts
- all-globs-to-all-files: '!ui-v2/src/api/prefect.ts'
14 changes: 3 additions & 11 deletions src/prefect/_internal/schemas/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import datetime
import os
from typing import Any, ClassVar, Optional, TypeVar, cast
from uuid import UUID, uuid4

Expand All @@ -25,26 +24,19 @@ class PrefectBaseModel(BaseModel):
fields that are passed to it at instantiation. Because adding new fields to
API payloads is not considered a breaking change, this ensures that any
Prefect client loading data from a server running a possibly-newer version
of Prefect will be able to process those new fields gracefully. However,
when PREFECT_TEST_MODE is on, extra fields are forbidden in order to catch
subtle unintentional testing errors.
of Prefect will be able to process those new fields gracefully.
"""

_reset_fields: ClassVar[set[str]] = set()

model_config: ClassVar[ConfigDict] = ConfigDict(
ser_json_timedelta="float",
defer_build=True,
extra=(
"ignore"
if os.getenv("PREFECT_TEST_MODE", "0").lower() not in ["true", "1"]
and os.getenv("PREFECT_TESTING_TEST_MODE", "0").lower() not in ["true", "1"]
else "forbid"
),
extra="ignore",
)

def __eq__(self, other: Any) -> bool:
"""Equaltiy operator that ignores the resettable fields of the PrefectBaseModel.
"""Equality operator that ignores the resettable fields of the PrefectBaseModel.

NOTE: this equality operator will only be applied if the PrefectBaseModel is
the left-hand operand. This is a limitation of Python.
Expand Down
3 changes: 2 additions & 1 deletion src/prefect/server/utilities/schemas/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class PrefectBaseModel(BaseModel):

_reset_fields: ClassVar[set[str]] = set()

# TODO: investigate why removing this fails composite trigger tests?
model_config: ClassVar[ConfigDict] = ConfigDict(
ser_json_timedelta="float",
extra=(
Expand All @@ -84,7 +85,7 @@ class PrefectBaseModel(BaseModel):
)

def __eq__(self, other: Any) -> bool:
"""Equaltiy operator that ignores the resettable fields of the PrefectBaseModel.
"""Equality operator that ignores the resettable fields of the PrefectBaseModel.

NOTE: this equality operator will only be applied if the PrefectBaseModel is
the left-hand operand. This is a limitation of Python.
Expand Down
Loading