From 704f52069c66a1265ba02ba18b1a511f71c1af95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sat, 29 Oct 2022 12:29:25 +0200 Subject: [PATCH 01/10] Downgrade numpy build requirement from 1.21.4 to 1.21.1 In principle, it is possible to use NumPy up to version 1.21.4 when building for Python >= 3.7, but the problem is that NumPy versions from 1.21.2 to 1.21.6 add an explicit upper pin '<3.11' which prevents `basemap` from being built successfully with the recently released Python 3.11. Since the goal here is to build the wheels with an old-enough NumPy, we try here by downgrading NumPy at the build stage from 1.21.4 to 1.21.1, since NumPy 1.21.1 did not have this '<3.11'. Note that we cannot go below NumPy 1.21.0 because then the MacOS builds will fail due to a NumPy build bug. --- .github/workflows/basemap-for-manylinux.yml | 2 +- .github/workflows/basemap-for-windows.yml | 2 +- packages/basemap/pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index c7e0d83f9..2b6be4d70 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -158,7 +158,7 @@ jobs: case "${{ matrix.python-version }}" in 2.6|3.[23]) pkgvers=1.11.3;; 2.7|3.[456789]) pkgvers=1.16.6;; - *) pkgvers=1.21.4;; + *) pkgvers=1.21.1;; esac pip install "numpy == ${pkgvers}" - diff --git a/.github/workflows/basemap-for-windows.yml b/.github/workflows/basemap-for-windows.yml index d9e68ce25..c8fdd18b0 100644 --- a/.github/workflows/basemap-for-windows.yml +++ b/.github/workflows/basemap-for-windows.yml @@ -179,7 +179,7 @@ jobs: Switch -regex ("${{ matrix.python-version }}") { "^2\.6|3\.[123]$" { Set-Variable -Name "pkgvers" -Value "1.11.3" } "^2\.7|3\.[456789]$" { Set-Variable -Name "pkgvers" -Value "1.16.6" } - default { Set-Variable -Name "pkgvers" -Value "1.21.4" } + default { Set-Variable -Name "pkgvers" -Value "1.21.1" } } $env:SETUPTOOLS_USE_DISTUTILS = "stdlib" python -m pip install "numpy == ${pkgvers}" diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index f9a33dfc0..d4194b6db 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -2,8 +2,8 @@ requires = [ 'setuptools', 'wheel', - 'numpy == 1.21.4; python_version >= "3.10"', - 'numpy == 1.21.4; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")', + 'numpy == 1.21.1; python_version >= "3.10"', + 'numpy == 1.21.1; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")', 'numpy == 1.16.6; sys_platform != "darwin" and (python_version >= "3.7" and python_version <= "3.9")', 'numpy == 1.16.6; python_version == "2.7" or (python_version >= "3.4" and python_version <= "3.6")', 'numpy == 1.11.3; python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")', From 12d93a589a6dd2fab896a18af9de4a7895dd96f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sat, 29 Oct 2022 15:28:55 +0200 Subject: [PATCH 02/10] Add Python 3.11 to basemap-for-windows workflow --- .github/workflows/basemap-for-windows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/basemap-for-windows.yml b/.github/workflows/basemap-for-windows.yml index c8fdd18b0..92038463c 100644 --- a/.github/workflows/basemap-for-windows.yml +++ b/.github/workflows/basemap-for-windows.yml @@ -36,7 +36,7 @@ jobs: strategy: matrix: python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: checkout @@ -137,7 +137,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: build-geos @@ -210,7 +210,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: build @@ -244,7 +244,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 1 if: startsWith(github.event.ref, 'refs/tags/v') needs: test From 65fbaae9648f9a827feb7a7739adf9abd49ce132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sat, 29 Oct 2022 16:10:02 +0200 Subject: [PATCH 03/10] Revert numpy downgrade and set to 1.23.3 for Python 3.11 --- .github/workflows/basemap-for-manylinux.yml | 3 ++- .github/workflows/basemap-for-windows.yml | 3 ++- packages/basemap/pyproject.toml | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index 2b6be4d70..9e7d897c8 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -158,7 +158,8 @@ jobs: case "${{ matrix.python-version }}" in 2.6|3.[23]) pkgvers=1.11.3;; 2.7|3.[456789]) pkgvers=1.16.6;; - *) pkgvers=1.21.1;; + 3.10) pkgvers=1.21.4;; + *) pkgvers=1.23.3;; esac pip install "numpy == ${pkgvers}" - diff --git a/.github/workflows/basemap-for-windows.yml b/.github/workflows/basemap-for-windows.yml index 92038463c..e64251b48 100644 --- a/.github/workflows/basemap-for-windows.yml +++ b/.github/workflows/basemap-for-windows.yml @@ -179,7 +179,8 @@ jobs: Switch -regex ("${{ matrix.python-version }}") { "^2\.6|3\.[123]$" { Set-Variable -Name "pkgvers" -Value "1.11.3" } "^2\.7|3\.[456789]$" { Set-Variable -Name "pkgvers" -Value "1.16.6" } - default { Set-Variable -Name "pkgvers" -Value "1.21.1" } + "^3\.10$" { Set-Variable -Name "pkgvers" -Value "1.21.4" } + default { Set-Variable -Name "pkgvers" -Value "1.23.3" } } $env:SETUPTOOLS_USE_DISTUTILS = "stdlib" python -m pip install "numpy == ${pkgvers}" diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index d4194b6db..26e78d87a 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -2,8 +2,9 @@ requires = [ 'setuptools', 'wheel', - 'numpy == 1.21.1; python_version >= "3.10"', - 'numpy == 1.21.1; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")', + 'numpy == 1.23.3; python_version >= "3.11"', + 'numpy == 1.21.4; python_version == "3.10"', + 'numpy == 1.21.4; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")', 'numpy == 1.16.6; sys_platform != "darwin" and (python_version >= "3.7" and python_version <= "3.9")', 'numpy == 1.16.6; python_version == "2.7" or (python_version >= "3.4" and python_version <= "3.6")', 'numpy == 1.11.3; python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")', From e4eb2003e1127e61e8b19cdfd3fc80dca5f8ddd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sat, 29 Oct 2022 18:45:08 +0200 Subject: [PATCH 04/10] Skip tests for py311-win32 due to missing pyproj wheel --- .github/workflows/basemap-for-windows.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/basemap-for-windows.yml b/.github/workflows/basemap-for-windows.yml index e64251b48..6107dea94 100644 --- a/.github/workflows/basemap-for-windows.yml +++ b/.github/workflows/basemap-for-windows.yml @@ -233,11 +233,15 @@ jobs: name: Install package run: | pip install --prefer-binary (Get-Item ${{ env.PKGDIR }}/dist/*-win*.whl) + # We need to skip Py311 x86 because of missing pyproj wheels. + if: matrix.arch != 'x86' || matrix.python-version != '3.11' - name: Test package run: | python -c "from mpl_toolkits.basemap import Basemap" python -c "from mpl_toolkits.basemap import cm" + # We need to skip Py311 x86 because of missing pyproj wheels. + if: matrix.arch != 'x86' || matrix.python-version != '3.11' upload: strategy: From 20e9cc650ebe82ec2e1c3a2165dcaffd9feab799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sat, 29 Oct 2022 23:20:11 +0200 Subject: [PATCH 05/10] Add Python 3.11 to basemap-for-manylinux workflow --- .github/workflows/basemap-for-manylinux.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index 9e7d897c8..c6e5f4f44 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -36,7 +36,7 @@ jobs: strategy: matrix: python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: checkout @@ -128,7 +128,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: build-geos @@ -184,7 +184,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: build @@ -236,7 +236,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 3 fail-fast: false needs: repair @@ -285,7 +285,7 @@ jobs: arch: ["x64", "x86"] python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] max-parallel: 1 if: startsWith(github.event.ref, 'refs/tags/v') needs: test From 3b83cd3d26084eaaef1810eda732868c4aad8942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sun, 30 Oct 2022 18:52:22 +0100 Subject: [PATCH 06/10] Add workaround to get NumPy headers for Python 3.11 --- .github/workflows/basemap-for-manylinux.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index c6e5f4f44..ac9ea164b 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -161,6 +161,19 @@ jobs: 3.10) pkgvers=1.21.4;; *) pkgvers=1.23.3;; esac + if [ "${pkgvers}" = "1.23.3" ]; then + # Dirty solution to get NumPy headers for Python 3.11. + case "${{ matrix.arch }}" in + x64) kwds="--plat=manylinux_2_17_x86_64" ;; + x86) kwds="--plat=manylinux_2_17_i686" ;; + esac + pip download --no-deps ${kwds} "numpy==1.23.3" + oldpkgfile=$(ls *.whl | head -n1) + newpkgfile=$(echo "${oldpkgfile}" | sed 's/manylinux_2_17/linux/') + mv "${oldpkgfile}" "${newpkgfile}" + pip install "${newpkgfile}" + rm "${newpkgfile}" + fi pip install "numpy == ${pkgvers}" - name: Build wheel @@ -168,9 +181,13 @@ jobs: sitepkgdir=$(pip show numpy 2>/dev/null | grep Location: | cut -d' ' -f2) export GEOS_DIR="${GITHUB_WORKSPACE}/${{ env.PKGDIR }}/extern" export NUMPY_INCLUDE_PATH=${sitepkgdir}/numpy/core/include + if [ "${{ matrix.python-version }}" = "3.11" ]; then + kwds="--no-build-isolation" + pip install setuptools wheel "cython >= 0.29, < 3.1" + fi cd ${{ env.PKGDIR }} python setup.py sdist - pip wheel -w dist --no-deps dist/*.zip + pip wheel -w dist --no-deps ${kwds} dist/*.zip - name: Upload build artifacts uses: actions/upload-artifact@v1 From 06379307583e4b1c95bb46c8a976ffe661cb3e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sun, 30 Oct 2022 22:48:22 +0100 Subject: [PATCH 07/10] Refactor Py311 special blocks in basemap-for-manylinux --- .github/workflows/basemap-for-manylinux.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index ac9ea164b..36f4d66ca 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -161,20 +161,21 @@ jobs: 3.10) pkgvers=1.21.4;; *) pkgvers=1.23.3;; esac - if [ "${pkgvers}" = "1.23.3" ]; then - # Dirty solution to get NumPy headers for Python 3.11. + # Dirty solution to get NumPy headers for Python 3.11. + if [ "${{ matrix.python-version }}" = "3.11" ]; then case "${{ matrix.arch }}" in - x64) kwds="--plat=manylinux_2_17_x86_64" ;; - x86) kwds="--plat=manylinux_2_17_i686" ;; + x64) kwds="--plat=manylinux_2_17_x86_64" ;; + x86) kwds="--plat=manylinux_2_17_i686" ;; esac - pip download --no-deps ${kwds} "numpy==1.23.3" + pip download --no-deps ${kwds} "numpy==${pkgvers}" oldpkgfile=$(ls *.whl | head -n1) newpkgfile=$(echo "${oldpkgfile}" | sed 's/manylinux_2_17/linux/') mv "${oldpkgfile}" "${newpkgfile}" pip install "${newpkgfile}" rm "${newpkgfile}" + else + pip install "numpy == ${pkgvers}" fi - pip install "numpy == ${pkgvers}" - name: Build wheel run: | From 7fcada1a722180c65e15a977f02dccb9210bfb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sun, 30 Oct 2022 23:25:04 +0100 Subject: [PATCH 08/10] Join unzip/patchelf/auditwheel steps in basemap-for-manylinux --- .github/workflows/basemap-for-manylinux.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index 36f4d66ca..954bc7069 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -222,18 +222,11 @@ jobs: name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} path: ${{ env.PKGDIR }}/dist - - name: Install unzip + name: Install auditwheel run: | apt-get update apt-get install -y unzip - - - name: Install patchelf - run: | pip install patchelf - alias patchelf="python -m patchelf" - - - name: Install auditwheel - run: | pip install "auditwheel < 4.0" - name: Repair wheel From 2dbc76e0c1e396b589c99db55bc6893e42749ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Sun, 30 Oct 2022 23:32:22 +0100 Subject: [PATCH 09/10] Remove matplotlib sdist installation step --- .github/workflows/basemap-for-manylinux.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml index 954bc7069..c6c0bba86 100644 --- a/.github/workflows/basemap-for-manylinux.yml +++ b/.github/workflows/basemap-for-manylinux.yml @@ -266,13 +266,6 @@ jobs: with: name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} path: ${{ env.PKGDIR }}/dist - - - name: Install matplotlib dependencies - run: | - apt-get update - apt-get install -y gcc g++ make - apt-get install -y pkg-config libfreetype6-dev libpng12-dev - if: matrix.arch == 'x86' && matrix.python-version == '3.5' - name: Install numpy from source run: | From bf27e41132cbabfe659d89efa9bd4920d463bd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Mon, 31 Oct 2022 08:04:23 +0100 Subject: [PATCH 10/10] Update CHANGELOG --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d01577549..064df3ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ https://semver.org/spec/v2.0.0.html ## [1.3.6] +### Added +- Support for Python 3.11 (PR [#563], solves issue [#561]). + ### Changed - Upgrade `matplotlib` upper pin to 3.7. - Upgrade `pyproj` upper pin to 3.5. @@ -940,6 +943,10 @@ https://semver.org/spec/v2.0.0.html - Fix glitches in drawing of parallels and meridians. +[#563]: +https://github.com/matplotlib/basemap/pull/563 +[#561]: +https://github.com/matplotlib/basemap/issues/561 [#560]: https://github.com/matplotlib/basemap/pull/560 [#559]: