prefect-client 2.20.4__py3-none-any.whl → 2.20.6__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.6.dist-info}/METADATA +1 -1
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.6.dist-info}/RECORD +11 -12
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.6.dist-info}/WHEEL +1 -1
- prefect/_vendor/fastapi/py.typed +0 -0
- prefect/_vendor/starlette/py.typed +0 -0
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.6.dist-info}/LICENSE +0 -0
- {prefect_client-2.20.4.dist-info → prefect_client-2.20.6.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
|
@@ -85,7 +86,6 @@ prefect/_vendor/fastapi/exceptions.py,sha256=131GbKBhoKJNvkE3k2-IvKye6xH-fvNaJ20
|
|
85
86
|
prefect/_vendor/fastapi/logger.py,sha256=I9NNi3ov8AcqbsbC9wl1X-hdItKgYt2XTrx1f99Zpl4,54
|
86
87
|
prefect/_vendor/fastapi/param_functions.py,sha256=BLvSfhJqiViP-_zYQ7BL_t9IARf4EJbKZSikDNsOkfw,9130
|
87
88
|
prefect/_vendor/fastapi/params.py,sha256=UBEVQ_EK9iIbF3DOJXfH2zcO27uvf5NeRdslMOEtIEA,13350
|
88
|
-
prefect/_vendor/fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
89
|
prefect/_vendor/fastapi/requests.py,sha256=KsGwp86w95S-0wgx4pL-T4i9M_z-_KlMzX43rdUg9YU,183
|
90
90
|
prefect/_vendor/fastapi/responses.py,sha256=M67RzoU0K91ojgHjvDIDK3iyBAvA9YKPsUJIP4FtxtY,1381
|
91
91
|
prefect/_vendor/fastapi/routing.py,sha256=Kz1WttDcSqHkt1fW9_UmkZG-G0noRY3FAStkfw_VUNE,57083
|
@@ -131,7 +131,6 @@ prefect/_vendor/starlette/datastructures.py,sha256=AyApp3jfD9muXBn8EVbuAVk6ZhCDY
|
|
131
131
|
prefect/_vendor/starlette/endpoints.py,sha256=00KnI8grT2xxv1jERCvAgqwVxRDOo8hrqpFHnKow9xs,5319
|
132
132
|
prefect/_vendor/starlette/exceptions.py,sha256=ODmYfjgNKWAZwfV8TDVepoEwhv1Kl92KvvwMvEJ04AA,1840
|
133
133
|
prefect/_vendor/starlette/formparsers.py,sha256=aNoQl0CPI7pYnvae2k0KB2jNnv6mQJL-N2FuhRhPLW4,10450
|
134
|
-
prefect/_vendor/starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
135
134
|
prefect/_vendor/starlette/requests.py,sha256=dytpLA1l9oVb-u98i4caDI1z4-XtPCe1jzjFajlQWa8,10899
|
136
135
|
prefect/_vendor/starlette/responses.py,sha256=1l36hyZeTXWYCQ8dYCo-eM_I6KyGuq_qUdtM9GBT3EA,12565
|
137
136
|
prefect/_vendor/starlette/routing.py,sha256=Y0uiRXBQ0uRWs1O63qFD6doqKeh-KhqhuiHU5ovodQs,35696
|
@@ -155,7 +154,7 @@ prefect/_vendor/starlette/middleware/trustedhost.py,sha256=fDi67anj2a7MGviC0RAWh
|
|
155
154
|
prefect/_vendor/starlette/middleware/wsgi.py,sha256=Ewk1cVDkcoXLVI2ZF0FEZLZCwCDjc0H7PnvWLlxurVY,5266
|
156
155
|
prefect/blocks/__init__.py,sha256=BUfh6gIwA6HEjRyVCAiv0he3M1zfM-oY-JrlBfeWeY8,182
|
157
156
|
prefect/blocks/abstract.py,sha256=AiAs0MC5JKCf0Xg0yofC5Qu2TZ52AjDMP1ntMGuP2dY,16311
|
158
|
-
prefect/blocks/core.py,sha256=
|
157
|
+
prefect/blocks/core.py,sha256=_NKdrHvN2f0LdgqX9MYXp0PJQW36e6cs2Za7hVfrCIw,43870
|
159
158
|
prefect/blocks/fields.py,sha256=ANOzbNyDCBIvm6ktgbLTMs7JW2Sf6CruyATjAW61ks0,1607
|
160
159
|
prefect/blocks/kubernetes.py,sha256=IN-hZkzIRvqjd_dzPZby3q8p7m2oUWqArBq24BU9cDg,4071
|
161
160
|
prefect/blocks/notifications.py,sha256=LJd2mgV29URqItJyxtWUpdo4wswtm7KyIseuAjV3joI,28132
|
@@ -187,7 +186,7 @@ prefect/deployments/deployments.py,sha256=S9ro-RUNrc2v8uWFkLr3-JE7h3RGC-HO_f5T7x
|
|
187
186
|
prefect/deployments/runner.py,sha256=a2dxc84zCofZFXV47M2zfntqUaoAhGWvf7o0s3MjPws,44772
|
188
187
|
prefect/deployments/schedules.py,sha256=23GDCAKOP-aAEKGappwTrM4HU67ndVH7NR4Dq0neU_U,1884
|
189
188
|
prefect/deployments/steps/__init__.py,sha256=3pZWONAZzenDszqNQT3bmTFilnvjB6xMolMz9tr5pLw,229
|
190
|
-
prefect/deployments/steps/core.py,sha256=
|
189
|
+
prefect/deployments/steps/core.py,sha256=KEV05IECTlUXz-GS8bzmhrxx6U9dXJP3-SB-o4-vr0s,6845
|
191
190
|
prefect/deployments/steps/pull.py,sha256=VXyMXedH9JNPFQ0Cs54qlTgL1EJ8Y6IbvxPKjAduqpA,7602
|
192
191
|
prefect/deployments/steps/utility.py,sha256=EhoitdNqsQHUL5MBmVyOL9lSwNXweZvFiw03eIkzveU,8134
|
193
192
|
prefect/deprecated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -257,7 +256,7 @@ prefect/types/__init__.py,sha256=aZvlQ2uXl949sJ_khmxSVkRH3o6edo-eJ_GBGMBN5Yg,313
|
|
257
256
|
prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
258
257
|
prefect/utilities/annotations.py,sha256=bXB43j5Zsq5gaBcJe9qnszBlnNwCTwqSTgcu2OkkRLo,2776
|
259
258
|
prefect/utilities/asyncutils.py,sha256=ftu6MaV9qOZ3oCIErrneW07km2BydCezOMzvPUuCMUo,17246
|
260
|
-
prefect/utilities/callables.py,sha256=
|
259
|
+
prefect/utilities/callables.py,sha256=WUf2sGTyrFvl_s_JdIPg3ZX2iVl9CuH3NJ0ErOdPIOE,21063
|
261
260
|
prefect/utilities/collections.py,sha256=0v-NNXxYYzkUTCCNDMNB44AnDv9yj35UYouNraCqlo8,15449
|
262
261
|
prefect/utilities/compat.py,sha256=mNQZDnzyKaOqy-OV-DnmH_dc7CNF5nQgW_EsA4xMr7g,906
|
263
262
|
prefect/utilities/context.py,sha256=BThuUW94-IYgFYTeMIM9KMo8ShT3oiI7w5ajZHzU1j0,1377
|
@@ -287,8 +286,8 @@ prefect/workers/block.py,sha256=aYY__uq3v1eq1kkbVukxyhQNbkknaKYo6-_3tcrfKKA,8067
|
|
287
286
|
prefect/workers/process.py,sha256=pPtCdA7fKQ4OsvoitT-cayZeh5HgLX4xBUYlb2Zad-Q,9475
|
288
287
|
prefect/workers/server.py,sha256=WVZJxR8nTMzK0ov0BD0xw5OyQpT26AxlXbsGQ1OrxeQ,1551
|
289
288
|
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.
|
289
|
+
prefect_client-2.20.6.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
290
|
+
prefect_client-2.20.6.dist-info/METADATA,sha256=NR7WdGoTzZ_ar-BpfiZhIW38HBAI5hQSkZvgmviBwEw,7391
|
291
|
+
prefect_client-2.20.6.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
292
|
+
prefect_client-2.20.6.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
|
293
|
+
prefect_client-2.20.6.dist-info/RECORD,,
|
prefect/_vendor/fastapi/py.typed
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|