prefect-client 3.2.11__py3-none-any.whl → 3.2.12__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/_build_info.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by versioningit
2
- __version__ = "3.2.11"
3
- __build_date__ = "2025-03-05 21:59:47.932907+00:00"
4
- __git_commit__ = "9481694f9d12e27ab26ae33d3cc5d1306d78693a"
2
+ __version__ = "3.2.12"
3
+ __build_date__ = "2025-03-10 16:35:36.997425+00:00"
4
+ __git_commit__ = "826eb1a7423831a2eeb6541909ef35ecca17fde7"
5
5
  __dirty__ = False
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from copy import deepcopy
2
4
  from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, Union
3
5
  from uuid import UUID, uuid4
@@ -47,6 +47,7 @@ from pydantic import (
47
47
  from rich.console import Console
48
48
  from rich.progress import Progress, SpinnerColumn, TextColumn, track
49
49
  from rich.table import Table
50
+ from typing_extensions import Self
50
51
 
51
52
  from prefect._experimental.sla.objects import SlaTypes
52
53
  from prefect._internal.compatibility.async_dispatch import async_dispatch
@@ -84,6 +85,7 @@ from prefect.settings import (
84
85
  )
85
86
  from prefect.types import ListOfNonEmptyStrings
86
87
  from prefect.types.entrypoint import EntrypointType
88
+ from prefect.utilities.annotations import freeze
87
89
  from prefect.utilities.asyncutils import run_coro_as_sync, sync_compatible
88
90
  from prefect.utilities.callables import ParameterSchema, parameter_schema
89
91
  from prefect.utilities.collections import get_from_dict, isiterable
@@ -135,7 +137,9 @@ class RunnerDeployment(BaseModel):
135
137
  _sla: (Experimental) SLA configuration for the deployment. May be removed or modified at any time. Currently only supported on Prefect Cloud.
136
138
  """
137
139
 
138
- model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True)
140
+ model_config: ClassVar[ConfigDict] = ConfigDict(
141
+ arbitrary_types_allowed=True, validate_assignment=True
142
+ )
139
143
 
140
144
  name: str = Field(..., description="The name of the deployment.")
141
145
  flow_name: Optional[str] = Field(
@@ -250,14 +254,30 @@ class RunnerDeployment(BaseModel):
250
254
  trigger.name = f"{self.name}__automation_{i}"
251
255
  return self
252
256
 
257
+ @model_validator(mode="after")
258
+ def validate_deployment_parameters(self) -> Self:
259
+ """Update the parameter schema to mark frozen parameters as readonly."""
260
+ if not self.parameters:
261
+ return self
262
+
263
+ for key, value in self.parameters.items():
264
+ if isinstance(value, freeze):
265
+ raw_value = value.unfreeze()
266
+ if key in self._parameter_openapi_schema.properties:
267
+ self._parameter_openapi_schema.properties[key]["readOnly"] = True
268
+ self._parameter_openapi_schema.properties[key]["enum"] = [raw_value]
269
+ self.parameters[key] = raw_value
270
+
271
+ return self
272
+
253
273
  @model_validator(mode="before")
254
274
  @classmethod
255
- def reconcile_paused(cls, values):
275
+ def reconcile_paused(cls, values: dict[str, Any]) -> dict[str, Any]:
256
276
  return reconcile_paused_deployment(values)
257
277
 
258
278
  @model_validator(mode="before")
259
279
  @classmethod
260
- def reconcile_schedules(cls, values):
280
+ def reconcile_schedules(cls, values: dict[str, Any]) -> dict[str, Any]:
261
281
  return reconcile_schedules_runner(values)
262
282
 
263
283
  async def _create(
@@ -367,7 +387,8 @@ class RunnerDeployment(BaseModel):
367
387
  await client.update_deployment(
368
388
  deployment_id,
369
389
  deployment=DeploymentUpdate(
370
- **update_payload, parameter_openapi_schema=parameter_openapi_schema
390
+ **update_payload,
391
+ parameter_openapi_schema=parameter_openapi_schema,
371
392
  ),
372
393
  )
373
394
 
prefect/flows.py CHANGED
@@ -1490,10 +1490,10 @@ class Flow(Generic[P, R]):
1490
1490
  _sla=_sla,
1491
1491
  )
1492
1492
 
1493
- if TYPE_CHECKING:
1494
- assert inspect.isawaitable(to_deployment_coro)
1495
-
1496
- deployment = await to_deployment_coro
1493
+ if inspect.isawaitable(to_deployment_coro):
1494
+ deployment = await to_deployment_coro
1495
+ else:
1496
+ deployment = to_deployment_coro
1497
1497
 
1498
1498
  from prefect.deployments.runner import deploy
1499
1499
 
@@ -313,7 +313,7 @@ async def read_flow_run(
313
313
  )
314
314
 
315
315
 
316
- @router.get("/{id}/graph")
316
+ @router.get("/{id}/graph", tags=["Flow Run Graph"])
317
317
  async def read_flow_run_graph_v1(
318
318
  flow_run_id: UUID = Path(..., description="The flow run id", alias="id"),
319
319
  db: PrefectDBInterface = Depends(provide_database_interface),
@@ -327,7 +327,7 @@ async def read_flow_run_graph_v1(
327
327
  )
328
328
 
329
329
 
330
- @router.get("/{id:uuid}/graph-v2")
330
+ @router.get("/{id:uuid}/graph-v2", tags=["Flow Run Graph"])
331
331
  async def read_flow_run_graph_v2(
332
332
  flow_run_id: UUID = Path(..., description="The flow run id", alias="id"),
333
333
  since: DateTime = Query(
@@ -2,6 +2,8 @@ import warnings
2
2
  from operator import itemgetter
3
3
  from typing import Any, cast
4
4
 
5
+ from pydantic import GetCoreSchemaHandler
6
+ from pydantic_core import core_schema, to_json
5
7
  from typing_extensions import Self, TypeVar
6
8
 
7
9
  T = TypeVar("T", infer_variance=True)
@@ -108,3 +110,44 @@ class NotSet:
108
110
  """
109
111
  Singleton to distinguish `None` from a value that is not provided by the user.
110
112
  """
113
+
114
+
115
+ class freeze(BaseAnnotation[T]):
116
+ """
117
+ Wrapper for parameters in deployments.
118
+
119
+ Indicates that this parameter should be frozen in the UI and not editable
120
+ when creating flow runs from this deployment.
121
+
122
+ Example:
123
+ ```python
124
+ @flow
125
+ def my_flow(customer_id: str):
126
+ # flow logic
127
+
128
+ deployment = my_flow.deploy(parameters={"customer_id": freeze("customer123")})
129
+ ```
130
+ """
131
+
132
+ def __new__(cls, value: T) -> Self:
133
+ try:
134
+ to_json(value)
135
+ except Exception:
136
+ raise ValueError("Value must be JSON serializable")
137
+ return super().__new__(cls, value)
138
+
139
+ def unfreeze(self) -> T:
140
+ """Return the unwrapped value."""
141
+ return self.unwrap()
142
+
143
+ @classmethod
144
+ def __get_pydantic_core_schema__(
145
+ cls, source: type[Any], handler: GetCoreSchemaHandler
146
+ ) -> core_schema.CoreSchema:
147
+ return core_schema.no_info_after_validator_function(
148
+ cls, # Use the class itself as the validator
149
+ core_schema.any_schema(),
150
+ serialization=core_schema.plain_serializer_function_ser_schema(
151
+ lambda x: x.unfreeze() # Serialize by unwrapping the value
152
+ ),
153
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.2.11
3
+ Version: 3.2.12
4
4
  Summary: Workflow orchestration and management.
5
5
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/releases
6
6
  Project-URL: Documentation, https://docs.prefect.io
@@ -1,7 +1,7 @@
1
1
  prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
2
2
  prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
3
3
  prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
4
- prefect/_build_info.py,sha256=krjDF1sM5RvgWqu2jF5l7Q1YZipQCljyDQh7ziJjhB0,181
4
+ prefect/_build_info.py,sha256=0jvzxnFcIJ0SfWt4cMwAzZNs6tBDVGSkVmAMrLX_sZI,181
5
5
  prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
6
6
  prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
7
7
  prefect/agent.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
@@ -14,7 +14,7 @@ prefect/exceptions.py,sha256=-nih8qqdxRm6CX-4yrqwePVh8Mcpvla_V6N_KbdJsIU,11593
14
14
  prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
15
15
  prefect/flow_engine.py,sha256=gR44YU7aCAbHEqoMDdxL1SDrtS5Xx1Kzg3M7FWjHcvY,58967
16
16
  prefect/flow_runs.py,sha256=ocbV3ioSBIFoLqExpI2YLteyHdWpHB3t0lrbfl-Ni1E,17256
17
- prefect/flows.py,sha256=g7OVVer6m8nPtrR0MllWpa8_Iezh2G1maxvz8ZeNgbo,109029
17
+ prefect/flows.py,sha256=jDGOG_rOk5SgVZ9HM4HDi9T9Cmka5uooY8UkueK9SBo,109057
18
18
  prefect/futures.py,sha256=ADd8ceFqX7A8Kw8aXaqvbYRG03uU82OEY30xrP5vrwY,23599
19
19
  prefect/main.py,sha256=hFeTTrr01qWKcRwZVEHVipyHEybS0VLTscFV6zG6GtY,2306
20
20
  prefect/plugins.py,sha256=FPRLR2mWVBMuOnlzeiTD9krlHONZH2rtYLD753JQDNQ,2516
@@ -112,7 +112,7 @@ prefect/client/orchestration/_variables/client.py,sha256=wKBbZBLGgs5feDCil-xxKt3
112
112
  prefect/client/orchestration/_work_pools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  prefect/client/orchestration/_work_pools/client.py,sha256=s1DfUQQBgB2sLiVVPhLNTlkueUDE6uFsh4mAzcSA1OE,19881
114
114
  prefect/client/schemas/__init__.py,sha256=InZcDzdeWA2oaV0TlyvoMcyLcbi_aaqU1U9D6Gx-eoU,2747
115
- prefect/client/schemas/actions.py,sha256=yzP6oC0_h6LV78s47ltX1bqxu6bju0Eav5VgB-VRaR8,32398
115
+ prefect/client/schemas/actions.py,sha256=8eXJkC5YtJ7QZnVsuwrB3V8I-cfBlD6EtfJgIHfXPu4,32434
116
116
  prefect/client/schemas/filters.py,sha256=zaiDkalrIpKjd38V4aP1GHlqD24KTPCZiKtPyX69ZWE,36607
117
117
  prefect/client/schemas/objects.py,sha256=ZHLu4ycTYee7Y1LqM2MZgYszQClnpMuMTXIrYewu4zQ,57034
118
118
  prefect/client/schemas/responses.py,sha256=iTXTiUhdRL7PxNyJXMZ4ngT7C8SepT_z7g_pnUnVlzo,15629
@@ -138,7 +138,7 @@ prefect/deployments/__init__.py,sha256=_wb7NxDKhq11z9MjYsPckmT3o6MRhGLRgCV9TmvYt
138
138
  prefect/deployments/base.py,sha256=KEc07W35yyzGJcV6GIZry8bKcNfvQk6JjJ99KKB6XpQ,11729
139
139
  prefect/deployments/deployments.py,sha256=K3Rgnpjxo_T8I8LMwlq24OKqZiZBTE8-YnPg-YGUStM,171
140
140
  prefect/deployments/flow_runs.py,sha256=NYe-Bphsy6ENLqSSfywQuX5cRZt-uVgzqGmOsf3Sqw4,7643
141
- prefect/deployments/runner.py,sha256=FUmBuuF5X8o2wGf8aIdqjijDJy3FWuNYPpwaKhrVaHs,54052
141
+ prefect/deployments/runner.py,sha256=6ORxmCIDPjjhr-CDEu1-Sstvyqk-UoBt-vTI7eAn63w,54945
142
142
  prefect/deployments/schedules.py,sha256=2eL1-w8qXtwKVkgfUK7cuamwpKK3X6tN1QYTDa_gWxU,2190
143
143
  prefect/deployments/steps/__init__.py,sha256=Dlz9VqMRyG1Gal8dj8vfGpPr0LyQhZdvcciozkK8WoY,206
144
144
  prefect/deployments/steps/core.py,sha256=ulSgBFSx1lhBt1fP-UxebrernkumBDlympR6IPffV1g,6900
@@ -211,7 +211,7 @@ prefect/server/api/deployments.py,sha256=2C7pCY2renhyPDfi_IuzWoEhH620ERWLmQSTAnx
211
211
  prefect/server/api/events.py,sha256=3-Qdt6ORxFv3nLoogQqvd72zEulJSoAmcqZto2OULuk,9907
212
212
  prefect/server/api/flow_run_notification_policies.py,sha256=F8xNm6bgZTC3nFe9xCUJS4NlU9tLXZ8fShtJqmhT2m4,4828
213
213
  prefect/server/api/flow_run_states.py,sha256=lIdxVE9CqLgtDCuH9bTaKkzHNL81FPrr11liPzvONrw,1661
214
- prefect/server/api/flow_runs.py,sha256=KYmXhAZHmoSClwyG6aKc6n0PmrXba13YC7xpBK6ZkXw,32622
214
+ prefect/server/api/flow_runs.py,sha256=M3VFUGaxGaHOaC1hjU8kY6voWuTW_-cIOlVzChpePRk,32672
215
215
  prefect/server/api/flows.py,sha256=Bz0ISh-9oY0W1X3mqA631_8678pQ6tuRGMpSgWAfxOc,7018
216
216
  prefect/server/api/logs.py,sha256=0z78tM2B5sRgJWYRWJn5lHhRoLtZB_OU3C-uALV8tOs,1571
217
217
  prefect/server/api/middleware.py,sha256=WkyuyeJIfo9Q0GAIVU5gO6yIGNVwoHwuBah5AB5oUyw,2733
@@ -283,7 +283,7 @@ prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
283
283
  prefect/utilities/_deprecated.py,sha256=b3pqRSoFANdVJAc8TJkygBcP-VjZtLJUxVIWC7kwspI,1303
284
284
  prefect/utilities/_engine.py,sha256=9GW4X1lyAbmPwCuXXIubVJ7Z0DMT3dykkEUtp9tm5hI,3356
285
285
  prefect/utilities/_git.py,sha256=bPYWQdr9xvH0BqxR1ll1RkaSb3x0vhwylhYD5EilkKU,863
286
- prefect/utilities/annotations.py,sha256=UbQSy60iz8oKHuDnoCDs9kzN3k92fov7g5Ie1rzcZSU,3098
286
+ prefect/utilities/annotations.py,sha256=0Elqgq6LR7pQqezNqT5wb6U_0e2pDO_zx6VseVL6kL8,4396
287
287
  prefect/utilities/asyncutils.py,sha256=xcfeNym2j3WH4gKXznON2hI1PpUTcwr_BGc16IQS3C4,19789
288
288
  prefect/utilities/callables.py,sha256=pQ60sVaQ8jMhVHj3t9mQ_NunTLFb2jK9-34gsb5JUMA,25729
289
289
  prefect/utilities/collections.py,sha256=yMZyRD9j6m3Fd3wm4-HR2r3o7B02AC_MDQZUWsX3s18,23513
@@ -318,7 +318,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
318
318
  prefect/workers/process.py,sha256=ozC-PGp1rjEG7CO1D7wZYM3oO_DeefccXy3rBLJK3kA,8892
319
319
  prefect/workers/server.py,sha256=SEuyScZ5nGm2OotdtbHjpvqJlTRVWCh29ND7FeL_fZA,1974
320
320
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
321
- prefect_client-3.2.11.dist-info/METADATA,sha256=JS30uEIli1RBGo-yy-85VPymQHxABFNc1tyF9mVIpBA,7193
322
- prefect_client-3.2.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
323
- prefect_client-3.2.11.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
324
- prefect_client-3.2.11.dist-info/RECORD,,
321
+ prefect_client-3.2.12.dist-info/METADATA,sha256=ncy68hiJUyKnuWCgyRWHXy_-LfawTvBaLA3VWyeBj44,7193
322
+ prefect_client-3.2.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
323
+ prefect_client-3.2.12.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
324
+ prefect_client-3.2.12.dist-info/RECORD,,