Skip to content

Commit c6f8cd4

Browse files
ogriselhugovk
andauthored
Official support for python 3.12 and code clean-up after EOLed Python 3.6 and 3.7. (#517)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 45dcb75 commit c6f8cd4

File tree

69 files changed

+1021
-1565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1021
-1565
lines changed

.github/scripts/flake8_diff.sh

Lines changed: 0 additions & 95 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,34 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v1
13+
- uses: actions/checkout@v4
1414
- name: Set up Python 3.11
15-
uses: actions/setup-python@v1
15+
uses: actions/setup-python@v4
1616
with:
1717
python-version: 3.11
18-
- name: Install flake8
18+
- name: Install ruff
1919
shell: bash
2020
run: |
2121
python -V
22-
python -m pip install "flake8<6.0.0"
23-
# XXX: flake8 --diff is deprecated, broken and was removed
24-
# in flake8 6.0.0: we should instead black-ify the full repo
25-
# and run a full flake8 check at each PR.
26-
- name: Run flake8 on diff with upstream/master
22+
python -m pip install ruff
23+
- name: Run ruff
2724
shell: bash
2825
run: |
29-
bash ./.github/scripts/flake8_diff.sh
26+
ruff .
3027
3128
build:
3229
strategy:
3330
matrix:
3431
os: [ubuntu-latest, windows-latest, macos-latest]
35-
# TODO: add "3.12-dev" to the list
36-
python_version: [3.7, 3.8, 3.9, "3.10", "3.11", "pypy-3.9"]
32+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9"]
3733
exclude:
3834
# Do not test all minor versions on all platforms, especially if they
3935
# are not the oldest/newest supported versions
40-
- os: windows-latest
41-
python_version: 3.7
4236
- os: windows-latest
4337
python_version: 3.8
4438
# as of 4/02/2020, psutil won't build under PyPy + Windows
4539
- os: windows-latest
4640
python_version: "pypy-3.9"
47-
- os: macos-latest
48-
python_version: 3.7
4941
- os: macos-latest
5042
python_version: 3.8
5143
- os: macos-latest
@@ -56,11 +48,12 @@ jobs:
5648
runs-on: ${{ matrix.os }}
5749

5850
steps:
59-
- uses: actions/checkout@v1
51+
- uses: actions/checkout@v4
6052
- name: Set up Python ${{ matrix.python_version }}
61-
uses: actions/setup-python@v2
53+
uses: actions/setup-python@v4
6254
with:
6355
python-version: ${{ matrix.python_version }}
56+
allow-prereleases: true
6457
- name: Install project and dependencies
6558
shell: bash
6659
run: |
@@ -72,11 +65,6 @@ jobs:
7265
- name: Display Python version
7366
shell: bash
7467
run: python -c "import sys; print(sys.version)"
75-
- name: Look for syntax errors/undefined names
76-
shell: bash
77-
run: |
78-
python -m flake8 . --count --verbose --select=E901,E999,F821,F822,F823 \
79-
--show-source --statistics
8068
- name: Test with pytest
8169
shell: bash
8270
run: |
@@ -85,7 +73,7 @@ jobs:
8573
coverage combine --append
8674
coverage xml -i
8775
- name: Publish coverage results
88-
uses: codecov/codecov-action@v1
76+
uses: codecov/codecov-action@v3
8977
with:
9078
token: ${{ secrets.CODECOV_TOKEN }}
9179
file: ./coverage.xml
@@ -101,9 +89,9 @@ jobs:
10189
matrix:
10290
python_version: ["3.10"]
10391
steps:
104-
- uses: actions/checkout@v1
92+
- uses: actions/checkout@v4
10593
- name: Set up Python
106-
uses: actions/setup-python@v1
94+
uses: actions/setup-python@v4
10795
with:
10896
python-version: ${{ matrix.python_version }}
10997
- name: Install project and dependencies
@@ -119,9 +107,11 @@ jobs:
119107
# FIXME ipv6-related failures on Ubuntu github actions CI
120108
# https://github.com/dask/distributed/issues/4514
121109
export DISABLE_IPV6=1
122-
# test_decide_worker_coschedule_order_neighbors is skipped because of:
123-
# https://github.com/dask/distributed/issues/8255
124-
export PYTEST_ADDOPTS=("-m" "not avoid_ci" "-k" "not test_decide_worker_coschedule_order_neighbors")
110+
# - test_decide_worker_coschedule_order_neighbors is skipped because of:
111+
# https://github.com/dask/distributed/issues/8255
112+
# - test_client_worker is skipped because it's a time-related test that
113+
# randomly fails on CI but seems unrelated to cloudpickle.
114+
export PYTEST_ADDOPTS=("-m" "not avoid_ci" "-k" "not test_decide_worker_coschedule_order_neighbors and not test_client_worker")
125115
source ./.github/scripts/test_downstream_project.sh
126116
127117
joblib-downstream-build:
@@ -135,9 +125,9 @@ jobs:
135125
matrix:
136126
python_version: ["3.10"]
137127
steps:
138-
- uses: actions/checkout@v1
128+
- uses: actions/checkout@v4
139129
- name: Set up Python
140-
uses: actions/setup-python@v1
130+
uses: actions/setup-python@v4
141131
with:
142132
python-version: ${{ matrix.python_version }}
143133
- name: Install project and dependencies
@@ -163,9 +153,9 @@ jobs:
163153
matrix:
164154
python_version: ["3.10"]
165155
steps:
166-
- uses: actions/checkout@v1
156+
- uses: actions/checkout@v4
167157
- name: Set up Python
168-
uses: actions/setup-python@v1
158+
uses: actions/setup-python@v4
169159
with:
170160
python-version: ${{ matrix.python_version }}
171161
- name: Install downstream project and dependencies
@@ -188,9 +178,9 @@ jobs:
188178
matrix:
189179
python_version: ["3.11"]
190180
steps:
191-
- uses: actions/checkout@v1
181+
- uses: actions/checkout@v4
192182
- name: Set up Python
193-
uses: actions/setup-python@v1
183+
uses: actions/setup-python@v4
194184
with:
195185
python-version: ${{ matrix.python_version }}
196186
- name: Install project and tests dependencies
@@ -204,7 +194,7 @@ jobs:
204194
run: |
205195
RAY_PACKAGE_DIR=$(python -c "import os, ray; print(os.path.dirname(ray.__file__), flush=True)")
206196
cp cloudpickle/cloudpickle.py $RAY_PACKAGE_DIR/cloudpickle/cloudpickle.py
207-
cp cloudpickle/compat.py $RAY_PACKAGE_DIR/cloudpickle/compat.py
197+
rm -rf $RAY_PACKAGE_DIR/cloudpickle/compat.py
208198
cp cloudpickle/cloudpickle_fast.py $RAY_PACKAGE_DIR/cloudpickle/cloudpickle_fast.py
209199
- name: Fetch the Ray test suite from github
210200
run: |

CHANGES.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
2.3.0 (development)
1+
3.0.0 (development)
22
===================
33

4+
- Officially support Python 3.12 and drop support for Python 3.6 and 3.7.
5+
Dropping support for older Python versions made it possible to simplify the
6+
code base signficantly, hopefully making it easier to contribute to and
7+
maintain the project.
8+
([PR #515](https://github.com/cloudpipe/cloudpickle/pull/515))
9+
410
- Fix pickling of dataclasses and their instances.
511
([issue #386](https://github.com/cloudpipe/cloudpickle/issues/386),
612
[PR #513](https://github.com/cloudpipe/cloudpickle/pull/513))

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ that pickles such constructs **by value**.
8484
Another case where the importability assumption is expected to break is when
8585
developing a module in a distributed execution environment: the worker
8686
processes may not have access to the said module, for example if they live on a
87-
different machine than the process in which the module is being developed.
88-
By itself, `cloudpickle` cannot detect such "locally importable" modules and
89-
switch to serialization by value; instead, it relies on its default mode,
90-
which is serialization by reference. However, since `cloudpickle 2.0.0`, one
91-
can explicitly specify modules for which serialization by value should be used,
92-
using the `register_pickle_by_value(module)`/`/unregister_pickle(module)` API:
87+
different machine than the process in which the module is being developed. By
88+
itself, `cloudpickle` cannot detect such "locally importable" modules and
89+
switch to serialization by value; instead, it relies on its default mode, which
90+
is serialization by reference. However, since `cloudpickle 2.0.0`, one can
91+
explicitly specify modules for which serialization by value should be used,
92+
using the
93+
`register_pickle_by_value(module)`/`/unregister_pickle_by_value(module)` API:
9394

9495
```python
9596
>>> import cloudpickle
@@ -130,14 +131,14 @@ Running the tests
130131

131132
or alternatively for a specific environment:
132133

133-
tox -e py37
134+
tox -e py312
134135

135136

136-
- With `py.test` to only run the tests for your current version of
137+
- With `pytest` to only run the tests for your current version of
137138
Python:
138139

139140
pip install -r dev-requirements.txt
140-
PYTHONPATH='.:tests' py.test
141+
PYTHONPATH='.:tests' pytest
141142

142143
History
143144
-------

ci/install_coverage_subprocess_pth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os.path as op
66
from sysconfig import get_path
77

8-
FILE_CONTENT = u"""\
8+
FILE_CONTENT = """\
99
import coverage; coverage.process_startup()
1010
"""
1111

cloudpickle/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
from cloudpickle.cloudpickle import * # noqa
2-
from cloudpickle.cloudpickle_fast import CloudPickler, dumps, dump # noqa
32

4-
# Conform to the convention used by python serialization libraries, which
5-
# expose their Pickler subclass at top-level under the "Pickler" name.
6-
Pickler = CloudPickler
3+
__version__ = "3.0.0.dev0"
74

8-
__version__ = '2.3.0.dev0'
5+
__all__ = [ # noqa
6+
"__version__",
7+
"Pickler",
8+
"CloudPickler",
9+
"dumps",
10+
"loads",
11+
"dump",
12+
"load",
13+
"register_pickle_by_value",
14+
"unregister_pickle_by_value",
15+
]

0 commit comments

Comments
 (0)