Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BLD: Add Python 3.11 builds to CI #23637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

matthewfeickert
Copy link
Contributor

@matthewfeickert matthewfeickert commented Aug 16, 2022

PR Summary

With cibuildwheel v2.9.0, CPython 3.11 wheels are now built (by default) and as NumPy now has CPython 3.11 wheels out as of NumPy v1.23.2, matplotlib can build CPython 3.11 wheels (though as of 2022-08-16 contourpy does not have 3.11 wheels yet).

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • [N/A] Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@matthewfeickert
Copy link
Contributor Author

matthewfeickert commented Aug 16, 2022

The 3.11 builds are slow at the moment (on my fork to see that here will need the "Run cibuildwheel" label added) (and so maybe this shouldn't be merged yet?) given that both contourpy and kiwisolver

matplotlib/setup.py

Lines 307 to 311 in 276436a

install_requires=[
"contourpy>=1.0.1",
"cycler>=0.10",
"fonttools>=4.22.0",
"kiwisolver>=1.0.1",

are not pure-Python and so have wheels that need to be built and neither of them have Python 3.11 wheels out as of 2022-08-16 (though they are both in a good position for their next release given contourpy/contourpy#151 and nucleic/kiwi#153).

edit: I take that back! I wrote this commit last night and in that time kiwisolver v1.4.4 has added Python 3.11 wheels! 🚀

With cibuildwheel v2.9.0, CPython 3.11 wheels are now built
(by default) and as NumPy now has CPython 3.11 wheels out as of
NumPy v1.23.2, matplotlib can build CPython 3.11 wheels (though as
of 2022-08-16 contourpy does not have 3.11 wheels yet).
   - c.f. https://github.com/pypa/cibuildwheel/releases/tag/v2.9.0
@matthewfeickert matthewfeickert force-pushed the ci/add-python-3.11-wheels branch from fa76b6e to 84e82a2 Compare August 16, 2022 16:08
@oscargus oscargus added the CI: Run cibuildwheel Run wheel building tests on a PR label Aug 16, 2022
@ianthomas23
Copy link
Member

Note that lack of contourpy wheels for CPython 3.11 isn't a problem at all. contourpy builds and passes tests on the 3 major platforms without any problems. You'll have to build contourpy from source but

time pip install --no-binary contourpy contourpy

in a clean venv takes 25 seconds on my dev machine, and less than 18 seconds if contourpy sdist and numpy wheel have already been cached. This is significantly less time than it takes to build matplotlib.

@matthewfeickert
Copy link
Contributor Author

matthewfeickert commented Aug 16, 2022

Note that lack of contourpy wheels for CPython 3.11 isn't a problem at all. contourpy builds and passes tests on the 3 major platforms without any problems. You'll have to build contourpy from source but

time pip install --no-binary contourpy contourpy

in a clean venv takes 25 seconds on my dev machine, and less than 18 seconds if contourpy sdist and numpy wheel have already been cached. This is significantly less time than it takes to build matplotlib.

Yup, you're very right and I was just coming back here after testing this myself to comment a similar thing.

$ docker run --rm -ti python:3.11.0rc1-bullseye /bin/bash
root@5b71d1f2c405:/# python -m venv venv && . venv/bin/activate
(venv) root@5b71d1f2c405:/# python -m pip --quiet install --upgrade pip setuptools wheel
(venv) root@5b71d1f2c405:/# time python -m pip install --no-binary contourpy contourpy
Collecting contourpy
  Downloading contourpy-1.0.4.tar.gz (12.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.2/12.2 MB 22.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy>=1.16
  Downloading numpy-1.23.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.0/17.0 MB 21.6 MB/s eta 0:00:00
Building wheels for collected packages: contourpy
  Building wheel for contourpy (pyproject.toml) ... done
  Created wheel for contourpy: filename=contourpy-1.0.4-cp311-cp311-linux_x86_64.whl size=254190 sha256=aec204ffc9cef62f736cc0469dcc842636571c6b7dcd9c8a95a85d1f044b4741
  Stored in directory: /root/.cache/pip/wheels/52/10/34/903aecdade518daec5468b58437fb4e2a85b22a9c7b19c82f7
Successfully built contourpy
Installing collected packages: numpy, contourpy
Successfully installed contourpy-1.0.4 numpy-1.23.2

real	0m13.112s
user	0m41.278s
sys	0m1.843s
(venv) root@5b71d1f2c405:/# time python -m pip install --no-binary kiwisolver kiwisolver
Collecting kiwisolver
  Downloading kiwisolver-1.4.4.tar.gz (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.1/97.1 kB 7.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: kiwisolver
  Building wheel for kiwisolver (pyproject.toml) ... done
  Created wheel for kiwisolver: filename=kiwisolver-1.4.4-cp311-cp311-linux_x86_64.whl size=1414328 sha256=ca7ac0512764ba62b79b9a21e939056fb12d1b5a0613e517e8dc2881db46951b
  Stored in directory: /root/.cache/pip/wheels/84/c8/da/eeada8f730a7ebb3492827ae6ea103997d42430e4766201d8e
Successfully built kiwisolver
Installing collected packages: kiwisolver
Successfully installed kiwisolver-1.4.4

real	0m12.259s
user	0m11.049s
sys	0m0.770s
(venv) root@5b71d1f2c405:/#

So I guess the build for matplotlib itself is just slower at the moment, and maybe looking at the macOS wheel build times was a bad idea as they seem slow in general.

@tacaswell tacaswell added this to the v3.6.0 milestone Aug 16, 2022
@oscargus oscargus merged commit 9f5c041 into matplotlib:main Aug 16, 2022
@tacaswell
Copy link
Member

Thanks @matthewfeickert ! I must have miss-read the release notes on the cibuildwheel update as I thought we were already doing this :/

@matthewfeickert matthewfeickert deleted the ci/add-python-3.11-wheels branch August 16, 2022 19:11
@matthewfeickert
Copy link
Contributor Author

I must have miss-read the release notes on the cibuildwheel update as I thought we were already doing this :/

I think we both did, as I had just seen the release note comment

CPython 3.11 wheels are now built by default - without the CIBW_PRERELEASE_PYTHONS flag. It's time to build and upload these wheels to PyPI! This release includes CPython 3.11.0rc1, which is guaranteed to be ABI compatible with the final release.

and (unreasonably) assumed that things would be extra magically taken care of somehow. Then I noticed that there weren't cp311 nightly wheels and realized after looking at matplotlib's GHA workflows that as all of the build jobs specify CIBW_BUILD

- name: Build wheels for CPython 3.10
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp310-*"

that there is never a default and so this needed to get added. This all makes sense to me from a workflow pattern as you want to ensure that you're building the wheels you think you are and so explicitly stating them seems good to my mind. 👍

@oscargus
Copy link
Member

Should this be backported to 3.5.3? To enable 3.11 wheels? For example, #23645.

(I do not know how the release build-process works...)

@tacaswell
Copy link
Member

I'm inclined not, we have historically not gone back and rebuilt wheels after the fact. If we do 3.5.4 we should re-consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Run cibuildwheel Run wheel building tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants