prefect-client 2.20.14__py3-none-any.whl → 2.20.16__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.
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import datetime
3
+ import ssl
3
4
  import warnings
4
5
  from contextlib import AsyncExitStack
5
6
  from typing import (
@@ -275,12 +276,18 @@ class PrefectClient:
275
276
  httpx_settings.setdefault("headers", {})
276
277
 
277
278
  if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
278
- httpx_settings.setdefault("verify", False)
279
+ # Create an unverified context for insecure connections
280
+ ctx = ssl.create_default_context()
281
+ ctx.check_hostname = False
282
+ ctx.verify_mode = ssl.CERT_NONE
283
+ httpx_settings.setdefault("verify", ctx)
279
284
  else:
280
285
  cert_file = PREFECT_API_SSL_CERT_FILE.value()
281
286
  if not cert_file:
282
287
  cert_file = certifi.where()
283
- httpx_settings.setdefault("verify", cert_file)
288
+ # Create a verified context with the certificate file
289
+ ctx = ssl.create_default_context(cafile=cert_file)
290
+ httpx_settings.setdefault("verify", ctx)
284
291
 
285
292
  if api_version is None:
286
293
  api_version = SERVER_API_VERSION
@@ -492,6 +499,23 @@ class PrefectClient:
492
499
  response = await self._client.get(f"/flows/{flow_id}")
493
500
  return Flow.parse_obj(response.json())
494
501
 
502
+ async def delete_flow(self, flow_id: UUID) -> None:
503
+ """
504
+ Delete a flow by UUID.
505
+ Args:
506
+ flow_id: ID of the flow to be deleted
507
+ Raises:
508
+ prefect.exceptions.ObjectNotFound: If request returns 404
509
+ httpx.RequestError: If requests fails
510
+ """
511
+ try:
512
+ await self._client.delete(f"/flows/{flow_id}")
513
+ except httpx.HTTPStatusError as e:
514
+ if e.response.status_code == status.HTTP_404_NOT_FOUND:
515
+ raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
516
+ else:
517
+ raise
518
+
495
519
  async def read_flows(
496
520
  self,
497
521
  *,
@@ -3438,11 +3462,19 @@ class SyncPrefectClient:
3438
3462
 
3439
3463
  if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
3440
3464
  httpx_settings.setdefault("verify", False)
3465
+ # Create an unverified context for insecure connections
3466
+ ctx = ssl.create_default_context()
3467
+ ctx.check_hostname = False
3468
+ ctx.verify_mode = ssl.CERT_NONE
3469
+ httpx_settings.setdefault("verify", ctx)
3441
3470
  else:
3442
3471
  cert_file = PREFECT_API_SSL_CERT_FILE.value()
3443
3472
  if not cert_file:
3444
3473
  cert_file = certifi.where()
3445
3474
  httpx_settings.setdefault("verify", cert_file)
3475
+ # Create a verified context with the certificate file
3476
+ ctx = ssl.create_default_context(cafile=cert_file)
3477
+ httpx_settings.setdefault("verify", ctx)
3446
3478
 
3447
3479
  if api_version is None:
3448
3480
  api_version = SERVER_API_VERSION
@@ -410,6 +410,9 @@ class FlowRunPolicy(PrefectBaseModel):
410
410
  resuming: Optional[bool] = Field(
411
411
  default=False, description="Indicates if this run is resuming from a pause."
412
412
  )
413
+ retry_type: Optional[Literal["in_process", "reschedule"]] = Field(
414
+ default=None, description="The type of retry this run is undergoing."
415
+ )
413
416
 
414
417
  @root_validator
415
418
  def populate_deprecated_fields(cls, values):
prefect/flows.py CHANGED
@@ -10,6 +10,7 @@ import datetime
10
10
  import importlib.util
11
11
  import inspect
12
12
  import os
13
+ import sys
13
14
  import tempfile
14
15
  import warnings
15
16
  from functools import partial, update_wrapper
@@ -137,6 +138,16 @@ logger = get_logger("flows")
137
138
  if TYPE_CHECKING:
138
139
  from prefect.deployments.runner import FlexibleScheduleList, RunnerDeployment
139
140
 
141
+ # Handle Python 3.8 compatibility for GenericAlias
142
+ if sys.version_info >= (3, 9):
143
+ from types import GenericAlias # novermin
144
+
145
+ GENERIC_ALIAS = (GenericAlias,)
146
+ else:
147
+ from typing import _GenericAlias
148
+
149
+ GENERIC_ALIAS = (_GenericAlias,)
150
+
140
151
 
141
152
  @PrefectObjectRegistry.register_instances
142
153
  class Flow(Generic[P, R]):
@@ -530,18 +541,22 @@ class Flow(Generic[P, R]):
530
541
  is_v1_type(param.annotation) for param in sig.parameters.values()
531
542
  )
532
543
  has_v1_models = any(
533
- issubclass(param.annotation, V1BaseModel)
534
- if isinstance(param.annotation, type)
535
- else False
544
+ (
545
+ isinstance(param.annotation, type)
546
+ and not isinstance(param.annotation, GENERIC_ALIAS)
547
+ and issubclass(param.annotation, V1BaseModel)
548
+ )
536
549
  for param in sig.parameters.values()
537
550
  )
538
551
  has_v2_types = any(
539
552
  is_v2_type(param.annotation) for param in sig.parameters.values()
540
553
  )
541
554
  has_v2_models = any(
542
- issubclass(param.annotation, V2BaseModel)
543
- if isinstance(param.annotation, type)
544
- else False
555
+ (
556
+ isinstance(param.annotation, type)
557
+ and not isinstance(param.annotation, GENERIC_ALIAS)
558
+ and issubclass(param.annotation, V2BaseModel)
559
+ )
545
560
  for param in sig.parameters.values()
546
561
  )
547
562
 
@@ -1601,7 +1616,9 @@ flow.from_source = Flow.from_source
1601
1616
 
1602
1617
 
1603
1618
  def select_flow(
1604
- flows: Iterable[Flow], flow_name: str = None, from_message: str = None
1619
+ flows: Iterable[Flow],
1620
+ flow_name: Optional[str] = None,
1621
+ from_message: Optional[str] = None,
1605
1622
  ) -> Flow:
1606
1623
  """
1607
1624
  Select the only flow in an iterable or a flow specified by name.
prefect/tasks.py CHANGED
@@ -342,6 +342,10 @@ class Task(Generic[P, R]):
342
342
 
343
343
  if callable(retry_delay_seconds):
344
344
  self.retry_delay_seconds = retry_delay_seconds(retries)
345
+ elif not isinstance(retry_delay_seconds, (list, int, float, type(None))):
346
+ raise TypeError(
347
+ f"Invalid `retry_delay_seconds` provided; must be an int, float, list or callable. Received type {type(retry_delay_seconds)}"
348
+ )
345
349
  else:
346
350
  self.retry_delay_seconds = retry_delay_seconds
347
351
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 2.20.14
3
+ Version: 2.20.16
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -34,15 +34,18 @@ Requires-Dist: graphviz>=0.20.1
34
34
  Requires-Dist: griffe<2.0.0,>=0.49.0
35
35
  Requires-Dist: httpcore<2.0.0,>=1.0.5
36
36
  Requires-Dist: httpx[http2]!=0.23.2,>=0.23
37
+ Requires-Dist: importlib_metadata>=4.4; python_version < "3.10"
37
38
  Requires-Dist: importlib-resources<6.5.0,>=6.1.3
38
39
  Requires-Dist: jsonpatch<2.0,>=1.32
39
40
  Requires-Dist: jsonschema<5.0.0,>=4.0.0
40
41
  Requires-Dist: orjson<4.0,>=3.7
41
42
  Requires-Dist: packaging<24.3,>=21.3
42
43
  Requires-Dist: pathspec>=0.8.0
44
+ Requires-Dist: pendulum<3.0; python_version < "3.12"
45
+ Requires-Dist: pendulum<4,>=3.0.0; python_version >= "3.12"
43
46
  Requires-Dist: pydantic[email]!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.10.0
44
- Requires-Dist: pydantic-core<3.0.0,>=2.12.0
45
- Requires-Dist: python-dateutil<3.0.0,>=2.8.2
47
+ Requires-Dist: pydantic_core<3.0.0,>=2.12.0
48
+ Requires-Dist: python_dateutil<3.0.0,>=2.8.2
46
49
  Requires-Dist: python-slugify<9.0,>=5.0
47
50
  Requires-Dist: pyyaml<7.0.0,>=5.4.1
48
51
  Requires-Dist: rfc3339-validator<0.2.0,>=0.1.4
@@ -50,15 +53,12 @@ Requires-Dist: rich<14.0,>=11.0
50
53
  Requires-Dist: ruamel.yaml>=0.17.0
51
54
  Requires-Dist: sniffio<2.0.0,>=1.3.0
52
55
  Requires-Dist: toml>=0.10.0
53
- Requires-Dist: typing-extensions<5.0.0,>=4.5.0
56
+ Requires-Dist: typing_extensions<5.0.0,>=4.5.0
54
57
  Requires-Dist: ujson<6.0.0,>=5.8.0
55
58
  Requires-Dist: uvicorn!=0.29.0,>=0.14.0
56
59
  Requires-Dist: websockets<14.0,>=10.4
57
60
  Requires-Dist: itsdangerous
58
61
  Requires-Dist: python-multipart>=0.0.7
59
- Requires-Dist: importlib-metadata>=4.4; python_version < "3.10"
60
- Requires-Dist: pendulum<3.0; python_version < "3.12"
61
- Requires-Dist: pendulum<4,>=3.0.0; python_version >= "3.12"
62
62
  Provides-Extra: notifications
63
63
  Requires-Dist: apprise<2.0.0,>=1.1.0; extra == "notifications"
64
64
 
@@ -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=rJ2lfAFy3yff6ecKwFx9sDrjhOhdSGKQo7ocx7BasAs,85988
12
+ prefect/flows.py,sha256=M5aP6QVpnFfIHFFcNOwBST1XcDY-vVFVBuI3DcvNPEY,86456
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
@@ -24,7 +24,7 @@ prefect/states.py,sha256=B38zIXnqc8cmw3GPxmMQ4thX6pXb6UtG4PoTZ5thGQs,21036
24
24
  prefect/task_engine.py,sha256=_2I7XLwoT_nNhpzTMa_52aQKjsDoaW6WpzwIHYEWZS0,2598
25
25
  prefect/task_runners.py,sha256=HXUg5UqhZRN2QNBqMdGE1lKhwFhT8TaRN75ScgLbnw8,11012
26
26
  prefect/task_server.py,sha256=-wHuAlY8DLEQuJcEvcFfB4da0Xdnmqk6D7GjHShh-Ik,11668
27
- prefect/tasks.py,sha256=PO4i5Dl69t6qnlVnXD4vnCvuZI07SNiyGOrXPkw8gR4,56439
27
+ prefect/tasks.py,sha256=6a_w3RWcTGmW3iZMzH-gFhvWLBp0-aw3j0ktnFZKCwc,56706
28
28
  prefect/variables.py,sha256=woS7idyYxCJ4BJ6AVitcfb_Db7CReFg7KLqW5hc685w,4014
29
29
  prefect/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  prefect/_internal/_logging.py,sha256=HvNHY-8P469o5u4LYEDBTem69XZEt1QUeUaLToijpak,810
@@ -167,13 +167,13 @@ prefect/client/base.py,sha256=YSPeE7hV0NCuD6WzoAACDYGFK4Yq35d26pITZ3elNyY,24669
167
167
  prefect/client/cloud.py,sha256=E54OAFr7bY5IXhhMBdjGwLQiR0eU-WWFoEEiOq2l53I,4104
168
168
  prefect/client/collections.py,sha256=I9EgbTg4Fn57gn8vwP_WdDmgnATbx9gfkm2jjhCORjw,1037
169
169
  prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
170
- prefect/client/orchestration.py,sha256=0lJx6nRKyboYFf_wVdRBVXaH5nFAdFOlWJZV0AXgYYg,140503
170
+ prefect/client/orchestration.py,sha256=rGIIJe1c9HhJSOj7ZdROz8Mnoj9qnDBuwzYjxygEqtk,141876
171
171
  prefect/client/subscriptions.py,sha256=3kqPH3F-CwyrR5wygCpJMjRjM_gcQjd54Qjih6FcLlA,3372
172
172
  prefect/client/utilities.py,sha256=7V4IkfC8x_OZuPXGvtIMmwZCOW63hSY8iVQkuRYTR6g,3079
173
173
  prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
174
174
  prefect/client/schemas/actions.py,sha256=4mq1OXMsXs6aGlXg1G232RNcn0ivAOIgikL0IKs6S-E,27943
175
175
  prefect/client/schemas/filters.py,sha256=gv57m0bHJqL7Ifsc_vAdRODFomaMVcrGXKAahOSBU4w,35598
176
- prefect/client/schemas/objects.py,sha256=bA0kAN9fbeiE6yUGX6bRlScheYtg8uxu0eeuC3-3zd8,53309
176
+ prefect/client/schemas/objects.py,sha256=V3UQCXpgh2xgxIN6wjzXbm-tSCjB9cOIH8yei9sDT4E,53464
177
177
  prefect/client/schemas/responses.py,sha256=XAc95g3PRL9UIkH9_VMuv0ECHKdc19guBLmdt5KefkI,15325
178
178
  prefect/client/schemas/schedules.py,sha256=ZF7fFbkcc8rVdx2MxE8DR0av3FUE9qDPjLreEuV8HfM,12193
179
179
  prefect/client/schemas/sorting.py,sha256=EIQ6FUjUWMwk6fn6ckVLQLXOP-GI5kce7ftjUkDFWV0,2490
@@ -289,8 +289,8 @@ prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
289
289
  prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
290
290
  prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
291
291
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
292
- prefect_client-2.20.14.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
293
- prefect_client-2.20.14.dist-info/METADATA,sha256=IDlfkSwJOh6aIVcnAyvOh218vkL12A7cCpm0VQz0DQ4,7392
294
- prefect_client-2.20.14.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
295
- prefect_client-2.20.14.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
296
- prefect_client-2.20.14.dist-info/RECORD,,
292
+ prefect_client-2.20.16.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
293
+ prefect_client-2.20.16.dist-info/METADATA,sha256=YEumdbpwNB9VuTz0z6G43vx6LXaOCqctKgTGcAEwWqA,7392
294
+ prefect_client-2.20.16.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
295
+ prefect_client-2.20.16.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
296
+ prefect_client-2.20.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5