prefect-client 3.2.15.dev7__py3-none-any.whl → 3.2.15.dev9__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.15.dev7"
3
- __build_date__ = "2025-03-26 18:43:23.716248+00:00"
4
- __git_commit__ = "d56a01ceb58880a27246bb0c4a075e5b28bfafd4"
2
+ __version__ = "3.2.15.dev9"
3
+ __build_date__ = "2025-03-28 08:08:12.449359+00:00"
4
+ __git_commit__ = "d7dc1c803efcb874eb57761c107f7107e27a1e07"
5
5
  __dirty__ = False
prefect/cache_policies.py CHANGED
@@ -2,7 +2,15 @@ import inspect
2
2
  from copy import deepcopy
3
3
  from dataclasses import dataclass, field
4
4
  from pathlib import Path
5
- from typing import TYPE_CHECKING, Any, Callable, Dict, Literal, Optional, Union
5
+ from typing import (
6
+ TYPE_CHECKING,
7
+ Any,
8
+ Callable,
9
+ Dict,
10
+ Literal,
11
+ Optional,
12
+ Union,
13
+ )
6
14
 
7
15
  from typing_extensions import Self
8
16
 
@@ -15,6 +23,24 @@ if TYPE_CHECKING:
15
23
  from prefect.locking.protocol import LockManager
16
24
  from prefect.transactions import IsolationLevel
17
25
 
26
+ STABLE_TRANSFORMS: dict[type, Callable[[Any], Any]] = {}
27
+
28
+
29
+ def _register_stable_transforms() -> None:
30
+ """
31
+ Some inputs do not reliably produce deterministic byte strings when serialized via
32
+ `cloudpickle`. This utility registers stabilizing transformations of such types
33
+ so that cache keys that utilize them are deterministic across invocations.
34
+ """
35
+ try:
36
+ import pandas as pd
37
+
38
+ STABLE_TRANSFORMS[pd.DataFrame] = lambda df: [
39
+ df[col] for col in sorted(df.columns)
40
+ ]
41
+ except (ImportError, ModuleNotFoundError):
42
+ pass
43
+
18
44
 
19
45
  @dataclass
20
46
  class CachePolicy:
@@ -341,7 +367,8 @@ class Inputs(CachePolicy):
341
367
 
342
368
  for key, val in inputs.items():
343
369
  if key not in exclude:
344
- hashed_inputs[key] = val
370
+ transformer = STABLE_TRANSFORMS.get(type(val)) # type: ignore[reportUnknownMemberType]
371
+ hashed_inputs[key] = transformer(val) if transformer else val
345
372
 
346
373
  try:
347
374
  return hash_objects(hashed_inputs, raise_on_failure=True)
@@ -362,6 +389,8 @@ class Inputs(CachePolicy):
362
389
  return Inputs(exclude=self.exclude + [other])
363
390
 
364
391
 
392
+ _register_stable_transforms()
393
+
365
394
  INPUTS = Inputs()
366
395
  NONE = _None()
367
396
  NO_CACHE = _None()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.2.15.dev7
3
+ Version: 3.2.15.dev9
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,13 +1,13 @@
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=9HfS5GMe90EbvbHyGiPPtZ531KOhEiN6h_-jQJ7Dutk,186
4
+ prefect/_build_info.py,sha256=4-SaJ6O1UeXC1dkN-TwCXa9BVkJaWT61LYr4vJWaf9Q,186
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
8
8
  prefect/artifacts.py,sha256=dMBUOAWnUamzjb5HSqwB5-GR2Qb-Gxee26XG5NDCUuw,22720
9
9
  prefect/automations.py,sha256=ZzPxn2tINdlXTQo805V4rIlbXuNWxd7cdb3gTJxZIeY,12567
10
- prefect/cache_policies.py,sha256=cF_6eqg34x7XgaCIw6S8Vr-Eq0wIr4Y6t3FOuXaPBrY,11912
10
+ prefect/cache_policies.py,sha256=Kwdei4JjitNfx42OepKpDNxwPtEwRgUUAn_soxsnNzI,12699
11
11
  prefect/context.py,sha256=iJe4pkFqX6lz8ax1Mde_YqVmBVWmzeBe0ca2_nT6KPQ,23673
12
12
  prefect/engine.py,sha256=uB5JN4l045i5JTlRQNT1x7MwlSiGQ5Bop2Q6jHHOgxY,3699
13
13
  prefect/exceptions.py,sha256=-nih8qqdxRm6CX-4yrqwePVh8Mcpvla_V6N_KbdJsIU,11593
@@ -318,7 +318,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
318
318
  prefect/workers/process.py,sha256=uxOwcqA2Ps-V-W6WeSdKCQMINrCxBEVx1K1Un8pb7vs,8973
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.15.dev7.dist-info/METADATA,sha256=NeJVNI31MCSCuZTKOgBqWYphQmnBTNCPxpsZ4p9a4e0,7233
322
- prefect_client-3.2.15.dev7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
323
- prefect_client-3.2.15.dev7.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
324
- prefect_client-3.2.15.dev7.dist-info/RECORD,,
321
+ prefect_client-3.2.15.dev9.dist-info/METADATA,sha256=h0orW1xoDaYxfEVZNF7Y9csErq-Z9K-C47FqW9VKgW0,7233
322
+ prefect_client-3.2.15.dev9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
323
+ prefect_client-3.2.15.dev9.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
324
+ prefect_client-3.2.15.dev9.dist-info/RECORD,,