cloudpickle-rust 0.1.0__tar.gz

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.
Files changed (74) hide show
  1. cloudpickle_rust-0.1.0/.github/workflows/publish_to_pypi.yml +359 -0
  2. cloudpickle_rust-0.1.0/.github/workflows/testing.yml +81 -0
  3. cloudpickle_rust-0.1.0/.gitignore +73 -0
  4. cloudpickle_rust-0.1.0/.pre-commit-config.yaml +27 -0
  5. cloudpickle_rust-0.1.0/CHANGES.md +35 -0
  6. cloudpickle_rust-0.1.0/Cargo.lock +134 -0
  7. cloudpickle_rust-0.1.0/Cargo.toml +27 -0
  8. cloudpickle_rust-0.1.0/LICENSE +215 -0
  9. cloudpickle_rust-0.1.0/NOTICE +14 -0
  10. cloudpickle_rust-0.1.0/PKG-INFO +360 -0
  11. cloudpickle_rust-0.1.0/README.md +322 -0
  12. cloudpickle_rust-0.1.0/benchmarks/bench.py +133 -0
  13. cloudpickle_rust-0.1.0/build.rs +5 -0
  14. cloudpickle_rust-0.1.0/dev-requirements.txt +23 -0
  15. cloudpickle_rust-0.1.0/licenses/LICENSE-cloudpickle.txt +32 -0
  16. cloudpickle_rust-0.1.0/pyproject.toml +78 -0
  17. cloudpickle_rust-0.1.0/python/cloudpickle_rust/__init__.py +18 -0
  18. cloudpickle_rust-0.1.0/python/cloudpickle_rust/cloudpickle.pyi +188 -0
  19. cloudpickle_rust-0.1.0/python/cloudpickle_rust/cloudpickle_fast.py +14 -0
  20. cloudpickle_rust-0.1.0/python/cloudpickle_rust/py.typed +0 -0
  21. cloudpickle_rust-0.1.0/src/code.rs +599 -0
  22. cloudpickle_rust-0.1.0/src/lib.rs +430 -0
  23. cloudpickle_rust-0.1.0/src/lookup.rs +540 -0
  24. cloudpickle_rust-0.1.0/src/pickler.rs +931 -0
  25. cloudpickle_rust-0.1.0/src/reconstructors.rs +536 -0
  26. cloudpickle_rust-0.1.0/src/reducers.rs +941 -0
  27. cloudpickle_rust-0.1.0/src/state.rs +136 -0
  28. cloudpickle_rust-0.1.0/src/utils.rs +428 -0
  29. cloudpickle_rust-0.1.0/tests/__init__.py +3 -0
  30. cloudpickle_rust-0.1.0/tests/cloudpickle_file_test.py +89 -0
  31. cloudpickle_rust-0.1.0/tests/cloudpickle_ipykernel_test.py +100 -0
  32. cloudpickle_rust-0.1.0/tests/cloudpickle_rust_test.py +344 -0
  33. cloudpickle_rust-0.1.0/tests/cloudpickle_test.py +3184 -0
  34. cloudpickle_rust-0.1.0/tests/cloudpickle_testpkg/_cloudpickle_testpkg/__init__.py +48 -0
  35. cloudpickle_rust-0.1.0/tests/cloudpickle_testpkg/_cloudpickle_testpkg/mod.py +68 -0
  36. cloudpickle_rust-0.1.0/tests/cloudpickle_testpkg/setup.py +16 -0
  37. cloudpickle_rust-0.1.0/tests/generate_old_pickles.py +96 -0
  38. cloudpickle_rust-0.1.0/tests/mock_local_folder/mod.py +21 -0
  39. cloudpickle_rust-0.1.0/tests/mock_local_folder/subfolder/submod.py +13 -0
  40. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/class_with_type_hints.pkl +0 -0
  41. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/cloudpickle_version.txt +1 -0
  42. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/function_with_type_hints.pkl +0 -0
  43. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/nested_function.pkl +0 -0
  44. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/simple_class.pkl +0 -0
  45. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/simple_enum.pkl +0 -0
  46. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/simple_func.pkl +0 -0
  47. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_310/simple_module.pkl +0 -0
  48. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/class_with_type_hints.pkl +0 -0
  49. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/cloudpickle_version.txt +1 -0
  50. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/function_with_type_hints.pkl +0 -0
  51. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/nested_function.pkl +0 -0
  52. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/simple_class.pkl +0 -0
  53. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/simple_enum.pkl +0 -0
  54. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/simple_func.pkl +0 -0
  55. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_311/simple_module.pkl +0 -0
  56. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/class_with_type_hints.pkl +0 -0
  57. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/cloudpickle_version.txt +1 -0
  58. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/function_with_type_hints.pkl +0 -0
  59. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/nested_function.pkl +0 -0
  60. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/simple_class.pkl +0 -0
  61. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/simple_enum.pkl +0 -0
  62. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/simple_func.pkl +0 -0
  63. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_38/simple_module.pkl +0 -0
  64. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/class_with_type_hints.pkl +0 -0
  65. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/cloudpickle_version.txt +1 -0
  66. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/function_with_type_hints.pkl +0 -0
  67. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/nested_function.pkl +0 -0
  68. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/simple_class.pkl +0 -0
  69. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/simple_enum.pkl +0 -0
  70. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/simple_func.pkl +0 -0
  71. cloudpickle_rust-0.1.0/tests/old_pickles/cpython_39/simple_module.pkl +0 -0
  72. cloudpickle_rust-0.1.0/tests/test_backward_compat.py +95 -0
  73. cloudpickle_rust-0.1.0/tests/testutils.py +251 -0
  74. cloudpickle_rust-0.1.0/tox.ini +12 -0
@@ -0,0 +1,359 @@
1
+ name: Publish cloudpickle-rust 🥒🦀 distribution 📦 to PyPI
2
+ # Build the wheels of all the supported platforms and Python versions with
3
+ # maturin, test them, and publish them (with the source distribution) to PyPI
4
+ # when a tag is pushed, using the PYPI_TOKEN secret (a PyPI API token).
5
+
6
+ on:
7
+ push:
8
+ branches: [main, master]
9
+ tags: ['v*']
10
+ pull_request:
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ env:
17
+ # The interpreters are listed explicitly: maturin's --find-interpreter also
18
+ # selects interpreters which PyO3 0.28 cannot build for (e.g. PyPy 3.12).
19
+ #
20
+ # CPython 3.9 - 3.14 and 3.14t of the pypa manylinux images (CPython 3.8 is
21
+ # not shipped anymore by these images).
22
+ MANYLINUX_CPYTHON: >-
23
+ /opt/python/cp39-cp39/bin/python
24
+ /opt/python/cp310-cp310/bin/python
25
+ /opt/python/cp311-cp311/bin/python
26
+ /opt/python/cp312-cp312/bin/python
27
+ /opt/python/cp313-cp313/bin/python
28
+ /opt/python/cp314-cp314/bin/python
29
+ /opt/python/cp314-cp314t/bin/python
30
+ # Cross-compilation images: maturin uses its bundled sysconfig data. maturin
31
+ # only builds free-threaded wheels for Python 3.14 and later: on 3.13t (where
32
+ # free-threading is experimental), cloudpickle-rust is built from source.
33
+ CROSS_CPYTHON: python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 python3.14t
34
+ # PyPy 3.11 changed of ABI with PyPy 8.0: wheels are built for PyPy 7.3
35
+ # (pp73) and PyPy 8.0 (pp80).
36
+ PYPY_73_VERSION: pypy3.11.15
37
+ PYPY_80_VERSION: pypy3.11.17
38
+
39
+ jobs:
40
+ linux:
41
+ runs-on: ${{ matrix.platform.runner }}
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ platform:
46
+ # Native pypa images (the aarch64 one on an arm64 runner), in which
47
+ # CPython 3.8 and PyPy 8.0 are installed with uv.
48
+ - runner: ubuntu-22.04
49
+ target: x86_64
50
+ native: true
51
+ - runner: ubuntu-24.04-arm
52
+ target: aarch64
53
+ native: true
54
+ - runner: ubuntu-22.04
55
+ target: x86
56
+ native: false
57
+ pypa: true
58
+ - runner: ubuntu-22.04
59
+ target: armv7
60
+ native: false
61
+ - runner: ubuntu-22.04
62
+ target: s390x
63
+ native: false
64
+ - runner: ubuntu-22.04
65
+ target: ppc64le
66
+ native: false
67
+ steps:
68
+ - uses: actions/checkout@v6
69
+ with:
70
+ persist-credentials: false
71
+ - name: Build wheels (native manylinux2014 images)
72
+ if: ${{ matrix.platform.native }}
73
+ uses: PyO3/maturin-action@v1
74
+ with:
75
+ target: ${{ matrix.platform.target }}
76
+ manylinux: auto
77
+ before-script-linux: |
78
+ curl -LsSf https://astral.sh/uv/install.sh | sh
79
+ export PATH="$HOME/.local/bin:$PATH"
80
+ uv python install 3.8
81
+ mkdir -p /opt/uv-python
82
+ printf '#!/bin/sh\nexec "%s" "$@"\n' "$(uv python find --managed-python 3.8)" > /opt/uv-python/python3.8
83
+ chmod +x /opt/uv-python/python3.8
84
+ args: >-
85
+ --release --out dist -i
86
+ /opt/uv-python/python3.8
87
+ ${{ env.MANYLINUX_CPYTHON }}
88
+ /opt/python/pp311-pypy311_pp73/bin/python
89
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
90
+ - name: Build PyPy 8.0 wheels (native manylinux_2_28 images)
91
+ # The Linux builds of PyPy 8.0 require glibc 2.27 or later.
92
+ if: ${{ matrix.platform.native }}
93
+ uses: PyO3/maturin-action@v1
94
+ with:
95
+ target: ${{ matrix.platform.target }}
96
+ manylinux: "2_28"
97
+ before-script-linux: |
98
+ curl -LsSf https://astral.sh/uv/install.sh | sh
99
+ export PATH="$HOME/.local/bin:$PATH"
100
+ uv python install ${{ env.PYPY_80_VERSION }}
101
+ mkdir -p /opt/uv-python
102
+ printf '#!/bin/sh\nexec "%s" "$@"\n' "$(uv python find --managed-python ${{ env.PYPY_80_VERSION }})" > /opt/uv-python/pypy3.11-pp80
103
+ chmod +x /opt/uv-python/pypy3.11-pp80
104
+ args: --release --out dist -i /opt/uv-python/pypy3.11-pp80
105
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
106
+ - name: Build wheels (pypa i686 image)
107
+ if: ${{ matrix.platform.pypa }}
108
+ uses: PyO3/maturin-action@v1
109
+ with:
110
+ target: ${{ matrix.platform.target }}
111
+ manylinux: auto
112
+ args: --release --out dist -i ${{ env.MANYLINUX_CPYTHON }}
113
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
114
+ - name: Build wheels (cross-compilation images)
115
+ if: ${{ !matrix.platform.native && !matrix.platform.pypa }}
116
+ uses: PyO3/maturin-action@v1
117
+ with:
118
+ target: ${{ matrix.platform.target }}
119
+ manylinux: auto
120
+ args: --release --out dist -i ${{ env.CROSS_CPYTHON }}
121
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
122
+ - name: Upload wheels
123
+ uses: actions/upload-artifact@v6
124
+ with:
125
+ name: wheels-linux-${{ matrix.platform.target }}
126
+ path: dist
127
+
128
+ musllinux:
129
+ runs-on: ${{ matrix.platform.runner }}
130
+ strategy:
131
+ fail-fast: false
132
+ matrix:
133
+ platform:
134
+ - runner: ubuntu-22.04
135
+ target: x86_64
136
+ - runner: ubuntu-22.04
137
+ target: x86
138
+ - runner: ubuntu-22.04
139
+ target: aarch64
140
+ - runner: ubuntu-22.04
141
+ target: armv7
142
+ steps:
143
+ - uses: actions/checkout@v6
144
+ with:
145
+ persist-credentials: false
146
+ - name: Build wheels
147
+ uses: PyO3/maturin-action@v1
148
+ with:
149
+ target: ${{ matrix.platform.target }}
150
+ args: --release --out dist -i ${{ env.CROSS_CPYTHON }}
151
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
152
+ manylinux: musllinux_1_2
153
+ - name: Upload wheels
154
+ uses: actions/upload-artifact@v6
155
+ with:
156
+ name: wheels-musllinux-${{ matrix.platform.target }}
157
+ path: dist
158
+
159
+ windows:
160
+ runs-on: ${{ matrix.platform.runner }}
161
+ strategy:
162
+ fail-fast: false
163
+ matrix:
164
+ platform:
165
+ - runner: windows-latest
166
+ target: x64
167
+ python_arch: x64
168
+ python_versions: |
169
+ 3.8
170
+ 3.9
171
+ 3.10
172
+ 3.11
173
+ 3.12
174
+ 3.13
175
+ 3.14
176
+ free_threaded: true
177
+ - runner: windows-latest
178
+ target: x86
179
+ python_arch: x86
180
+ python_versions: |
181
+ 3.8
182
+ 3.9
183
+ 3.10
184
+ 3.11
185
+ 3.12
186
+ 3.13
187
+ 3.14
188
+ free_threaded: false
189
+ - runner: windows-11-arm
190
+ target: aarch64
191
+ python_arch: arm64
192
+ python_versions: |
193
+ 3.11
194
+ 3.12
195
+ 3.13
196
+ 3.14
197
+ free_threaded: true
198
+ steps:
199
+ - uses: actions/checkout@v6
200
+ with:
201
+ persist-credentials: false
202
+ - uses: actions/setup-python@v6
203
+ with:
204
+ python-version: ${{ matrix.platform.python_versions }}
205
+ architecture: ${{ matrix.platform.python_arch }}
206
+ - name: Build wheels
207
+ uses: PyO3/maturin-action@v1
208
+ with:
209
+ target: ${{ matrix.platform.target }}
210
+ # requires-python (< 3.15) restricts the interpreters found to the
211
+ # versions supported by PyO3 0.28.
212
+ args: --release --out dist --find-interpreter
213
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
214
+ - name: Set up free-threaded Python 3.14
215
+ if: ${{ matrix.platform.free_threaded }}
216
+ id: python314t
217
+ uses: actions/setup-python@v6
218
+ with:
219
+ python-version: 3.14t
220
+ architecture: ${{ matrix.platform.python_arch }}
221
+ - name: Build free-threaded wheels
222
+ if: ${{ matrix.platform.free_threaded }}
223
+ uses: PyO3/maturin-action@v1
224
+ with:
225
+ target: ${{ matrix.platform.target }}
226
+ args: --release --out dist -i ${{ steps.python314t.outputs.python-path }}
227
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
228
+ - name: Upload wheels
229
+ uses: actions/upload-artifact@v6
230
+ with:
231
+ name: wheels-windows-${{ matrix.platform.target }}
232
+ path: dist
233
+
234
+ macos:
235
+ runs-on: ${{ matrix.platform.runner }}
236
+ strategy:
237
+ fail-fast: false
238
+ matrix:
239
+ platform:
240
+ - runner: macos-15-intel
241
+ target: x86_64
242
+ - runner: macos-latest
243
+ target: aarch64
244
+ steps:
245
+ - uses: actions/checkout@v6
246
+ with:
247
+ persist-credentials: false
248
+ - uses: astral-sh/setup-uv@v7
249
+ - name: Install the Python interpreters
250
+ id: interpreters
251
+ shell: bash
252
+ # setup-python does not provide all the versions (e.g. CPython 3.8)
253
+ # on arm64 macOS runners: use uv's builds for all of them instead.
254
+ run: |
255
+ versions="3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.14t ${{ env.PYPY_73_VERSION }} ${{ env.PYPY_80_VERSION }}"
256
+ uv python install $versions
257
+ paths=""
258
+ for version in $versions; do
259
+ paths="$paths $(uv python find $version)"
260
+ done
261
+ echo "paths=$paths" >> "$GITHUB_OUTPUT"
262
+ - name: Build wheels
263
+ uses: PyO3/maturin-action@v1
264
+ with:
265
+ target: ${{ matrix.platform.target }}
266
+ args: --release --out dist -i ${{ steps.interpreters.outputs.paths }}
267
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
268
+ - name: Upload wheels
269
+ uses: actions/upload-artifact@v6
270
+ with:
271
+ name: wheels-macos-${{ matrix.platform.target }}
272
+ path: dist
273
+
274
+ sdist:
275
+ runs-on: ubuntu-latest
276
+ steps:
277
+ - uses: actions/checkout@v6
278
+ with:
279
+ persist-credentials: false
280
+ - name: Build sdist
281
+ uses: PyO3/maturin-action@v1
282
+ with:
283
+ command: sdist
284
+ args: --out dist
285
+ - name: Upload sdist
286
+ uses: actions/upload-artifact@v6
287
+ with:
288
+ name: wheels-sdist
289
+ path: dist
290
+
291
+ test-wheels:
292
+ name: Test the wheels (${{ matrix.os }}, Python ${{ matrix.python_version }})
293
+ needs: [linux, windows, macos]
294
+ runs-on: ${{ matrix.os }}
295
+ strategy:
296
+ fail-fast: false
297
+ matrix:
298
+ os: [ubuntu-latest, windows-latest, macos-latest]
299
+ python_version: ["3.8", "3.14", "3.14t"]
300
+ exclude:
301
+ - os: macos-latest
302
+ python_version: "3.8"
303
+ include:
304
+ # PyPy 8.0 (pp80 wheels)
305
+ - os: ubuntu-latest
306
+ python_version: "pypy-3.11"
307
+ steps:
308
+ - uses: actions/checkout@v6
309
+ with:
310
+ persist-credentials: false
311
+ - uses: actions/setup-python@v6
312
+ with:
313
+ python-version: ${{ matrix.python_version }}
314
+ - uses: actions/download-artifact@v7
315
+ with:
316
+ pattern: wheels-*
317
+ path: dist/
318
+ merge-multiple: true
319
+ - name: Install the wheel and the test dependencies
320
+ shell: bash
321
+ run: |
322
+ python -m pip install --upgrade pip
323
+ python -m pip install --only-binary=:all: --no-index --find-links dist cloudpickle-rust
324
+ python -m pip install -r dev-requirements.txt
325
+ - name: Run the test-suite against the installed wheel
326
+ shell: bash
327
+ run: |
328
+ PYTHONPATH='.:tests' python -m pytest -r s -vs
329
+
330
+ publish-to-pypi:
331
+ name: >-
332
+ Publish cloudpickle-rust 🥒🦀 distribution 📦 to PyPI
333
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
334
+ needs: [linux, musllinux, windows, macos, sdist, test-wheels]
335
+ runs-on: ubuntu-latest
336
+ environment:
337
+ name: pypi
338
+ url: https://pypi.org/p/cloudpickle-rust
339
+ permissions:
340
+ # For the GitHub artifact attestations (build provenance) of the dists.
341
+ id-token: write
342
+ attestations: write
343
+ steps:
344
+ - name: Download all the dists
345
+ uses: actions/download-artifact@v7
346
+ with:
347
+ pattern: wheels-*
348
+ path: dist/
349
+ merge-multiple: true
350
+ - name: Generate artifact attestation
351
+ uses: actions/attest@v4
352
+ with:
353
+ subject-path: 'dist/*'
354
+ - name: Publish distribution 📦 to PyPI
355
+ uses: pypa/gh-action-pypi-publish@release/v1
356
+ with:
357
+ password: ${{ secrets.PYPI_TOKEN }}
358
+ # PEP 740 attestations can only be uploaded with trusted publishing.
359
+ attestations: false
@@ -0,0 +1,81 @@
1
+ name: Automated Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v6
19
+ with:
20
+ python-version: 3.11
21
+ - name: Set up Rust
22
+ uses: dtolnay/rust-toolchain@stable
23
+ with:
24
+ components: rustfmt, clippy
25
+ - name: Install pre-commit
26
+ shell: bash
27
+ run: |
28
+ python -V
29
+ python -m pip install pre-commit
30
+ - name: Run pre-commit linters
31
+ shell: bash
32
+ run: |
33
+ pre-commit run --all-files
34
+ - name: Run clippy
35
+ run: cargo clippy --all-targets -- -D warnings
36
+
37
+ build:
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ os: [ubuntu-latest, windows-latest, macos-latest]
42
+ python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.13t", "3.14t", "pypy-3.11"]
43
+ exclude:
44
+ # Do not test all minor versions on all platforms, especially if they
45
+ # are not the oldest/newest supported versions
46
+ - os: windows-latest
47
+ python_version: 3.8
48
+ # as of 4/02/2020, psutil won't build under PyPy + Windows
49
+ - os: windows-latest
50
+ python_version: "pypy-3.11"
51
+ - os: macos-latest
52
+ python_version: 3.8
53
+ - os: macos-latest
54
+ # numpy triggers: RuntimeError: Polyfit sanity test emitted a
55
+ # warning
56
+ python_version: "pypy-3.11"
57
+
58
+ runs-on: ${{ matrix.os }}
59
+
60
+ steps:
61
+ - uses: actions/checkout@v6
62
+ - name: Set up Python ${{ matrix.python_version }}
63
+ uses: actions/setup-python@v6
64
+ with:
65
+ python-version: ${{ matrix.python_version }}
66
+ allow-prereleases: true
67
+ - name: Set up Rust
68
+ uses: dtolnay/rust-toolchain@stable
69
+ - name: Install project and dependencies
70
+ shell: bash
71
+ run: |
72
+ python -m pip install --upgrade pip
73
+ python -m pip install -e .
74
+ python -m pip install -r dev-requirements.txt
75
+ - name: Display Python version
76
+ shell: bash
77
+ run: python -c "import sys; print(sys.version)"
78
+ - name: Test with pytest
79
+ shell: bash
80
+ run: |
81
+ PYTHONPATH='.:tests' python -m pytest -r s -vs
@@ -0,0 +1,73 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # Rust build artifacts
6
+ /target/
7
+
8
+ # C extensions (including the extension module built by `maturin develop`)
9
+ *.so
10
+ *.pyd
11
+ *.dylib
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ env/
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # Virtual environments
33
+ .venv/
34
+ venv/
35
+
36
+ # PyInstaller
37
+ # Usually these files are written by a python script from a template
38
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
39
+ *.manifest
40
+ *.spec
41
+
42
+ # Installer logs
43
+ pip-log.txt
44
+ pip-delete-this-directory.txt
45
+
46
+ # Unit test / coverage reports
47
+ htmlcov/
48
+ .tox/
49
+ .coverage
50
+ .coverage/.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *,cover
55
+ .pytest_cache
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+
64
+ # Sphinx documentation
65
+ docs/_build/
66
+
67
+ # IPython
68
+ .ipynb_checkpoints
69
+ Untitled.ipynb
70
+
71
+ # Dev tools
72
+ .idea
73
+ .vscode
@@ -0,0 +1,27 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ - repo: https://github.com/psf/black
9
+ rev: 25.9.0
10
+ hooks:
11
+ - id: black
12
+ # Kept identical to the upstream cloudpickle test file (which is not
13
+ # formatted with black upstream either).
14
+ exclude: ^tests/cloudpickle_ipykernel_test\.py$
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.14.3
17
+ hooks:
18
+ - id: ruff
19
+ args: ["--fix", "--show-files"]
20
+ - repo: local
21
+ hooks:
22
+ - id: cargo-fmt
23
+ name: cargo fmt
24
+ entry: cargo fmt --all --
25
+ language: system
26
+ types: [rust]
27
+ pass_filenames: false
@@ -0,0 +1,35 @@
1
+ 0.1.0
2
+ =====
3
+
4
+ - Initial release: a Rust implementation (built with PyO3 and maturin) of
5
+ [cloudpickle](https://github.com/cloudpipe/cloudpickle) 3.2.0.dev0
6
+ (upstream commit `4af5936`, "MNT: account for removed opcode in Python 3.16
7
+ (#599)"), including the deterministic `co_filename` of dynamic code
8
+ ([PR#560](https://github.com/cloudpipe/cloudpickle/pull/560)).
9
+
10
+ - Same public and private API as `cloudpickle`, under the `cloudpickle_rust`
11
+ package: `cloudpickle_rust.cloudpickle` is the Rust extension module
12
+ equivalent to `cloudpickle/cloudpickle.py`.
13
+
14
+ - Payloads are identical to the ones of upstream cloudpickle (same pickle
15
+ opcodes and memoization), except for the module of the reconstructors
16
+ (`cloudpickle_rust.cloudpickle` instead of `cloudpickle.cloudpickle`).
17
+
18
+ - The upstream test-suite passes with exactly the same outcomes as upstream
19
+ cloudpickle on CPython 3.8 to 3.14 and free-threaded CPython 3.13t and
20
+ 3.14t.
21
+
22
+ - 1.4x to 1.7x faster than cloudpickle to pickle dynamic functions, classes
23
+ and their instances (see `benchmarks/bench.py`).
24
+
25
+ - Supports PyPy 3.11 (PyPy 7.3.20+ and 8.0), on which upstream cloudpickle
26
+ 3.1.2 / 3.2.0.dev0 cannot be used: it fails at import time because
27
+ `pickle.Pickler` became a native class without a `dispatch` attribute (and
28
+ its code objects reducer does not match the signature of `types.CodeType`
29
+ in PyPy 7.3, which differs from the one of CPython and PyPy 8).
30
+
31
+ - Supports free-threaded CPython builds without re-enabling the GIL.
32
+
33
+ - Licensed under the Apache License, Version 2.0. The code derived from
34
+ cloudpickle and the files copied from it keep their BSD 3-Clause license
35
+ notice (see `licenses/LICENSE-cloudpickle.txt` and `NOTICE`).