Skip to content

Commit

Permalink
Remove switching logic within settings config (#16961)
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw authored and kevingrismore committed Feb 7, 2025
1 parent 8dd6e5f commit f3285e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
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

0 comments on commit f3285e8

Please sign in to comment.