Skip to content
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

Add support for Python 3.11 #563

Merged
merged 10 commits into from
Oct 31, 2022
51 changes: 28 additions & 23 deletions .github/workflows/basemap-for-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -158,18 +158,37 @@ 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;;
3.10) pkgvers=1.21.4;;
*) pkgvers=1.23.3;;
esac
pip install "numpy == ${pkgvers}"
# 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" ;;
esac
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
-
name: Build wheel
run: |
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
Expand All @@ -183,7 +202,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
Expand All @@ -203,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
Expand All @@ -235,7 +247,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
Expand All @@ -254,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: |
Expand All @@ -284,7 +289,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
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/basemap-for-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.4" }
"^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}"
Expand Down Expand Up @@ -210,7 +211,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
Expand All @@ -232,19 +233,23 @@ 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:
matrix:
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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]:
Expand Down
3 changes: 2 additions & 1 deletion packages/basemap/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
requires = [
'setuptools',
'wheel',
'numpy == 1.21.4; python_version >= "3.10"',
'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")',
Expand Down