Skip to content

Commit 3a878eb

Browse files
authored
Back to dev mode and update pre-commit hooks (#580)
* Back to dev mode * Upgrade ruff pre-commit * Bump ruff pre-commit and rerun hooks for all files * Use CPython 3.14 final in test and CI config
1 parent 7576fff commit 3a878eb

File tree

13 files changed

+52
-34
lines changed

13 files changed

+52
-34
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
os: [ubuntu-latest, windows-latest, macos-latest]
32-
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev", "pypy-3.9"]
32+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.9"]
3333
exclude:
3434
# Do not test all minor versions on all platforms, especially if they
3535
# are not the oldest/newest supported versions

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ repos:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- repo: https://github.com/psf/black
9-
rev: 23.9.1
9+
rev: 25.9.0
1010
hooks:
1111
- id: black
1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.0.292
13+
rev: v0.14.3
1414
hooks:
1515
- id: ruff
16-
args: ["--fix", "--show-source"]
16+
args: ["--fix", "--show-files"]

cloudpickle/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
__doc__ = cloudpickle.__doc__
55

6-
__version__ = "3.1.2"
6+
__version__ = "3.2.0.dev0"
77

88
__all__ = [ # noqa
99
"__version__",

cloudpickle/cloudpickle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
# cloudpickle. See: tests/test_backward_compat.py
8080
from types import CellType # noqa: F401
8181

82-
8382
# cloudpickle is meant for inter process communication: we expect all
8483
# communicating processes to run the same Python version hence we favor
8584
# communication speed over compatibility:
@@ -193,9 +192,12 @@ def _is_registered_pickle_by_value(module):
193192

194193

195194
if sys.version_info >= (3, 14):
195+
196196
def _getattribute(obj, name):
197-
return _pickle_getattribute(obj, name.split('.'))
197+
return _pickle_getattribute(obj, name.split("."))
198+
198199
else:
200+
199201
def _getattribute(obj, name):
200202
return _pickle_getattribute(obj, name)[0]
201203

dev/make-distribution.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ rm -rf cloudpickle.egg-info
1111
python setup.py sdist
1212
python setup.py bdist_wheel --universal
1313
twine upload dist/*
14-

tests/cloudpickle_test.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
from .testutils import assert_run_python_script
5656
from .testutils import check_deterministic_pickle
5757

58-
5958
_TEST_GLOBAL_VARIABLE = "default_value"
6059
_TEST_GLOBAL_VARIABLE2 = "another_value"
6160

@@ -354,7 +353,6 @@ class A:
354353
assert hasattr(A_roundtrip, "__firstlineno__")
355354
assert A_roundtrip.__firstlineno__ == A.__firstlineno__
356355

357-
358356
def test_dynamically_generated_class_that_uses_super(self):
359357
class Base:
360358
def method(self):
@@ -1067,7 +1065,9 @@ def test_extended_arg(self):
10671065
def f():
10681066
x = {tup}
10691067
return zlib.crc32(bytes(bytearray(x)))
1070-
""".format(tup=", ".join(names))
1068+
""".format(
1069+
tup=", ".join(names)
1070+
)
10711071
exec(textwrap.dedent(code), d, d)
10721072
f = d["f"]
10731073
res = f()
@@ -1206,7 +1206,9 @@ def check_logger(self, name):
12061206
logging.basicConfig(level=logging.INFO)
12071207
logger = cloudpickle.loads(base64.b32decode(b'{}'))
12081208
logger.info('hello')
1209-
""".format(base64.b32encode(dumped).decode("ascii"))
1209+
""".format(
1210+
base64.b32encode(dumped).decode("ascii")
1211+
)
12101212
proc = subprocess.Popen(
12111213
[sys.executable, "-W ignore", "-c", code],
12121214
stdout=subprocess.PIPE,
@@ -1506,7 +1508,8 @@ def __getattr__(self, name):
15061508

15071509
def test_importing_multiprocessing_does_not_impact_whichmodule(self):
15081510
# non-regression test for #528
1509-
script = textwrap.dedent("""
1511+
script = textwrap.dedent(
1512+
"""
15101513
import multiprocessing
15111514
import cloudpickle
15121515
from cloudpickle.cloudpickle import dumps
@@ -1516,7 +1519,8 @@ def test_importing_multiprocessing_does_not_impact_whichmodule(self):
15161519
dumps.__module__ = None
15171520
15181521
print(cloudpickle.cloudpickle._whichmodule(dumps, dumps.__name__))
1519-
""")
1522+
"""
1523+
)
15201524
script_path = Path(self.tmpdir) / "whichmodule_and_multiprocessing.py"
15211525
with open(script_path, mode="w") as f:
15221526
f.write(script)
@@ -1530,7 +1534,6 @@ def test_importing_multiprocessing_does_not_impact_whichmodule(self):
15301534
self.assertEqual(proc.wait(), 0, msg="Stdout: " + str(out))
15311535
self.assertEqual(out.strip(), b"cloudpickle.cloudpickle")
15321536

1533-
15341537
def test_unrelated_faulty_module(self):
15351538
# Check that pickling a dynamically defined function or class does not
15361539
# fail when introspecting the currently loaded modules in sys.modules
@@ -1733,7 +1736,9 @@ def f5(x):
17331736
17341737
cloned = subprocess_pickle_echo(f5, protocol={protocol})
17351738
assert cloned(7) == f5(7) == 7
1736-
""".format(protocol=self.protocol)
1739+
""".format(
1740+
protocol=self.protocol
1741+
)
17371742
assert_run_python_script(textwrap.dedent(code))
17381743

17391744
def test_interactively_defined_global_variable(self):
@@ -1872,7 +1877,9 @@ def interactive_function(x):
18721877
# previous definition of `interactive_function`:
18731878
18741879
assert w.run(wrapper_func, 41) == 40
1875-
""".format(protocol=self.protocol)
1880+
""".format(
1881+
protocol=self.protocol
1882+
)
18761883
assert_run_python_script(code)
18771884

18781885
def test_interactive_remote_function_calls_no_side_effect(self):
@@ -1916,7 +1923,9 @@ def is_in_main(name):
19161923
assert is_in_main("GLOBAL_VARIABLE")
19171924
assert not w.run(is_in_main, "GLOBAL_VARIABLE")
19181925
1919-
""".format(protocol=self.protocol)
1926+
""".format(
1927+
protocol=self.protocol
1928+
)
19201929
assert_run_python_script(code)
19211930

19221931
def test_interactive_dynamic_type_and_remote_instances(self):
@@ -1955,7 +1964,9 @@ def echo(*args):
19551964
assert isinstance(c1, CustomCounter)
19561965
assert isinstance(c2, CustomCounter)
19571966
1958-
""".format(protocol=self.protocol)
1967+
""".format(
1968+
protocol=self.protocol
1969+
)
19591970
assert_run_python_script(code)
19601971

19611972
def test_interactive_dynamic_type_and_stored_remote_instances(self):
@@ -2032,7 +2043,9 @@ class A:
20322043
# method:
20332044
assert w.run(lambda obj_id: lookup(obj_id).echo(43), id2) == 43
20342045
2035-
""".format(protocol=self.protocol)
2046+
""".format(
2047+
protocol=self.protocol
2048+
)
20362049
assert_run_python_script(code)
20372050

20382051
def test_dynamic_func_deterministic_roundtrip(self):
@@ -2220,7 +2233,9 @@ def process_data():
22202233
# iterations instead of 100 as used now (100x more data)
22212234
assert growth < 5e7, growth
22222235
2223-
""".format(protocol=self.protocol)
2236+
""".format(
2237+
protocol=self.protocol
2238+
)
22242239
assert_run_python_script(code)
22252240

22262241
def test_pickle_reraise(self):
@@ -2422,7 +2437,9 @@ def check_positive(x):
24222437
24232438
result = w.run(check_positive, 1)
24242439
assert result is Color.BLUE
2425-
""".format(protocol=self.protocol)
2440+
""".format(
2441+
protocol=self.protocol
2442+
)
24262443
assert_run_python_script(code)
24272444

24282445
def test_relative_import_inside_function(self):
@@ -2476,7 +2493,9 @@ def f(a, /, b=1):
24762493
with pytest.raises(TypeError):
24772494
func(a=2)
24782495
2479-
""".format(protocol=self.protocol)
2496+
""".format(
2497+
protocol=self.protocol
2498+
)
24802499
assert_run_python_script(textwrap.dedent(code))
24812500

24822501
def test___reduce___returns_string(self):
@@ -3049,7 +3068,9 @@ def echo(*args):
30493068
cloned_value, cloned_type = w.run(echo, value, SampleDataclass)
30503069
assert cloned_type is SampleDataclass
30513070
assert isinstance(cloned_value, SampleDataclass)
3052-
""".format(protocol=self.protocol)
3071+
""".format(
3072+
protocol=self.protocol
3073+
)
30533074
assert_run_python_script(code)
30543075

30553076

tests/cloudpickle_testpkg/_cloudpickle_testpkg/mod.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
import types
33

4-
54
# #354: To emulate package capabilities while being a single file, an extension
65
# module (for instance a mod.so file) can dynamically create a module object
76
# (most likely using the *package_name*.*parent_module_name*.*submodule_name*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.1
1+
2.2.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.1
1+
2.2.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.1

0 commit comments

Comments
 (0)