prefect-client 2.20.9__py3-none-any.whl → 2.20.10__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/_internal/pydantic/v2_schema.py +26 -0
- prefect/_vendor/fastapi/py.typed +0 -0
- prefect/_vendor/starlette/py.typed +0 -0
- prefect/blocks/notifications.py +21 -0
- prefect/client/orchestration.py +16 -0
- prefect/flows.py +35 -8
- {prefect_client-2.20.9.dist-info → prefect_client-2.20.10.dist-info}/METADATA +2 -2
- {prefect_client-2.20.9.dist-info → prefect_client-2.20.10.dist-info}/RECORD +11 -9
- {prefect_client-2.20.9.dist-info → prefect_client-2.20.10.dist-info}/WHEEL +1 -1
- {prefect_client-2.20.9.dist-info → prefect_client-2.20.10.dist-info}/LICENSE +0 -0
- {prefect_client-2.20.9.dist-info → prefect_client-2.20.10.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,8 @@ import pydantic
|
|
9
9
|
from pydantic import BaseModel as V2BaseModel
|
10
10
|
from pydantic import ConfigDict, PydanticUndefinedAnnotation, create_model
|
11
11
|
from pydantic.type_adapter import TypeAdapter
|
12
|
+
from pydantic.v1 import BaseModel as V1BaseModel
|
13
|
+
from pydantic.v1 import SecretStr as V1SecretStr
|
12
14
|
|
13
15
|
from prefect._internal.pydantic.annotations.pendulum import (
|
14
16
|
PydanticPendulumDateTimeType,
|
@@ -30,6 +32,18 @@ def is_v2_model(v) -> bool:
|
|
30
32
|
return False
|
31
33
|
|
32
34
|
|
35
|
+
def is_v1_model(v) -> bool:
|
36
|
+
if isinstance(v, V1BaseModel):
|
37
|
+
return True
|
38
|
+
try:
|
39
|
+
if inspect.isclass(v) and issubclass(v, V1BaseModel):
|
40
|
+
return True
|
41
|
+
except TypeError:
|
42
|
+
pass
|
43
|
+
|
44
|
+
return False
|
45
|
+
|
46
|
+
|
33
47
|
def is_v2_type(v) -> bool:
|
34
48
|
if is_v2_model(v):
|
35
49
|
return True
|
@@ -40,6 +54,18 @@ def is_v2_type(v) -> bool:
|
|
40
54
|
return False
|
41
55
|
|
42
56
|
|
57
|
+
def is_v1_type(v) -> bool:
|
58
|
+
if is_v1_model(v):
|
59
|
+
return True
|
60
|
+
|
61
|
+
try:
|
62
|
+
return v.__module__.startswith("pydantic.v1.types") or isinstance(
|
63
|
+
v, V1SecretStr
|
64
|
+
)
|
65
|
+
except AttributeError:
|
66
|
+
return False
|
67
|
+
|
68
|
+
|
43
69
|
def has_v2_type_as_param(signature: inspect.Signature) -> bool:
|
44
70
|
parameters = signature.parameters.values()
|
45
71
|
for p in parameters:
|
File without changes
|
File without changes
|
prefect/blocks/notifications.py
CHANGED
@@ -281,6 +281,27 @@ class PagerDutyWebHook(AbstractAppriseNotificationBlock):
|
|
281
281
|
)
|
282
282
|
self._start_apprise_client(url)
|
283
283
|
|
284
|
+
@sync_compatible
|
285
|
+
async def notify(
|
286
|
+
self,
|
287
|
+
body: str,
|
288
|
+
subject: Optional[str] = None,
|
289
|
+
):
|
290
|
+
"""
|
291
|
+
Apprise will combine subject and body by default, so we need to move
|
292
|
+
the body into the custom_details field. custom_details is part of the
|
293
|
+
webhook url, so we need to update the url and restart the client.
|
294
|
+
"""
|
295
|
+
if subject:
|
296
|
+
self.custom_details = self.custom_details or {}
|
297
|
+
self.custom_details.update(
|
298
|
+
{"Prefect Notification Body": body.replace(" ", "%20")}
|
299
|
+
)
|
300
|
+
body = " "
|
301
|
+
self.block_initialization()
|
302
|
+
|
303
|
+
await super().notify(body, subject)
|
304
|
+
|
284
305
|
|
285
306
|
class TwilioSMS(AbstractAppriseNotificationBlock):
|
286
307
|
"""Enables sending notifications via Twilio SMS.
|
prefect/client/orchestration.py
CHANGED
@@ -8,12 +8,14 @@ from typing import (
|
|
8
8
|
Dict,
|
9
9
|
Iterable,
|
10
10
|
List,
|
11
|
+
Literal,
|
11
12
|
NoReturn,
|
12
13
|
Optional,
|
13
14
|
Set,
|
14
15
|
Tuple,
|
15
16
|
TypeVar,
|
16
17
|
Union,
|
18
|
+
overload,
|
17
19
|
)
|
18
20
|
from uuid import UUID, uuid4
|
19
21
|
|
@@ -178,6 +180,20 @@ class ServerType(AutoEnum):
|
|
178
180
|
return PREFECT_EXPERIMENTAL_EVENTS and PREFECT_API_SERVICES_TRIGGERS_ENABLED
|
179
181
|
|
180
182
|
|
183
|
+
@overload
|
184
|
+
def get_client(
|
185
|
+
httpx_settings: Optional[Dict[str, Any]] = None, sync_client: Literal[False] = False
|
186
|
+
) -> "PrefectClient":
|
187
|
+
...
|
188
|
+
|
189
|
+
|
190
|
+
@overload
|
191
|
+
def get_client(
|
192
|
+
httpx_settings: Optional[Dict[str, Any]] = None, sync_client: Literal[True] = True
|
193
|
+
) -> "SyncPrefectClient":
|
194
|
+
...
|
195
|
+
|
196
|
+
|
181
197
|
def get_client(
|
182
198
|
httpx_settings: Optional[Dict[str, Any]] = None, sync_client: bool = False
|
183
199
|
) -> Union["PrefectClient", "SyncPrefectClient"]:
|
prefect/flows.py
CHANGED
@@ -45,11 +45,15 @@ from prefect._internal.pydantic import HAS_PYDANTIC_V2
|
|
45
45
|
|
46
46
|
if HAS_PYDANTIC_V2:
|
47
47
|
import pydantic.v1 as pydantic
|
48
|
+
from pydantic import BaseModel as V2BaseModel
|
48
49
|
from pydantic import ValidationError as V2ValidationError
|
49
50
|
from pydantic.v1 import BaseModel as V1BaseModel
|
50
51
|
from pydantic.v1.decorator import ValidatedFunction as V1ValidatedFunction
|
51
52
|
|
52
|
-
from ._internal.pydantic.v2_schema import
|
53
|
+
from ._internal.pydantic.v2_schema import (
|
54
|
+
is_v1_type,
|
55
|
+
is_v2_type,
|
56
|
+
)
|
53
57
|
from ._internal.pydantic.v2_validated_func import V2ValidatedFunction
|
54
58
|
from ._internal.pydantic.v2_validated_func import (
|
55
59
|
V2ValidatedFunction as ValidatedFunction,
|
@@ -339,6 +343,16 @@ class Flow(Generic[P, R]):
|
|
339
343
|
# is not picklable in some environments
|
340
344
|
try:
|
341
345
|
ValidatedFunction(self.fn, config={"arbitrary_types_allowed": True})
|
346
|
+
except TypeError as exc:
|
347
|
+
if (
|
348
|
+
HAS_PYDANTIC_V2
|
349
|
+
and "`__modify_schema__` method is not supported" in str(exc)
|
350
|
+
):
|
351
|
+
V1ValidatedFunction(
|
352
|
+
self.fn, config={"arbitrary_types_allowed": True}
|
353
|
+
)
|
354
|
+
else:
|
355
|
+
raise
|
342
356
|
except pydantic.ConfigError as exc:
|
343
357
|
raise ValueError(
|
344
358
|
"Flow function is not compatible with `validate_parameters`. "
|
@@ -510,19 +524,33 @@ class Flow(Generic[P, R]):
|
|
510
524
|
args, kwargs = parameters_to_args_kwargs(self.fn, parameters)
|
511
525
|
|
512
526
|
if HAS_PYDANTIC_V2:
|
513
|
-
|
514
|
-
|
527
|
+
sig = inspect.signature(self.fn)
|
528
|
+
|
529
|
+
has_v1_types = any(
|
530
|
+
is_v1_type(param.annotation) for param in sig.parameters.values()
|
531
|
+
)
|
532
|
+
has_v1_models = any(
|
533
|
+
issubclass(param.annotation, V1BaseModel)
|
534
|
+
if isinstance(param.annotation, type)
|
535
|
+
else False
|
536
|
+
for param in sig.parameters.values()
|
515
537
|
)
|
516
|
-
has_v2_types = any(
|
517
|
-
is_v2_type(
|
538
|
+
has_v2_types = any(
|
539
|
+
is_v2_type(param.annotation) for param in sig.parameters.values()
|
540
|
+
)
|
541
|
+
has_v2_models = any(
|
542
|
+
issubclass(param.annotation, V2BaseModel)
|
543
|
+
if isinstance(param.annotation, type)
|
544
|
+
else False
|
545
|
+
for param in sig.parameters.values()
|
518
546
|
)
|
519
547
|
|
520
|
-
if has_v1_models and
|
548
|
+
if (has_v1_types and has_v2_types) or (has_v1_models and has_v2_models):
|
521
549
|
raise ParameterTypeError(
|
522
550
|
"Cannot mix Pydantic v1 and v2 types as arguments to a flow."
|
523
551
|
)
|
524
552
|
|
525
|
-
if has_v1_models:
|
553
|
+
if has_v1_models or has_v1_types:
|
526
554
|
validated_fn = V1ValidatedFunction(
|
527
555
|
self.fn, config={"arbitrary_types_allowed": True}
|
528
556
|
)
|
@@ -530,7 +558,6 @@ class Flow(Generic[P, R]):
|
|
530
558
|
validated_fn = V2ValidatedFunction(
|
531
559
|
self.fn, config={"arbitrary_types_allowed": True}
|
532
560
|
)
|
533
|
-
|
534
561
|
else:
|
535
562
|
validated_fn = ValidatedFunction(
|
536
563
|
self.fn, config={"arbitrary_types_allowed": True}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: prefect-client
|
3
|
-
Version: 2.20.
|
3
|
+
Version: 2.20.10
|
4
4
|
Summary: Workflow orchestration and management.
|
5
5
|
Home-page: https://www.prefect.io
|
6
6
|
Author: Prefect Technologies, Inc.
|
@@ -40,7 +40,7 @@ Requires-Dist: jsonschema<5.0.0,>=4.0.0
|
|
40
40
|
Requires-Dist: orjson<4.0,>=3.7
|
41
41
|
Requires-Dist: packaging<24.3,>=21.3
|
42
42
|
Requires-Dist: pathspec>=0.8.0
|
43
|
-
Requires-Dist: pydantic[email]!=2.0.0,!=2.0.1,!=2.1.0,<
|
43
|
+
Requires-Dist: pydantic[email]!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.10.0
|
44
44
|
Requires-Dist: pydantic-core<3.0.0,>=2.12.0
|
45
45
|
Requires-Dist: python-dateutil<3.0.0,>=2.8.2
|
46
46
|
Requires-Dist: python-slugify<9.0,>=5.0
|
@@ -9,7 +9,7 @@ prefect/engine.py,sha256=i68gM-ZZ2x9D4aIwaLmApWeHqpMb2U2QWNJjX3aPmZM,92887
|
|
9
9
|
prefect/exceptions.py,sha256=ElqC81_w6XbTaxLYANLMIPK8Fz46NmJZCRKL4NZ-JIg,10907
|
10
10
|
prefect/filesystems.py,sha256=XniPSdBAqywj43X7GyfuWJQIbz07QJ5Y3cVNLhIF3lQ,35260
|
11
11
|
prefect/flow_runs.py,sha256=mFHLavZk1yZ62H3UazuNDBZWAF7AqKttA4rMcHgsVSw,3119
|
12
|
-
prefect/flows.py,sha256=
|
12
|
+
prefect/flows.py,sha256=rJ2lfAFy3yff6ecKwFx9sDrjhOhdSGKQo7ocx7BasAs,85988
|
13
13
|
prefect/futures.py,sha256=RaWfYIXtH7RsWxQ5QWTTlAzwtVV8XWpXaZT_hLq35vQ,12590
|
14
14
|
prefect/manifests.py,sha256=sTM7j8Us5d49zaydYKWsKb7zJ96v1ChkLkLeR0GFYD8,683
|
15
15
|
prefect/new_flow_engine.py,sha256=A1adTWTBAwPCn6ay003Jsoc2SdYgHV4AcJo1bmpa_7Y,16039
|
@@ -50,7 +50,7 @@ prefect/_internal/pydantic/_flags.py,sha256=h1K50GKUJx09hvGHtfQ-rnBs233jhKr8DVtJ
|
|
50
50
|
prefect/_internal/pydantic/_types.py,sha256=A1WD9OHyGoIp0gujl3ozCoXEd4OcySgjgbmHsMq9RTs,275
|
51
51
|
prefect/_internal/pydantic/schemas.py,sha256=tsRKq5yEIgiRbWMl3BPnbfNaKyDN6pq8WSs0M8SQMm4,452
|
52
52
|
prefect/_internal/pydantic/v1_schema.py,sha256=j_DDQqpP1xFsvkNSjWeviTnnFyNPPqou9n4M2lf3K2U,1133
|
53
|
-
prefect/_internal/pydantic/v2_schema.py,sha256=
|
53
|
+
prefect/_internal/pydantic/v2_schema.py,sha256=iOIy7zgDt__uPfp03RVDvrwRMbZzHF6yWmgnjlPXEAc,4262
|
54
54
|
prefect/_internal/pydantic/v2_validated_func.py,sha256=44I4o8jjiS7TYep-E6UYMwjpYH5F1WwJFajW81A3wts,3823
|
55
55
|
prefect/_internal/pydantic/annotations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
prefect/_internal/pydantic/annotations/pendulum.py,sha256=rWT6zzCtIqvK2_EuAkMt73ZzAvdE5tF2104e0-tIaa4,2625
|
@@ -86,6 +86,7 @@ prefect/_vendor/fastapi/exceptions.py,sha256=131GbKBhoKJNvkE3k2-IvKye6xH-fvNaJ20
|
|
86
86
|
prefect/_vendor/fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54
|
87
87
|
prefect/_vendor/fastapi/param_functions.py,sha256=BLvSfhJqiViP-_zYQ7BL_t9IARf4EJbKZSikDNsOkfw,9130
|
88
88
|
prefect/_vendor/fastapi/params.py,sha256=UBEVQ_EK9iIbF3DOJXfH2zcO27uvf5NeRdslMOEtIEA,13350
|
89
|
+
prefect/_vendor/fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
90
|
prefect/_vendor/fastapi/requests.py,sha256=KsGwp86w95S-0wgx4pL-T4i9M_z-_KlMzX43rdUg9YU,183
|
90
91
|
prefect/_vendor/fastapi/responses.py,sha256=M67RzoU0K91ojgHjvDIDK3iyBAvA9YKPsUJIP4FtxtY,1381
|
91
92
|
prefect/_vendor/fastapi/routing.py,sha256=Kz1WttDcSqHkt1fW9_UmkZG-G0noRY3FAStkfw_VUNE,57083
|
@@ -131,6 +132,7 @@ prefect/_vendor/starlette/datastructures.py,sha256=AyApp3jfD9muXBn8EVbuAVk6ZhCDY
|
|
131
132
|
prefect/_vendor/starlette/endpoints.py,sha256=00KnI8grT2xxv1jERCvAgqwVxRDOo8hrqpFHnKow9xs,5319
|
132
133
|
prefect/_vendor/starlette/exceptions.py,sha256=ODmYfjgNKWAZwfV8TDVepoEwhv1Kl92KvvwMvEJ04AA,1840
|
133
134
|
prefect/_vendor/starlette/formparsers.py,sha256=aNoQl0CPI7pYnvae2k0KB2jNnv6mQJL-N2FuhRhPLW4,10450
|
135
|
+
prefect/_vendor/starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
136
|
prefect/_vendor/starlette/requests.py,sha256=dytpLA1l9oVb-u98i4caDI1z4-XtPCe1jzjFajlQWa8,10899
|
135
137
|
prefect/_vendor/starlette/responses.py,sha256=1l36hyZeTXWYCQ8dYCo-eM_I6KyGuq_qUdtM9GBT3EA,12565
|
136
138
|
prefect/_vendor/starlette/routing.py,sha256=Y0uiRXBQ0uRWs1O63qFD6doqKeh-KhqhuiHU5ovodQs,35696
|
@@ -157,7 +159,7 @@ prefect/blocks/abstract.py,sha256=AiAs0MC5JKCf0Xg0yofC5Qu2TZ52AjDMP1ntMGuP2dY,16
|
|
157
159
|
prefect/blocks/core.py,sha256=_NKdrHvN2f0LdgqX9MYXp0PJQW36e6cs2Za7hVfrCIw,43870
|
158
160
|
prefect/blocks/fields.py,sha256=ANOzbNyDCBIvm6ktgbLTMs7JW2Sf6CruyATjAW61ks0,1607
|
159
161
|
prefect/blocks/kubernetes.py,sha256=IN-hZkzIRvqjd_dzPZby3q8p7m2oUWqArBq24BU9cDg,4071
|
160
|
-
prefect/blocks/notifications.py,sha256=
|
162
|
+
prefect/blocks/notifications.py,sha256=vdGxLBh1VNicoI8G2bZk0X55mQB1DqVuej7xiCec8pM,28822
|
161
163
|
prefect/blocks/system.py,sha256=aIRiFKlXIQ1sMaqniMXYolFsx2IVN3taBMH3KCThB2I,3089
|
162
164
|
prefect/blocks/webhook.py,sha256=VzQ-qcRtW8MMuYEGYwFgt1QXtWedUtVmeTo7iE2UQ78,2008
|
163
165
|
prefect/client/__init__.py,sha256=yJ5FRF9RxNUio2V_HmyKCKw5G6CZO0h8cv6xA_Hkpcc,477
|
@@ -165,7 +167,7 @@ prefect/client/base.py,sha256=YSPeE7hV0NCuD6WzoAACDYGFK4Yq35d26pITZ3elNyY,24669
|
|
165
167
|
prefect/client/cloud.py,sha256=E54OAFr7bY5IXhhMBdjGwLQiR0eU-WWFoEEiOq2l53I,4104
|
166
168
|
prefect/client/collections.py,sha256=I9EgbTg4Fn57gn8vwP_WdDmgnATbx9gfkm2jjhCORjw,1037
|
167
169
|
prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
|
168
|
-
prefect/client/orchestration.py,sha256=
|
170
|
+
prefect/client/orchestration.py,sha256=0lJx6nRKyboYFf_wVdRBVXaH5nFAdFOlWJZV0AXgYYg,140503
|
169
171
|
prefect/client/subscriptions.py,sha256=3kqPH3F-CwyrR5wygCpJMjRjM_gcQjd54Qjih6FcLlA,3372
|
170
172
|
prefect/client/utilities.py,sha256=7V4IkfC8x_OZuPXGvtIMmwZCOW63hSY8iVQkuRYTR6g,3079
|
171
173
|
prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
|
@@ -286,8 +288,8 @@ prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
|
|
286
288
|
prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
|
287
289
|
prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
|
288
290
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
289
|
-
prefect_client-2.20.
|
290
|
-
prefect_client-2.20.
|
291
|
-
prefect_client-2.20.
|
292
|
-
prefect_client-2.20.
|
293
|
-
prefect_client-2.20.
|
291
|
+
prefect_client-2.20.10.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
292
|
+
prefect_client-2.20.10.dist-info/METADATA,sha256=AWEDtW-Rm_YudnjrVA3gBSllWBa0d_EVfiMwpcVDodI,7392
|
293
|
+
prefect_client-2.20.10.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
294
|
+
prefect_client-2.20.10.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
|
295
|
+
prefect_client-2.20.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|