prefect-client 2.16.8__py3-none-any.whl → 2.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prefect/__init__.py +0 -18
- prefect/_internal/compatibility/deprecated.py +108 -5
- prefect/_internal/compatibility/experimental.py +9 -8
- prefect/_internal/concurrency/api.py +23 -42
- prefect/_internal/concurrency/waiters.py +25 -22
- prefect/_internal/pydantic/__init__.py +16 -3
- prefect/_internal/pydantic/_base_model.py +39 -4
- prefect/_internal/pydantic/_compat.py +69 -452
- prefect/_internal/pydantic/_flags.py +5 -0
- prefect/_internal/pydantic/_types.py +8 -0
- prefect/_internal/pydantic/utilities/__init__.py +0 -0
- prefect/_internal/pydantic/utilities/config_dict.py +72 -0
- prefect/_internal/pydantic/utilities/field_validator.py +135 -0
- prefect/_internal/pydantic/utilities/model_construct.py +56 -0
- prefect/_internal/pydantic/utilities/model_copy.py +55 -0
- prefect/_internal/pydantic/utilities/model_dump.py +136 -0
- prefect/_internal/pydantic/utilities/model_dump_json.py +112 -0
- prefect/_internal/pydantic/utilities/model_fields.py +50 -0
- prefect/_internal/pydantic/utilities/model_fields_set.py +29 -0
- prefect/_internal/pydantic/utilities/model_json_schema.py +82 -0
- prefect/_internal/pydantic/utilities/model_rebuild.py +80 -0
- prefect/_internal/pydantic/utilities/model_validate.py +75 -0
- prefect/_internal/pydantic/utilities/model_validate_json.py +68 -0
- prefect/_internal/pydantic/utilities/model_validator.py +79 -0
- prefect/_internal/pydantic/utilities/type_adapter.py +71 -0
- prefect/_internal/schemas/bases.py +1 -17
- prefect/_internal/schemas/validators.py +425 -4
- prefect/agent.py +1 -1
- prefect/blocks/kubernetes.py +7 -3
- prefect/blocks/notifications.py +18 -18
- prefect/blocks/webhook.py +1 -1
- prefect/client/base.py +7 -0
- prefect/client/cloud.py +1 -1
- prefect/client/orchestration.py +51 -11
- prefect/client/schemas/actions.py +367 -297
- prefect/client/schemas/filters.py +28 -28
- prefect/client/schemas/objects.py +78 -147
- prefect/client/schemas/responses.py +240 -60
- prefect/client/schemas/schedules.py +6 -8
- prefect/concurrency/events.py +2 -2
- prefect/context.py +4 -2
- prefect/deployments/base.py +6 -13
- prefect/deployments/deployments.py +34 -9
- prefect/deployments/runner.py +9 -27
- prefect/deprecated/packaging/base.py +5 -6
- prefect/deprecated/packaging/docker.py +19 -25
- prefect/deprecated/packaging/file.py +10 -5
- prefect/deprecated/packaging/orion.py +9 -4
- prefect/deprecated/packaging/serializers.py +8 -58
- prefect/engine.py +55 -618
- prefect/events/actions.py +16 -1
- prefect/events/clients.py +45 -13
- prefect/events/filters.py +19 -2
- prefect/events/related.py +4 -4
- prefect/events/schemas/automations.py +13 -2
- prefect/events/schemas/deployment_triggers.py +73 -5
- prefect/events/schemas/events.py +1 -1
- prefect/events/utilities.py +12 -4
- prefect/events/worker.py +26 -8
- prefect/exceptions.py +3 -8
- prefect/filesystems.py +7 -7
- prefect/flows.py +7 -3
- prefect/infrastructure/provisioners/ecs.py +1 -0
- prefect/logging/configuration.py +2 -2
- prefect/manifests.py +1 -8
- prefect/profiles.toml +1 -1
- prefect/pydantic/__init__.py +74 -2
- prefect/pydantic/main.py +26 -2
- prefect/serializers.py +6 -31
- prefect/settings.py +72 -26
- prefect/software/python.py +3 -5
- prefect/task_server.py +2 -2
- prefect/utilities/callables.py +1 -1
- prefect/utilities/collections.py +2 -1
- prefect/utilities/dispatch.py +1 -0
- prefect/utilities/engine.py +629 -0
- prefect/utilities/pydantic.py +1 -1
- prefect/utilities/schema_tools/validation.py +2 -2
- prefect/utilities/visualization.py +1 -1
- prefect/variables.py +88 -12
- prefect/workers/base.py +20 -11
- prefect/workers/block.py +4 -8
- prefect/workers/process.py +2 -5
- {prefect_client-2.16.8.dist-info → prefect_client-2.17.0.dist-info}/METADATA +4 -3
- {prefect_client-2.16.8.dist-info → prefect_client-2.17.0.dist-info}/RECORD +88 -72
- prefect/_internal/schemas/transformations.py +0 -106
- {prefect_client-2.16.8.dist-info → prefect_client-2.17.0.dist-info}/LICENSE +0 -0
- {prefect_client-2.16.8.dist-info → prefect_client-2.17.0.dist-info}/WHEEL +0 -0
- {prefect_client-2.16.8.dist-info → prefect_client-2.17.0.dist-info}/top_level.txt +0 -0
@@ -1,106 +0,0 @@
|
|
1
|
-
import copy
|
2
|
-
from dataclasses import dataclass
|
3
|
-
from typing import Any, Optional, Type, TypeVar
|
4
|
-
|
5
|
-
from prefect._internal.pydantic import HAS_PYDANTIC_V2
|
6
|
-
|
7
|
-
if HAS_PYDANTIC_V2:
|
8
|
-
from pydantic.v1 import BaseModel
|
9
|
-
else:
|
10
|
-
from pydantic import BaseModel
|
11
|
-
|
12
|
-
B = TypeVar("B", bound=BaseModel)
|
13
|
-
|
14
|
-
|
15
|
-
@dataclass
|
16
|
-
class _FieldFrom:
|
17
|
-
"""Container for holding the origin of a field's definition"""
|
18
|
-
|
19
|
-
origin: Type[BaseModel]
|
20
|
-
|
21
|
-
|
22
|
-
def FieldFrom(origin: Type[BaseModel]) -> Any:
|
23
|
-
"""
|
24
|
-
Indicates that the given field is to be copied from another class by
|
25
|
-
`copy_model_fields`.
|
26
|
-
"""
|
27
|
-
return _FieldFrom(origin=origin)
|
28
|
-
|
29
|
-
|
30
|
-
def copy_model_fields(model_class: Type[B]) -> Type[B]:
|
31
|
-
"""
|
32
|
-
A class decorator which copies field definitions and field validators from other
|
33
|
-
Pydantic BaseModel classes. This does _not_ make the model a subclass of any of
|
34
|
-
the copied field's owning classes, nor does this copy root validators from any of
|
35
|
-
those classes. Note that you should still include the type hint for the field in
|
36
|
-
order to make typing explicit.
|
37
|
-
|
38
|
-
Use this decorator and the corresponding `FieldFrom` to compose response and
|
39
|
-
action schemas from other classes.
|
40
|
-
|
41
|
-
Examples:
|
42
|
-
|
43
|
-
>>> from pydantic import BaseModel
|
44
|
-
>>> from prefect._internal.schemas.transformation import copy_model_fields, FieldFrom
|
45
|
-
>>>
|
46
|
-
>>> class Parent(BaseModel):
|
47
|
-
... name: str
|
48
|
-
... sensitive: str
|
49
|
-
>>>
|
50
|
-
>>> @copy_model_fields
|
51
|
-
>>> class Derived(BaseModel):
|
52
|
-
... name: str = FieldFrom(Parent)
|
53
|
-
... my_own: str
|
54
|
-
|
55
|
-
In this example, `Derived` will have the fields `name`, and `my_own`, with the
|
56
|
-
`name` field being a complete copy of the `Parent.name` field.
|
57
|
-
|
58
|
-
"""
|
59
|
-
for name, field in model_class.__fields__.items():
|
60
|
-
if not isinstance(field.default, _FieldFrom):
|
61
|
-
continue
|
62
|
-
|
63
|
-
origin = field.default.origin
|
64
|
-
|
65
|
-
origin_field = origin.__fields__[name]
|
66
|
-
|
67
|
-
# For safety, types defined on the model must match those of the origin
|
68
|
-
# We make an exception here for `Optional` where the model can make the same
|
69
|
-
# type definition nullable.
|
70
|
-
if (
|
71
|
-
field.type_ != origin_field.type_
|
72
|
-
and not field.type_ == Optional[origin_field.type_]
|
73
|
-
):
|
74
|
-
if not issubclass(
|
75
|
-
origin_field.type_,
|
76
|
-
field.type_,
|
77
|
-
):
|
78
|
-
raise TypeError(
|
79
|
-
f"Field {name} ({field.type_}) does not match the type of the"
|
80
|
-
f" origin field {origin_field.type_}"
|
81
|
-
)
|
82
|
-
|
83
|
-
# Create a copy of the origin field
|
84
|
-
new_field = copy.deepcopy(origin_field)
|
85
|
-
|
86
|
-
# Retain any validators from the model field
|
87
|
-
new_field.post_validators = new_field.post_validators or []
|
88
|
-
new_field.pre_validators = new_field.pre_validators or []
|
89
|
-
new_field.post_validators.extend(field.post_validators or [])
|
90
|
-
new_field.pre_validators.extend(field.pre_validators or [])
|
91
|
-
|
92
|
-
# Retain "optional" from the model field
|
93
|
-
new_field.required = field.required
|
94
|
-
new_field.allow_none = field.allow_none
|
95
|
-
|
96
|
-
model_class.__fields__[name] = new_field
|
97
|
-
|
98
|
-
if name in origin.__validators__:
|
99
|
-
# The type: ignores here are because pydantic has a mistyping for these
|
100
|
-
# __validators__ fields (TODO: file an upstream PR)
|
101
|
-
validators: list = list(origin.__validators__[name]) # type: ignore
|
102
|
-
if name in model_class.__validators__:
|
103
|
-
validators.extend(model_class.__validators__[name]) # type: ignore
|
104
|
-
model_class.__validators__[name] = validators # type: ignore
|
105
|
-
|
106
|
-
return model_class
|
File without changes
|
File without changes
|
File without changes
|