Skip to content

Commit 502d3be

Browse files
fix(compat): compat with pydantic<2.8.0 when using additional fields
1 parent 32a36f4 commit 502d3be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/julep/types/task.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,17 @@ class Task(BaseModel):
410410

411411
tools: Optional[List[Tool]] = None
412412

413-
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
414413
if TYPE_CHECKING:
414+
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
415+
# value to this field, so for compatibility we avoid doing it at runtime.
416+
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
417+
415418
# Stub to indicate that arbitrary properties are accepted.
416419
# To access properties that are not valid identifiers you can use `getattr`, e.g.
417420
# `getattr(obj, '$type')`
418421
def __getattr__(self, attr: str) -> object: ...
422+
else:
423+
__pydantic_extra__: Dict[str, object]
419424

420425

421426
from .shared.if_else_step_output import IfElseStepOutput

0 commit comments

Comments
 (0)