Skip to content

Commit 32b8692

Browse files
Merge pull request #2 from DataLab-Platform/chore/drop-python39
chore: require Python 3.10 or newer
2 parents 5d639ed + c59455a commit 32b8692

10 files changed

Lines changed: 95 additions & 50 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ["3.9", "3.13"]
23+
python-version: ["3.10", "3.13", "3.14"]
2424

2525
steps:
2626
- uses: actions/checkout@v7

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ DataLab-Kernel uses **xeus-python** as its backend, which provides:
185185

186186
The kernel requires:
187187

188+
- Python 3.10 or later
188189
- `xeus-python>=0.17.0` - The xeus-based Python kernel
189190
- `xeus-python-shell>=0.6.0` - Python shell utilities for xeus-python
190191
- `sigima>=1.0` - Scientific signal and image processing

‎datalab_kernel/kernel.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
from __future__ import annotations
1919

20+
import sys
21+
2022
from datalab_kernel import __version__
2123

2224
# Kernel metadata (used by kernel spec and for identification)
@@ -25,11 +27,11 @@
2527
KERNEL_IMPLEMENTATION = "datalab-kernel"
2628
KERNEL_IMPLEMENTATION_VERSION = __version__
2729
KERNEL_LANGUAGE = "python"
28-
KERNEL_LANGUAGE_VERSION = "3.9"
30+
KERNEL_LANGUAGE_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
2931

3032
KERNEL_LANGUAGE_INFO = {
3133
"name": "python",
32-
"version": "3.9",
34+
"version": KERNEL_LANGUAGE_VERSION,
3335
"mimetype": "text/x-python",
3436
"codemirror_mode": {"name": "ipython", "version": 3},
3537
"pygments_lexer": "ipython3",
@@ -79,8 +81,6 @@ def launch_kernel():
7981
8082
It launches xeus-python with the DataLab startup configuration.
8183
"""
82-
import sys
83-
8484
# Import and launch xeus-python
8585
try:
8686
# xeus-python provides an extension module for launching

‎datalab_kernel/matplotlib_backend.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _add_table_results_to_axes(
157157

158158
# Format each row (typically just one row for statistics)
159159
for row in data:
160-
for header, value in zip(headers, row):
160+
for header, value in zip(headers, row, strict=False):
161161
# Format numeric values
162162
if isinstance(value, float):
163163
if abs(value) < 0.001 or abs(value) >= 10000:
@@ -184,7 +184,7 @@ def _add_table_results_to_axes(
184184
coords = (
185185
geometry.coords[0] if geometry.coords.ndim > 1 else geometry.coords
186186
)
187-
for label, value in zip(coord_labels, coords):
187+
for label, value in zip(coord_labels, coords, strict=False):
188188
if isinstance(value, float):
189189
if abs(value) < 0.001 or abs(value) >= 10000:
190190
formatted = f"{value:.3g}"
@@ -1187,7 +1187,7 @@ def _render_to_png(self) -> bytes:
11871187
all_geo_results: list = []
11881188

11891189
for idx, (ax, img, img_title, result) in enumerate(
1190-
zip(axes_flat, self._objs, titles, results_list)
1190+
zip(axes_flat, self._objs, titles, results_list, strict=False)
11911191
):
11921192
obj_type = type(img).__name__
11931193

‎datalab_kernel/plotly_backend.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def _build_annotation_text(
244244
lines.append(f"<b>{table.title}:</b>")
245245
headers = list(table.headers)
246246
for row in table.data:
247-
for header, value in zip(headers, row):
247+
for header, value in zip(headers, row, strict=False):
248248
if isinstance(value, float):
249249
formatted = (
250250
f"{value:.3g}"
@@ -264,7 +264,7 @@ def _build_annotation_text(
264264
coords = (
265265
geometry.coords[0] if geometry.coords.ndim > 1 else geometry.coords
266266
)
267-
for lbl, val in zip(coord_labels, coords):
267+
for lbl, val in zip(coord_labels, coords, strict=False):
268268
if isinstance(val, float):
269269
formatted = (
270270
f"{val:.3g}"
@@ -474,7 +474,11 @@ def _add_image_roi_shapes(
474474
# Close the polygon
475475
xs = list(points[:, 0]) + [points[0, 0]]
476476
ys = list(points[:, 1]) + [points[0, 1]]
477-
path = "M " + " L ".join(f"{x},{y}" for x, y in zip(xs, ys)) + " Z"
477+
path = (
478+
"M "
479+
+ " L ".join(f"{x},{y}" for x, y in zip(xs, ys, strict=False))
480+
+ " Z"
481+
)
478482
fig.add_shape(
479483
type="path",
480484
path=path,
@@ -1014,7 +1018,7 @@ def _build_signal_figure(self) -> go.Figure:
10141018
# Build interleaved arrays: (x, baseline) -> (x, y) -> None gap
10151019
xs: list = []
10161020
ys: list = []
1017-
for xi, yi in zip(x, y):
1021+
for xi, yi in zip(x, y, strict=False):
10181022
xs.extend([xi, xi, None])
10191023
ys.extend([baseline, yi, None])
10201024
fig.add_trace(
@@ -1431,7 +1435,7 @@ def _build_figure(self) -> go.Figure:
14311435
baseline = float(obj.get_metadata_option("baseline"))
14321436
xs: list = []
14331437
ys: list = []
1434-
for xi, yi in zip(x, y):
1438+
for xi, yi in zip(x, y, strict=False):
14351439
xs.extend([xi, xi, None])
14361440
ys.extend([baseline, yi, None])
14371441
fig.add_trace(
@@ -1770,7 +1774,9 @@ def _build_figure(self) -> go.Figure:
17701774
all_tbl_results: list = []
17711775
all_geo_results: list = []
17721776

1773-
for idx, (img, result) in enumerate(zip(self._objs, results_list)):
1777+
for idx, (img, result) in enumerate(
1778+
zip(self._objs, results_list, strict=False)
1779+
):
17741780
row = idx // ncols + 1
17751781
col = idx % ncols + 1
17761782

‎datalab_kernel/tests/unit/test_kernel.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import annotations
1313

1414
import json
15+
import sys
1516

1617
import pytest
1718

@@ -76,13 +77,17 @@ def test_kernel_metadata_exists(self):
7677
KERNEL_IMPLEMENTATION,
7778
KERNEL_LANGUAGE,
7879
KERNEL_LANGUAGE_INFO,
80+
KERNEL_LANGUAGE_VERSION,
7981
)
8082

8183
assert KERNEL_IMPLEMENTATION == "datalab-kernel"
8284
assert KERNEL_LANGUAGE == "python"
8385
assert KERNEL_DISPLAY_NAME == "DataLab"
8486
assert "xeus-python" in KERNEL_BANNER
8587
assert isinstance(KERNEL_LANGUAGE_INFO, dict)
88+
expected_version = f"{sys.version_info.major}.{sys.version_info.minor}"
89+
assert expected_version == KERNEL_LANGUAGE_VERSION
90+
assert KERNEL_LANGUAGE_INFO["version"] == KERNEL_LANGUAGE_VERSION
8691
assert isinstance(KERNEL_HELP_LINKS, list)
8792

8893
def test_get_kernel_info_function(self):
@@ -99,6 +104,9 @@ def test_get_kernel_info_function(self):
99104
assert "help_links" in info
100105

101106
assert info["implementation"] == "datalab-kernel"
107+
assert info["language_info"]["version"] == (
108+
f"{sys.version_info.major}.{sys.version_info.minor}"
109+
)
102110

103111

104112
class TestStartupModule:

‎doc/release_notes/release_0.02.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Version 0.2 #
22

3+
## Unreleased ##
4+
5+
* Python 3.10 or later is now required. Python 3.9 users must keep an earlier compatible release.
6+
* Kernel language information now reports the Python version actually running the kernel, rather than always announcing Python 3.9.
7+
38
## DataLab-Kernel Version 0.2.11 (2026-02-15) ##
49

510
### 🛠️ Bug Fixes since version 0.2.10 ###

‎doc/requirements.rst‎

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The ``datalab-kernel`` package requires the following Python modules:
1+
The `datalab-kernel` package requires the following Python modules:
22

33
.. list-table::
44
:header-rows: 1
@@ -8,28 +8,31 @@ The ``datalab-kernel`` package requires the following Python modules:
88
- Version
99
- Summary
1010
* - Python
11-
- >=3.9
11+
- >=3.10
1212
- Python programming language
13-
* - ipykernel
14-
- >= 6.0
15-
- IPython Kernel for Jupyter
16-
* - jupyter-client
17-
- >= 7.0
18-
- Jupyter protocol client APIs
19-
* - NumPy
20-
- >= 1.22
13+
* - xeus-python
14+
- >=0.17.0
15+
- A wheel for xeus-python
16+
* - xeus-python-shell
17+
- >=0.6.0
18+
- The xeus-python core python logic.
19+
* - numpy
20+
- >=1.22
2121
- Fundamental package for array computing in Python
22+
* - httpx
23+
- >=0.25.0
24+
- The next generation HTTP client.
2225
* - h5py
23-
- >= 3.0
26+
- >=3.0
2427
- Read and write HDF5 files from Python
2528
* - matplotlib
26-
- >= 3.5
29+
- >=3.5
2730
- Python plotting package
28-
* - Sigima
29-
- >= 1.0
30-
- Scientific signal and image processing library
31+
* - sigima
32+
- >=1.0
33+
- Scientific computing engine for 1D signals and 2D images, part of the DataLab open-source platform.
3134

32-
Optional modules for DataLab integration:
35+
Optional modules for development:
3336

3437
.. list-table::
3538
:header-rows: 1
@@ -38,11 +41,17 @@ Optional modules for DataLab integration:
3841
* - Name
3942
- Version
4043
- Summary
41-
* - datalab-platform
42-
- >= 1.0
43-
- DataLab - Scientific Data Analysis Platform
44+
* - pytest
45+
- >=7.0
46+
- pytest: simple powerful testing with Python
47+
* - pytest-cov
48+
- >=4.0
49+
- Pytest plugin for measuring coverage.
50+
* - ruff
51+
- >=0.1.0
52+
- An extremely fast Python linter and code formatter, written in Rust.
4453

45-
Development dependencies:
54+
Optional modules for building the documentation:
4655

4756
.. list-table::
4857
:header-rows: 1
@@ -51,12 +60,18 @@ Development dependencies:
5160
* - Name
5261
- Version
5362
- Summary
54-
* - pytest
55-
- >= 7.0
56-
- Python testing framework
57-
* - pytest-cov
58-
- >= 4.0
59-
- Pytest coverage plugin
60-
* - ruff
61-
- >= 0.1.0
62-
- Fast Python linter and formatter
63+
* - sphinx
64+
- >=7.0
65+
- Python documentation generator
66+
* - pydata-sphinx-theme
67+
- >=0.14
68+
- Bootstrap-based Sphinx theme from the PyData community
69+
* - myst-nb
70+
- >=1.0
71+
- A Jupyter Notebook Sphinx reader built on top of the MyST markdown parser.
72+
* - sphinx-design
73+
- >=0.5
74+
- A sphinx extension for designing beautiful, view size responsive web components.
75+
* - sphinx-copybutton
76+
- >=0.5
77+
- Add a copy button to each of your code cells.

‎pyproject.toml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers = [
1717
"License :: OSI Approved :: BSD License",
1818
"Operating System :: OS Independent",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
2322
"Programming Language :: Python :: 3.12",
@@ -26,7 +25,7 @@ classifiers = [
2625
"Topic :: Scientific/Engineering",
2726
]
2827
keywords = ["jupyter", "kernel", "datalab", "scientific", "data processing", "xeus"]
29-
requires-python = ">=3.9"
28+
requires-python = ">=3.10"
3029
dependencies = [
3130
"xeus-python>=0.17.0",
3231
"xeus-python-shell>=0.6.0",
@@ -90,7 +89,7 @@ markers = [
9089

9190
[tool.ruff]
9291
line-length = 88
93-
target-version = "py39"
92+
target-version = "py310"
9493

9594
[tool.ruff.lint]
9695
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"]

‎requirements.txt‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
xeus-python>=0.17.0
2-
xeus-python-shell>=0.6.0
3-
numpy>=1.22
4-
httpx>=0.25.0
1+
datalab-platform>=1.1
52
h5py>=3.0
3+
httpx>=0.25.0
4+
jupyter-client>=7.0
65
matplotlib>=3.5
6+
myst-nb>=1.0
7+
numpy>=1.22
8+
plotly>=5.0
9+
pydata-sphinx-theme>=0.14
10+
pytest-cov>=4.0
11+
pytest>=7.0
12+
ruff>=0.1.0
713
sigima>=1.0
14+
sphinx-copybutton>=0.5
15+
sphinx-design>=0.5
16+
sphinx>=7.0
17+
xeus-python-shell>=0.6.0
18+
xeus-python>=0.17.0

0 commit comments

Comments
 (0)