prefect-client 2.20.4__py3-none-any.whl → 2.20.5__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/integrations.py +7 -0
- prefect/blocks/core.py +3 -4
- prefect/deployments/steps/core.py +6 -0
- prefect/tasks.py +10 -1
- prefect/utilities/callables.py +1 -3
- prefect/variables.py +16 -8
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.5.dist-info}/METADATA +1 -1
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.5.dist-info}/RECORD +11 -10
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.5.dist-info}/WHEEL +1 -1
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.5.dist-info}/LICENSE +0 -0
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.5.dist-info}/top_level.txt +0 -0
prefect/blocks/core.py
CHANGED
@@ -507,10 +507,9 @@ class Block(BaseModel, ABC):
|
|
507
507
|
`<module>:11: No type or annotation for parameter 'write_json'`
|
508
508
|
because griffe is unable to parse the types from pydantic.BaseModel.
|
509
509
|
"""
|
510
|
-
with disable_logger("griffe
|
511
|
-
|
512
|
-
|
513
|
-
parsed = parse(docstring, Parser.google)
|
510
|
+
with disable_logger("griffe"):
|
511
|
+
docstring = Docstring(cls.__doc__)
|
512
|
+
parsed = parse(docstring, Parser.google)
|
514
513
|
return parsed
|
515
514
|
|
516
515
|
@classmethod
|
@@ -21,6 +21,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
21
21
|
|
22
22
|
from prefect._internal.compatibility.deprecated import PrefectDeprecationWarning
|
23
23
|
from prefect._internal.concurrency.api import Call, from_async
|
24
|
+
from prefect._internal.integrations import KNOWN_EXTRAS_FOR_PACKAGES
|
24
25
|
from prefect.logging.loggers import get_logger
|
25
26
|
from prefect.settings import PREFECT_DEBUG_MODE
|
26
27
|
from prefect.utilities.importtools import import_object
|
@@ -83,6 +84,11 @@ def _get_function_for_step(
|
|
83
84
|
raise
|
84
85
|
|
85
86
|
try:
|
87
|
+
packages = [
|
88
|
+
KNOWN_EXTRAS_FOR_PACKAGES.get(package, package)
|
89
|
+
for package in packages
|
90
|
+
if package
|
91
|
+
]
|
86
92
|
subprocess.check_call([sys.executable, "-m", "pip", "install", *packages])
|
87
93
|
except subprocess.CalledProcessError:
|
88
94
|
get_logger("deployments.steps.core").warning(
|
prefect/tasks.py
CHANGED
@@ -141,8 +141,17 @@ def _generate_task_key(fn: Callable[..., Any]) -> str:
|
|
141
141
|
|
142
142
|
qualname = fn.__qualname__.split(".")[-1]
|
143
143
|
|
144
|
+
try:
|
145
|
+
code_obj = getattr(fn, "__code__", None)
|
146
|
+
if code_obj is None:
|
147
|
+
code_obj = fn.__call__.__code__
|
148
|
+
except AttributeError:
|
149
|
+
raise AttributeError(
|
150
|
+
f"{fn} is not a standard Python function object and could not be converted to a task."
|
151
|
+
) from None
|
152
|
+
|
144
153
|
code_hash = (
|
145
|
-
h[:NUM_CHARS_DYNAMIC_KEY] if (h := hash_objects(
|
154
|
+
h[:NUM_CHARS_DYNAMIC_KEY] if (h := hash_objects(code_obj)) else "unknown"
|
146
155
|
)
|
147
156
|
|
148
157
|
return f"{qualname}-{code_hash}"
|
prefect/utilities/callables.py
CHANGED
@@ -255,9 +255,7 @@ def parameter_docstrings(docstring: Optional[str]) -> Dict[str, str]:
|
|
255
255
|
if not docstring:
|
256
256
|
return param_docstrings
|
257
257
|
|
258
|
-
with disable_logger("griffe
|
259
|
-
"griffe.agents.nodes"
|
260
|
-
):
|
258
|
+
with disable_logger("griffe"):
|
261
259
|
parsed = parse(Docstring(docstring), Parser.google)
|
262
260
|
for section in parsed:
|
263
261
|
if section.kind != DocstringSectionKind.parameters:
|
prefect/variables.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import List, Optional
|
1
|
+
from typing import List, Optional, Union
|
2
2
|
|
3
3
|
from prefect._internal.compatibility.deprecated import deprecated_callable
|
4
4
|
from prefect.client.schemas.actions import VariableCreate as VariableRequest
|
@@ -26,7 +26,7 @@ class Variable(VariableRequest):
|
|
26
26
|
value: str,
|
27
27
|
tags: Optional[List[str]] = None,
|
28
28
|
overwrite: bool = False,
|
29
|
-
) -> Optional[
|
29
|
+
) -> Optional["Variable"]:
|
30
30
|
"""
|
31
31
|
Sets a new variable. If one exists with the same name, user must pass `overwrite=True`
|
32
32
|
```
|
@@ -47,8 +47,7 @@ class Variable(VariableRequest):
|
|
47
47
|
"""
|
48
48
|
client, _ = get_or_create_client()
|
49
49
|
variable = await client.read_variable_by_name(name)
|
50
|
-
var_dict = {"name": name, "value": value}
|
51
|
-
var_dict["tags"] = tags or []
|
50
|
+
var_dict = {"name": name, "value": value, "tags": tags or []}
|
52
51
|
if variable:
|
53
52
|
if not overwrite:
|
54
53
|
raise ValueError(
|
@@ -65,7 +64,9 @@ class Variable(VariableRequest):
|
|
65
64
|
|
66
65
|
@classmethod
|
67
66
|
@sync_compatible
|
68
|
-
async def get(
|
67
|
+
async def get(
|
68
|
+
cls, name: str, default: Optional[str] = None
|
69
|
+
) -> Optional[Union["Variable", str]]:
|
69
70
|
"""
|
70
71
|
Get a variable by name. If doesn't exist return the default.
|
71
72
|
```
|
@@ -86,7 +87,12 @@ class Variable(VariableRequest):
|
|
86
87
|
"""
|
87
88
|
client, _ = get_or_create_client()
|
88
89
|
variable = await client.read_variable_by_name(name)
|
89
|
-
|
90
|
+
|
91
|
+
return (
|
92
|
+
Variable(name=variable.name, value=variable.value, tags=variable.tags)
|
93
|
+
if variable
|
94
|
+
else default
|
95
|
+
)
|
90
96
|
|
91
97
|
|
92
98
|
@deprecated_callable(start_date="Apr 2024")
|
@@ -110,5 +116,7 @@ async def get(name: str, default: Optional[str] = None) -> Optional[str]:
|
|
110
116
|
var = await variables.get("my_var")
|
111
117
|
```
|
112
118
|
"""
|
113
|
-
variable = await Variable.get(name)
|
114
|
-
|
119
|
+
variable = await Variable.get(name, default=default)
|
120
|
+
if isinstance(variable, Variable):
|
121
|
+
variable = variable.value
|
122
|
+
return variable
|
@@ -24,10 +24,11 @@ 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=
|
28
|
-
prefect/variables.py,sha256=
|
27
|
+
prefect/tasks.py,sha256=PO4i5Dl69t6qnlVnXD4vnCvuZI07SNiyGOrXPkw8gR4,56439
|
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
|
31
|
+
prefect/_internal/integrations.py,sha256=U4cZMDbnilzZSKaMxvzZcSL27a1tzRMjDoTfr2ul_eY,231
|
31
32
|
prefect/_internal/pytz.py,sha256=47Y28jKxUvgw7vaEvN-Xl0laiVdMLXC8IRUEk7oHz1Q,13749
|
32
33
|
prefect/_internal/compatibility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
34
|
prefect/_internal/compatibility/deprecated.py,sha256=ORtcd5nIUQURxgaFW1MJ6OwTbmsGtwypjTyHTkVLHB4,11578
|
@@ -155,7 +156,7 @@ prefect/_vendor/starlette/middleware/trustedhost.py,sha256=fDi67anj2a7MGviC0RAWh
|
|
155
156
|
prefect/_vendor/starlette/middleware/wsgi.py,sha256=Ewk1cVDkcoXLVI2ZF0FEZLZCwCDjc0H7PnvWLlxurVY,5266
|
156
157
|
prefect/blocks/__init__.py,sha256=BUfh6gIwA6HEjRyVCAiv0he3M1zfM-oY-JrlBfeWeY8,182
|
157
158
|
prefect/blocks/abstract.py,sha256=AiAs0MC5JKCf0Xg0yofC5Qu2TZ52AjDMP1ntMGuP2dY,16311
|
158
|
-
prefect/blocks/core.py,sha256=
|
159
|
+
prefect/blocks/core.py,sha256=_NKdrHvN2f0LdgqX9MYXp0PJQW36e6cs2Za7hVfrCIw,43870
|
159
160
|
prefect/blocks/fields.py,sha256=ANOzbNyDCBIvm6ktgbLTMs7JW2Sf6CruyATjAW61ks0,1607
|
160
161
|
prefect/blocks/kubernetes.py,sha256=IN-hZkzIRvqjd_dzPZby3q8p7m2oUWqArBq24BU9cDg,4071
|
161
162
|
prefect/blocks/notifications.py,sha256=LJd2mgV29URqItJyxtWUpdo4wswtm7KyIseuAjV3joI,28132
|
@@ -187,7 +188,7 @@ prefect/deployments/deployments.py,sha256=S9ro-RUNrc2v8uWFkLr3-JE7h3RGC-HO_f5T7x
|
|
187
188
|
prefect/deployments/runner.py,sha256=a2dxc84zCofZFXV47M2zfntqUaoAhGWvf7o0s3MjPws,44772
|
188
189
|
prefect/deployments/schedules.py,sha256=23GDCAKOP-aAEKGappwTrM4HU67ndVH7NR4Dq0neU_U,1884
|
189
190
|
prefect/deployments/steps/__init__.py,sha256=3pZWONAZzenDszqNQT3bmTFilnvjB6xMolMz9tr5pLw,229
|
190
|
-
prefect/deployments/steps/core.py,sha256=
|
191
|
+
prefect/deployments/steps/core.py,sha256=KEV05IECTlUXz-GS8bzmhrxx6U9dXJP3-SB-o4-vr0s,6845
|
191
192
|
prefect/deployments/steps/pull.py,sha256=VXyMXedH9JNPFQ0Cs54qlTgL1EJ8Y6IbvxPKjAduqpA,7602
|
192
193
|
prefect/deployments/steps/utility.py,sha256=EhoitdNqsQHUL5MBmVyOL9lSwNXweZvFiw03eIkzveU,8134
|
193
194
|
prefect/deprecated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -257,7 +258,7 @@ prefect/types/__init__.py,sha256=aZvlQ2uXl949sJ_khmxSVkRH3o6edo-eJ_GBGMBN5Yg,313
|
|
257
258
|
prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
258
259
|
prefect/utilities/annotations.py,sha256=bXB43j5Zsq5gaBcJe9qnszBlnNwCTwqSTgcu2OkkRLo,2776
|
259
260
|
prefect/utilities/asyncutils.py,sha256=ftu6MaV9qOZ3oCIErrneW07km2BydCezOMzvPUuCMUo,17246
|
260
|
-
prefect/utilities/callables.py,sha256=
|
261
|
+
prefect/utilities/callables.py,sha256=WUf2sGTyrFvl_s_JdIPg3ZX2iVl9CuH3NJ0ErOdPIOE,21063
|
261
262
|
prefect/utilities/collections.py,sha256=0v-NNXxYYzkUTCCNDMNB44AnDv9yj35UYouNraCqlo8,15449
|
262
263
|
prefect/utilities/compat.py,sha256=mNQZDnzyKaOqy-OV-DnmH_dc7CNF5nQgW_EsA4xMr7g,906
|
263
264
|
prefect/utilities/context.py,sha256=BThuUW94-IYgFYTeMIM9KMo8ShT3oiI7w5ajZHzU1j0,1377
|
@@ -287,8 +288,8 @@ prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
|
|
287
288
|
prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
|
288
289
|
prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
|
289
290
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
290
|
-
prefect_client-2.20.
|
291
|
-
prefect_client-2.20.
|
292
|
-
prefect_client-2.20.
|
293
|
-
prefect_client-2.20.
|
294
|
-
prefect_client-2.20.
|
291
|
+
prefect_client-2.20.5.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
292
|
+
prefect_client-2.20.5.dist-info/METADATA,sha256=PZ764AcFU5kh5nhJhvBVRy_LuNtwBUHB5Yrk0pKPm8A,7391
|
293
|
+
prefect_client-2.20.5.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
294
|
+
prefect_client-2.20.5.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
|
295
|
+
prefect_client-2.20.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|