From d67603eceaee568c0974ad7a1000fe566b6485f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 21:19:29 +0100 Subject: [PATCH 1/8] Update CHANGELOG --- CHANGELOG.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 353ffba0..6031e398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,15 +13,17 @@ https://semver.org/spec/v2.0.0.html ## [Unreleased] ### Added -- Support for Python 3.13 (PR [#619], solves issue [#608]). -- Support for NumPy 2.0 (PR [#614] by @cvanelteren, solves issue - [#604]). +- Python 3.13 support (PR [#619], solves issue [#608]). +- NumPy 2.0 support (PR [#614] by @cvanelteren, solves issue [#604]). +- Automated wheels for x86_64 and arm64 (PR [#620] by @cvanelteren, + solves issue [#608]). ### Changed - **BREAKING CHANGE**: Set Python minimum supported version to 3.9. - **BREAKING CHANGE**: Migrate `basemap` libraries to use implicit namespace packages (PR [#576] by @ksunden). -- Migrate workflows to use `cibuildwheel` (PR [#614] by @cvanelteren). +- Migrate workflows to use `cibuildwheel` (PRs [#614] and [#618] by + @cvanelteren, solves sunset of v1 of GitHub artifact actions). - Update library dependencies: - Upgrade upper limit for `basemap_data` to 3.0. - Upgrade lower limit for `packaging` to 20.5. @@ -1154,8 +1156,12 @@ https://semver.org/spec/v2.0.0.html - Fix glitches in drawing of parallels and meridians. +[#620]: +https://github.com/matplotlib/basemap/pull/620 [#619]: https://github.com/matplotlib/basemap/pull/619 +[#618]: +https://github.com/matplotlib/basemap/pull/618 [#615]: https://github.com/matplotlib/basemap/pull/615 [#614]: From b82fb80be1e8c80564a198e71062cc6b586c4d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 21:40:42 +0100 Subject: [PATCH 2/8] Set image versions explicitly in workflow --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1f43644..0c533120 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: package: [basemap_data, basemap_data_hires] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -49,7 +49,7 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest + - os: ubuntu-22.04 arch: x86_64 before_all: >- echo "Starting BEFORE_ALL script" && @@ -70,7 +70,7 @@ jobs: echo "GEOS_DIR set to: ${GEOS_DIR}" && cd "{package}" && python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)" - - os: windows-latest + - os: windows-2019 arch: x86_64 before_all: >- echo Starting BEFORE_ALL script && @@ -87,7 +87,7 @@ jobs: python-version: "3.9" - name: Build sdist - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-22.04' run: | cd packages/basemap python -m pip install build @@ -125,7 +125,7 @@ jobs: check: name: Check packages needs: [build_data, build_basemap] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v4 with: @@ -147,7 +147,7 @@ jobs: upload: name: Upload packages needs: [build_data, build_basemap, check] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/download-artifact@v4 From 3ecaec6c679a46fe58be79f93e6b3fa1959e51ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 21:58:36 +0100 Subject: [PATCH 3/8] Add Python script for cibuildwheel before_all block --- .github/workflows/run_before_all.py | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/run_before_all.py diff --git a/.github/workflows/run_before_all.py b/.github/workflows/run_before_all.py new file mode 100644 index 00000000..575a2676 --- /dev/null +++ b/.github/workflows/run_before_all.py @@ -0,0 +1,37 @@ +#! /usr/bin/env python +"""Helper script to be run by `cibuildwheel` as `before_all` step.""" + +import os +import sys + +HERE = os.path.abspath(__file__) +ROOT = os.path.dirname(os.path.dirname(os.path.dirname(HERE))) +sys.path.insert(0, os.path.join(ROOT, "packages", "basemap")) +import utils # noqa: E402 # pylint: disable=imports + + +def main(): + """Build the GEOS library based on parsed environment variables.""" + + geos_version = os.environ.get("GEOS_VERSION", None) + if geos_version is None: + raise ValueError("Undefined environment variable GEOS_VERSION") + + geos_dir = os.environ.get("GEOS_DIR", None) + if geos_dir is None: + raise ValueError("Undefined environment variable GEOS_DIR") + + geos_njobs = int(os.environ.get("GEOS_NJOBS", 1)) + + # pylint: disable=consider-using-f-string + print("Running before_all script with the following settings:") + print("GEOS_DIR: {0}".format(geos_dir)) + print("GEOS_VERSION: {0}".format(geos_version)) + print("GEOS_NJOBS: {0}".format(geos_njobs)) + + utils.GeosLibrary(geos_version).build(geos_dir, njobs=geos_njobs) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) From 4fd2ec91cf9e400c514f154cce960816a63471a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 22:03:11 +0100 Subject: [PATCH 4/8] Replace before_all blocks with Python script --- .github/workflows/build.yml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c533120..f15dfbf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,32 +51,12 @@ jobs: include: - os: ubuntu-22.04 arch: x86_64 - before_all: >- - echo "Starting BEFORE_ALL script" && - echo "GEOS_DIR set to: ${GEOS_DIR}" && - cd "{package}" && - python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)" + - os: windows-2019 + arch: x86_64 - os: macos-13 arch: x86_64 - before_all: >- - echo "Starting BEFORE_ALL script" && - echo "GEOS_DIR set to: ${GEOS_DIR}" && - cd "{package}" && - python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)" - os: macos-14 arch: arm64 - before_all: >- - echo "Starting BEFORE_ALL script" && - echo "GEOS_DIR set to: ${GEOS_DIR}" && - cd "{package}" && - python -c "import utils; utils.GeosLibrary('${GEOS_VERSION}').build('${GEOS_DIR}', njobs=2)" - - os: windows-2019 - arch: x86_64 - before_all: >- - echo Starting BEFORE_ALL script && - echo GEOS_DIR set to: %GEOS_DIR% && - cd "{package}" && - python -c "import utils; utils.GeosLibrary('%GEOS_VERSION%').build('%GEOS_DIR%', njobs=2)" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -100,12 +80,13 @@ jobs: CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*" CIBW_ARCHS_MACOS: ${{ matrix.arch }} CIBW_SKIP: "pp* *-musllinux_* *-win32 *-manylinux_i686 *-musllinux_i686 *-linux_aarch64 *-linux_armv7l" - CIBW_BEFORE_ALL: ${{ matrix.before_all }} + CIBW_BEFORE_ALL: "python {project}/.github/workflows/run_before_all.py" CIBW_TEST_EXTRAS: "test" CIBW_TEST_COMMAND: "python -m pytest {project}/packages/basemap" CIBW_ENVIRONMENT: >- GEOS_VERSION="3.6.5" GEOS_DIR="$(pwd)/extern" + GEOS_NJOBS=4 PIP_PREFER_BINARY=1 PYTHONUNBUFFERED=1 LD_LIBRARY_PATH="${GEOS_DIR}/lib" From 2c0bb76b43b52cfbd7a62a5435223ccf06c061e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 22:06:44 +0100 Subject: [PATCH 5/8] Apply minor correction to CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6031e398..6e212b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ https://semver.org/spec/v2.0.0.html - **BREAKING CHANGE**: Migrate `basemap` libraries to use implicit namespace packages (PR [#576] by @ksunden). - Migrate workflows to use `cibuildwheel` (PRs [#614] and [#618] by - @cvanelteren, solves sunset of v1 of GitHub artifact actions). + @cvanelteren, solves sunset of GitHub artifact actions v1). - Update library dependencies: - Upgrade upper limit for `basemap_data` to 3.0. - Upgrade lower limit for `packaging` to 20.5. From 861998b1d29b24c080f5301dda708a4ed44beb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 22:11:59 +0100 Subject: [PATCH 6/8] Fix and simplify setup of archs in cibuildwheel --- .github/workflows/build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f15dfbf9..5714e548 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,15 +48,7 @@ jobs: needs: [build_data] strategy: matrix: - include: - - os: ubuntu-22.04 - arch: x86_64 - - os: windows-2019 - arch: x86_64 - - os: macos-13 - arch: x86_64 - - os: macos-14 - arch: arm64 + os: [ubuntu-22.04, windows-2019, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -78,7 +70,7 @@ jobs: env: CIBW_BUILD_VERBOSITY: 1 CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*" - CIBW_ARCHS_MACOS: ${{ matrix.arch }} + CIBW_ARCHS: "native" CIBW_SKIP: "pp* *-musllinux_* *-win32 *-manylinux_i686 *-musllinux_i686 *-linux_aarch64 *-linux_armv7l" CIBW_BEFORE_ALL: "python {project}/.github/workflows/run_before_all.py" CIBW_TEST_EXTRAS: "test" From 7d689ad14204bb5278f8e5c58a7b9b2904471fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Tue, 25 Feb 2025 22:26:13 +0100 Subject: [PATCH 7/8] Clean up unneeded wheel exclusions in CIBW_SKIP --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5714e548..d3fa1c77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,10 +68,10 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BUILD_VERBOSITY: 1 - CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*" CIBW_ARCHS: "native" - CIBW_SKIP: "pp* *-musllinux_* *-win32 *-manylinux_i686 *-musllinux_i686 *-linux_aarch64 *-linux_armv7l" + CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*" + CIBW_BUILD_VERBOSITY: 1 + CIBW_SKIP: "*-musllinux_*" CIBW_BEFORE_ALL: "python {project}/.github/workflows/run_before_all.py" CIBW_TEST_EXTRAS: "test" CIBW_TEST_COMMAND: "python -m pytest {project}/packages/basemap" From d762db0025c9d3b319852013a1cf8eefb6eaebad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Molina=20Garc=C3=ADa?= Date: Wed, 26 Feb 2025 00:34:24 +0100 Subject: [PATCH 8/8] Update CHANGELOG --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e212b9d..b14c8acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ https://semver.org/spec/v2.0.0.html - **BREAKING CHANGE**: Migrate `basemap` libraries to use implicit namespace packages (PR [#576] by @ksunden). - Migrate workflows to use `cibuildwheel` (PRs [#614] and [#618] by - @cvanelteren, solves sunset of GitHub artifact actions v1). + @cvanelteren and PR [#621], solves GitHub artifact actions v1 sunset). - Update library dependencies: - Upgrade upper limit for `basemap_data` to 3.0. - Upgrade lower limit for `packaging` to 20.5. @@ -1156,6 +1156,8 @@ https://semver.org/spec/v2.0.0.html - Fix glitches in drawing of parallels and meridians. +[#621]: +https://github.com/matplotlib/basemap/pull/621 [#620]: https://github.com/matplotlib/basemap/pull/620 [#619]: