Skip to content

Support new Python version

Erik Welch edited this page Apr 8, 2023 · 2 revisions

Adding support for a new version of Python typically happens in two stages:

  1. without numba
  2. with numba

Numba is expected to take 3-6 months to support a new major Python release (for example, numba didn't support Python 3.11 until six months after its release!). Since numba is now an optional dependency (#423), we should try to support a new Python version shortly after numpy, scipy, and pandas support it.

If old (>24 months as per our support policy) versions of dependencies give any difficulty, consider removing support for them.

pyproject.toml

  • Add "py31x" to [tool.black.target-version]
  • Add "Programming Language :: Python :: 3.1x", to [project.classifiers]
  • New Python versions often come with new DeprecationWarnings and FutureWarnings. Update these in [tool.pytest.ini_options.filterwarnings] as necessary.
  • When numba is supported, update python_version in the numba-related dependencies in [project.optional-dependencies]
    • For example, "python-graphblas[numba]; python_version<'3.12'"

.github/workflows/imports.yml

  • Add 3.1x option to random pyver (and 1 as weight).
    • This also tests whether pip install python-graphblas[default] works.
    • Consider using a large weight during testing to test the new Python version

.github/workflows/test_and_build.yml

  • Add 3.1x option to random pyver (and 1 as weight)
    • Consider using a large weight during testing to test the new Python version
  • Determine which versions of numpy, scipy, pandas, and awkward support this Python version and randomly choose from them in "Update env" step.
    • This can be done by looking at wheels on PyPI and/or download files on anaconda.org to see which Python versions have builds.
  • If necessary, handle other dependency versions that cause issues during testing (hopefully unlikely)
  • When numba is supported, update the if check under "Update env" that checks Python version and randomly chooses to not install numba.

Wrap it up

Then test the changes in a PR and viola! That's it!

As a sanity check, I would recommend searching for the previous and new Python versions to make sure the new version has been added everywhere appropriate:

  • $ git grep 3\.11
  • $ git grep py311

Update Python version in binder/environment.yml and docs/env.yml whenever.

Finally, be aware of any other changes in Python that may impact python-graphblas and whether some features can be enabled in old Python versions via from __future__ import whatever.

Clone this wiki locally