Skip to content

Commit 5dd2864

Browse files
authored
Merge pull request #563 from matplotlib/bugfix-561
Add support for Python 3.11
2 parents c560877 + bf27e41 commit 5dd2864

File tree

4 files changed

+47
-29
lines changed

4 files changed

+47
-29
lines changed

.github/workflows/basemap-for-manylinux.yml

+28-23
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
matrix:
3838
python-version:
39-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
39+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
4040
max-parallel: 3
4141
fail-fast: false
4242
needs: checkout
@@ -128,7 +128,7 @@ jobs:
128128
arch:
129129
["x64", "x86"]
130130
python-version:
131-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
131+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
132132
max-parallel: 3
133133
fail-fast: false
134134
needs: build-geos
@@ -158,18 +158,37 @@ jobs:
158158
case "${{ matrix.python-version }}" in
159159
2.6|3.[23]) pkgvers=1.11.3;;
160160
2.7|3.[456789]) pkgvers=1.16.6;;
161-
*) pkgvers=1.21.4;;
161+
3.10) pkgvers=1.21.4;;
162+
*) pkgvers=1.23.3;;
162163
esac
163-
pip install "numpy == ${pkgvers}"
164+
# Dirty solution to get NumPy headers for Python 3.11.
165+
if [ "${{ matrix.python-version }}" = "3.11" ]; then
166+
case "${{ matrix.arch }}" in
167+
x64) kwds="--plat=manylinux_2_17_x86_64" ;;
168+
x86) kwds="--plat=manylinux_2_17_i686" ;;
169+
esac
170+
pip download --no-deps ${kwds} "numpy==${pkgvers}"
171+
oldpkgfile=$(ls *.whl | head -n1)
172+
newpkgfile=$(echo "${oldpkgfile}" | sed 's/manylinux_2_17/linux/')
173+
mv "${oldpkgfile}" "${newpkgfile}"
174+
pip install "${newpkgfile}"
175+
rm "${newpkgfile}"
176+
else
177+
pip install "numpy == ${pkgvers}"
178+
fi
164179
-
165180
name: Build wheel
166181
run: |
167182
sitepkgdir=$(pip show numpy 2>/dev/null | grep Location: | cut -d' ' -f2)
168183
export GEOS_DIR="${GITHUB_WORKSPACE}/${{ env.PKGDIR }}/extern"
169184
export NUMPY_INCLUDE_PATH=${sitepkgdir}/numpy/core/include
185+
if [ "${{ matrix.python-version }}" = "3.11" ]; then
186+
kwds="--no-build-isolation"
187+
pip install setuptools wheel "cython >= 0.29, < 3.1"
188+
fi
170189
cd ${{ env.PKGDIR }}
171190
python setup.py sdist
172-
pip wheel -w dist --no-deps dist/*.zip
191+
pip wheel -w dist --no-deps ${kwds} dist/*.zip
173192
-
174193
name: Upload build artifacts
175194
uses: actions/upload-artifact@v1
@@ -183,7 +202,7 @@ jobs:
183202
arch:
184203
["x64", "x86"]
185204
python-version:
186-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
205+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
187206
max-parallel: 3
188207
fail-fast: false
189208
needs: build
@@ -203,18 +222,11 @@ jobs:
203222
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
204223
path: ${{ env.PKGDIR }}/dist
205224
-
206-
name: Install unzip
225+
name: Install auditwheel
207226
run: |
208227
apt-get update
209228
apt-get install -y unzip
210-
-
211-
name: Install patchelf
212-
run: |
213229
pip install patchelf
214-
alias patchelf="python -m patchelf"
215-
-
216-
name: Install auditwheel
217-
run: |
218230
pip install "auditwheel < 4.0"
219231
-
220232
name: Repair wheel
@@ -235,7 +247,7 @@ jobs:
235247
arch:
236248
["x64", "x86"]
237249
python-version:
238-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
250+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
239251
max-parallel: 3
240252
fail-fast: false
241253
needs: repair
@@ -254,13 +266,6 @@ jobs:
254266
with:
255267
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
256268
path: ${{ env.PKGDIR }}/dist
257-
-
258-
name: Install matplotlib dependencies
259-
run: |
260-
apt-get update
261-
apt-get install -y gcc g++ make
262-
apt-get install -y pkg-config libfreetype6-dev libpng12-dev
263-
if: matrix.arch == 'x86' && matrix.python-version == '3.5'
264269
-
265270
name: Install numpy from source
266271
run: |
@@ -284,7 +289,7 @@ jobs:
284289
arch:
285290
["x64", "x86"]
286291
python-version:
287-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
292+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
288293
max-parallel: 1
289294
if: startsWith(github.event.ref, 'refs/tags/v')
290295
needs: test

.github/workflows/basemap-for-windows.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
matrix:
3838
python-version:
39-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
39+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
4040
max-parallel: 3
4141
fail-fast: false
4242
needs: checkout
@@ -137,7 +137,7 @@ jobs:
137137
arch:
138138
["x64", "x86"]
139139
python-version:
140-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
140+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
141141
max-parallel: 3
142142
fail-fast: false
143143
needs: build-geos
@@ -179,7 +179,8 @@ jobs:
179179
Switch -regex ("${{ matrix.python-version }}") {
180180
"^2\.6|3\.[123]$" { Set-Variable -Name "pkgvers" -Value "1.11.3" }
181181
"^2\.7|3\.[456789]$" { Set-Variable -Name "pkgvers" -Value "1.16.6" }
182-
default { Set-Variable -Name "pkgvers" -Value "1.21.4" }
182+
"^3\.10$" { Set-Variable -Name "pkgvers" -Value "1.21.4" }
183+
default { Set-Variable -Name "pkgvers" -Value "1.23.3" }
183184
}
184185
$env:SETUPTOOLS_USE_DISTUTILS = "stdlib"
185186
python -m pip install "numpy == ${pkgvers}"
@@ -210,7 +211,7 @@ jobs:
210211
arch:
211212
["x64", "x86"]
212213
python-version:
213-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
214+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
214215
max-parallel: 3
215216
fail-fast: false
216217
needs: build
@@ -232,19 +233,23 @@ jobs:
232233
name: Install package
233234
run: |
234235
pip install --prefer-binary (Get-Item ${{ env.PKGDIR }}/dist/*-win*.whl)
236+
# We need to skip Py311 x86 because of missing pyproj wheels.
237+
if: matrix.arch != 'x86' || matrix.python-version != '3.11'
235238
-
236239
name: Test package
237240
run: |
238241
python -c "from mpl_toolkits.basemap import Basemap"
239242
python -c "from mpl_toolkits.basemap import cm"
243+
# We need to skip Py311 x86 because of missing pyproj wheels.
244+
if: matrix.arch != 'x86' || matrix.python-version != '3.11'
240245

241246
upload:
242247
strategy:
243248
matrix:
244249
arch:
245250
["x64", "x86"]
246251
python-version:
247-
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
252+
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
248253
max-parallel: 1
249254
if: startsWith(github.event.ref, 'refs/tags/v')
250255
needs: test

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ https://semver.org/spec/v2.0.0.html
1212

1313
## [1.3.6]
1414

15+
### Added
16+
- Support for Python 3.11 (PR [#563], solves issue [#561]).
17+
1518
### Changed
1619
- Upgrade `matplotlib` upper pin to 3.7.
1720
- Upgrade `pyproj` upper pin to 3.5.
@@ -940,6 +943,10 @@ https://semver.org/spec/v2.0.0.html
940943
- Fix glitches in drawing of parallels and meridians.
941944

942945

946+
[#563]:
947+
https://github.com/matplotlib/basemap/pull/563
948+
[#561]:
949+
https://github.com/matplotlib/basemap/issues/561
943950
[#560]:
944951
https://github.com/matplotlib/basemap/pull/560
945952
[#559]:

packages/basemap/pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
requires = [
33
'setuptools',
44
'wheel',
5-
'numpy == 1.21.4; python_version >= "3.10"',
5+
'numpy == 1.23.3; python_version >= "3.11"',
6+
'numpy == 1.21.4; python_version == "3.10"',
67
'numpy == 1.21.4; sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")',
78
'numpy == 1.16.6; sys_platform != "darwin" and (python_version >= "3.7" and python_version <= "3.9")',
89
'numpy == 1.16.6; python_version == "2.7" or (python_version >= "3.4" and python_version <= "3.6")',

0 commit comments

Comments
 (0)