Skip to content

Commit b57cb2c

Browse files
phofljrbourbeau
andauthored
Add support for Python 3.13 (#8904)
Co-authored-by: James Bourbeau <[email protected]>
1 parent 0d905d5 commit b57cb2c

File tree

8 files changed

+75
-7
lines changed

8 files changed

+75
-7
lines changed

.github/workflows/tests.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
os: [ubuntu-latest, windows-latest, macos-latest]
29-
environment: [mindeps, "3.10", "3.11", "3.12"]
29+
environment: [mindeps, "3.10", "3.11", "3.12", "3.13"]
3030
label: [default]
3131
extra_packages: [null]
3232
# Cherry-pick test modules to split the overall runtime roughly in half
@@ -40,6 +40,8 @@ jobs:
4040
environment: "3.10"
4141
- os: macos-latest
4242
environment: "3.11"
43+
- os: macos-latest
44+
environment: "3.13"
4345

4446
- os: windows-latest
4547
environment: mindeps
@@ -242,7 +244,7 @@ jobs:
242244
set -o pipefail
243245
mkdir reports
244246
245-
pytest distributed \
247+
python -m pytest distributed \
246248
-m "not avoid_ci and ${{ matrix.partition }}" --runslow \
247249
--leaks=fds,processes,threads \
248250
--junitxml reports/pytest.xml -o junit_suite_name=$TEST_ID \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: dask-distributed-313
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python=3.13
6+
- packaging
7+
- pip
8+
- asyncssh
9+
- bokeh>3
10+
- click
11+
- cloudpickle
12+
- coverage
13+
- dask # overridden by git tip below
14+
- filesystem-spec # overridden by git tip below
15+
- gilknocker
16+
- h5py
17+
- ipykernel
18+
- ipywidgets
19+
- jinja2
20+
- jupyter-server-proxy
21+
- jupyterlab
22+
- locket
23+
- msgpack-python
24+
- netcdf4
25+
- paramiko
26+
- pre-commit
27+
- prometheus_client
28+
- psutil
29+
- pyarrow
30+
- pytest
31+
- pytest-cov
32+
- pytest-faulthandler
33+
- pytest-repeat
34+
- pytest-rerunfailures
35+
- pytest-timeout
36+
- requests
37+
- s3fs # overridden by git tip below
38+
- scikit-learn
39+
- scipy
40+
- sortedcollections
41+
- tblib
42+
- toolz
43+
# - tornado # Using pip below until 6.4.2 is on conda-forge
44+
- zict # overridden by git tip below
45+
- zstandard
46+
# Temporary fix for https://github.com/pypa/setuptools/issues/4496
47+
- setuptools < 71
48+
- pip:
49+
- git+https://github.com/dask/dask
50+
- git+https://github.com/dask/dask-expr
51+
- git+https://github.com/dask/zict
52+
# Revert after https://github.com/dask/distributed/issues/8614 is fixed
53+
# - git+https://github.com/dask/s3fs
54+
# - git+https://github.com/fsspec/filesystem_spec
55+
- keras
56+
- tornado>=6.4.2

distributed/dashboard/tests/test_scheduler_bokeh.py

+1
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ async def test_https_support(c, s, a, b):
11441144

11451145
ctx = ssl.create_default_context()
11461146
ctx.load_verify_locations(get_cert("tls-ca-cert.pem"))
1147+
ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT
11471148

11481149
http_client = AsyncHTTPClient()
11491150
response = await http_client.fetch(

distributed/security.py

+2
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def _get_tls_context(self, tls, purpose):
326326
# IP addresses rather than hostnames
327327
ctx.check_hostname = False
328328

329+
ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT
330+
329331
if tls.get("ciphers"):
330332
ctx.set_ciphers(tls.get("ciphers"))
331333

distributed/tests/test_client.py

+4
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,10 @@ async def test_upload_file_no_extension(c, s, a, b):
17041704
await c.upload_file(fn)
17051705

17061706

1707+
@pytest.mark.skipif(
1708+
sys.version_info >= (3, 13),
1709+
reason="Upstream issue in CPython. See https://github.com/dask/distributed/issues/8708 and https://github.com/python/cpython/issues/121342.",
1710+
)
17071711
@gen_cluster(client=True)
17081712
async def test_upload_file_zip(c, s, a, b):
17091713
def g():

distributed/tests/test_metrics.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pytest
99

1010
from distributed import metrics
11-
from distributed.compatibility import WINDOWS
1211
from distributed.utils import offload
1312
from distributed.utils_test import gen_test
1413

@@ -30,7 +29,8 @@ def test_wall_clock(name):
3029

3130
@pytest.mark.slow
3231
@pytest.mark.skipif(
33-
not WINDOWS, reason="WindowsTime doesn't work with high accuracy base timer"
32+
not isinstance(metrics.time, metrics._WindowsTime),
33+
reason="WindowsTime doesn't work with high accuracy base timer",
3434
)
3535
def test_monotonic():
3636
t = metrics._WindowsTime(time.monotonic, is_monotonic=True, resync_every=0.1).time

distributed/utils_test.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
)
5555
from distributed.deploy import SpecCluster
5656
from distributed.diagnostics.plugin import WorkerPlugin
57-
from distributed.metrics import context_meter, time
57+
from distributed.metrics import _WindowsTime, context_meter, time
5858
from distributed.nanny import Nanny
5959
from distributed.node import ServerNode
6060
from distributed.proctitle import enable_proctitle_on_children
@@ -1541,6 +1541,7 @@ def get_server_ssl_context(
15411541
ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH, cafile=get_cert(ca_file))
15421542
ctx.check_hostname = False
15431543
ctx.verify_mode = ssl.CERT_REQUIRED
1544+
ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT
15441545
ctx.load_cert_chain(get_cert(certfile), get_cert(keyfile))
15451546
return ctx
15461547

@@ -1551,6 +1552,7 @@ def get_client_ssl_context(
15511552
ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=get_cert(ca_file))
15521553
ctx.check_hostname = False
15531554
ctx.verify_mode = ssl.CERT_REQUIRED
1555+
ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT
15541556
ctx.load_cert_chain(get_cert(certfile), get_cert(keyfile))
15551557
return ctx
15561558

@@ -2605,14 +2607,14 @@ def no_time_resync():
26052607
"""Temporarily disable the automatic resync of distributed.metrics._WindowsTime
26062608
which, every 10 minutes, can cause time() to go backwards a few milliseconds.
26072609
2608-
On Linux and MacOSX, this fixture is a no-op.
2610+
On Linux, MacOSX, and Windows with Python 3.13+ this fixture is a no-op.
26092611
26102612
See also
26112613
--------
26122614
NoSchedulerDelayWorker
26132615
padded_time
26142616
"""
2615-
if WINDOWS:
2617+
if isinstance(time, _WindowsTime):
26162618
time() # Initialize or refresh delta
26172619
bak = time.__self__.next_resync
26182620
time.__self__.next_resync = float("inf")

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers = [
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
2223
"Topic :: Scientific/Engineering",
2324
"Topic :: System :: Distributed Computing",
2425
]

0 commit comments

Comments
 (0)