Skip to content

Update Python and numpy to current versions (Python 3.13, latest numpy) #482

Description

@rly

Summary

The setup instructions and CI default to Python 3.10, and pyproject.toml pins numpy==1.26.0. Python 3.10 reaches end of life in October 2026, after which it receives no further security fixes, and numpy==1.26.0 predates Python 3.13 entirely (it declares requires-python <3.13). The scientific Python ecosystem has also moved on: following SPEC 0, the latest releases of core packages now require Python >=3.11 (numpy 2.4, scipy 1.17, pandas 3.0, scikit-learn 1.9). This issue proposes updating both the documented Python version (to 3.13) and numpy (to the latest release), along with the associated dependency changes that requires.

Where 3.10 is referenced

Setup/install instructions pin Python 3.10 in:

  • README.md (Use Python 3.10; uv sync --frozen --extra dev --python 3.10)
  • docs/intro.md (uv, pip-only, and conda create -n databook_env python=3.10)
  • docs/contribution.md
  • docs/FAQ.md

CI also defaults to 3.10:

  • .github/workflows/test.yml and .github/workflows/build.yml set up Python 3.10 and run uv sync ... --python 3.10.
  • .github/workflows/test_env.yml matrix is ['3.10', '3.11', '3.12'].

Proposed change

Update Python to 3.13 in the documented setup steps (e.g. uv sync --frozen --extra dev --python 3.13, conda create -n databook_env python=3.13), make 3.13 the default in the test.yml/build.yml workflows, and update the test_env.yml matrix to drop 3.10 and add 3.13 (e.g. ['3.11', '3.12', '3.13']).

Bump numpy to the latest release (currently 2.4, which requires Python >=3.11), and make whatever associated dependency changes that requires (see below).

Associated dependency changes

numpy==1.26.0 cannot be installed on Python 3.13 at all, and staying on numpy 1.x is not an option: the last 1.x release (1.26.4) has no Python 3.13 wheels (max cp312). Moving to the latest numpy (2.x) is an ABI/API break, so several other pins in pyproject.toml must move with it. The list below is from auditing each exact == pin for (a) whether the pinned version installs on Python 3.13 and (b) whether it declares a numpy<2 cap. Floating (>=) dependencies such as pandas, scikit-learn, and h5py are not listed because the resolver will select numpy-2-compatible versions for them automatically.

Must bump (will not install on 3.13 and/or cap numpy<2)

  • numpy==1.26.0 -> latest numpy (2.4.x).
  • scipy==1.13.1 -> latest scipy 1.x (e.g. 1.17.x). The pinned version has no cp313 wheel and caps numpy<2.3.
  • numcodecs==0.11.0 -> numcodecs==0.13.1 (per the separate numcodecs pin issue; it ships cp310–cp313 wheels).
  • elephant==1.1.1 -> elephant==1.2.1. The pinned version caps numpy<2; cp313 wheels start at 1.2.0.
  • statsmodels==0.14.0 -> statsmodels==0.14.6. The pinned version has no cp313 wheel; numpy 2 support landed in 0.14.2 and cp313 wheels in 0.14.3.
  • markupsafe==2.0.1 -> markupsafe==3.0.x (pinned in both dependencies and the dev extra). The pinned version has no cp313 wheel. Caution: 2.0.1 predates markupsafe 2.1, which removed soft_unicode; confirm nothing in the stack still imports it before bumping.

Recommended (installs on 3.13 as pure Python, but the pinned version predates numpy 2 runtime support)

  • quantities==0.14.1 -> quantities==0.16.4. numpy 2 support was added in 0.15.0.
  • neo==0.13.0 -> latest neo 0.14.x (numpy 2 fixes).

Needs hands-on verification (no drop-in bump available)

  • ssm (git fork) and ophys-nway-matching (git) both build native/Cython code against numpy; verify they build and run under numpy 2 / Python 3.13, updating the forks if needed.

Already compatible (no change needed)

autograd==1.7, pillow==11, scikit-image==0.25.2, torch==2.5.1, and suite2p==0.14 install on 3.13 and support numpy 2, as do the pure-Python utilities in the pin set.

tensortools==0.4 is the latest release (from 2020) and is pure Python (no compiled extensions), so the missing cp313 wheel is not a problem. It was verified directly: it installs and imports on Python 3.13 with numpy 2.4.6, scipy 1.17.1, and numba 0.65.1, and its cp_als, ncp_hals, and ncp_bcd decompositions run without numpy deprecation errors (only a cosmetic numba performance warning). Its one deprecated call (np.row_stack, in the shifted-CP path) still functions in numpy 2.x; no change is needed now, though a future numpy that removes row_stack would require a small patch.

Note that pyproject.toml already declares requires-python = ">=3.10,<3.14", which advertises 3.13 support that the numpy==1.26.0 pin currently contradicts.

This audit is from PyPI metadata (wheel tags and declared numpy bounds), which proves installability and declared caps but not runtime numpy 2 compatibility. After the bumps, regenerate uv.lock and requirements-ci.txt and run the notebooks to confirm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions