From 62f2d03fc1c82d764fb3a5f929cca014e073e10f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 10:27:04 +0100 Subject: [PATCH 01/31] consolidate workflows into singular file --- .github/workflows/basemap-data-hires.yml | 137 ------ .github/workflows/basemap-data.yml | 137 ------ .github/workflows/basemap-for-manylinux.yml | 449 -------------------- .github/workflows/basemap-for-windows.yml | 326 -------------- 4 files changed, 1049 deletions(-) delete mode 100644 .github/workflows/basemap-data-hires.yml delete mode 100644 .github/workflows/basemap-data.yml delete mode 100644 .github/workflows/basemap-for-manylinux.yml delete mode 100644 .github/workflows/basemap-for-windows.yml diff --git a/.github/workflows/basemap-data-hires.yml b/.github/workflows/basemap-data-hires.yml deleted file mode 100644 index a33ddb149..000000000 --- a/.github/workflows/basemap-data-hires.yml +++ /dev/null @@ -1,137 +0,0 @@ -name: basemap-data-hires - -env: - PKGDIR: "packages/basemap_data_hires" - PIP_DEFAULT_TIMEOUT: 10 - PIP_DISABLE_PIP_VERSION_CHECK: 1 - PIP_PREFER_BINARY: 1 - PIP_RETRIES: 0 - PYTHONUNBUFFERED: "1" - PYTHONWARNINGS: "ignore:DEPRECATION" - -on: - push: - paths: - - ".github/workflows/basemap-data-hires.yml" - - "packages/basemap_data_hires/**" - pull_request: - paths: - - ".github/workflows/basemap-data-hires.yml" - - "packages/basemap_data_hires/**" - workflow_dispatch: - -jobs: - - checkout: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Upload checkout - uses: actions/upload-artifact@v4 - with: - name: checkout - path: . - - build: - strategy: - matrix: - python-version: - ["2.7"] - max-parallel: 1 - needs: checkout - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Build sdist and wheel - run: | - cd ${{ env.PKGDIR }} - python setup.py sdist - pip wheel -w dist --no-deps dist/*.zip - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - test: - strategy: - matrix: - python-version: - ["2.6", "2.7", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", - "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: build - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - - name: Install package - run: | - pip install ${{ env.PKGDIR }}/dist/*.whl - - - name: Test package - run: | - python -c "from mpl_toolkits import basemap_data; print(basemap_data)" - - upload: - strategy: - matrix: - python-version: - ["2.7"] - max-parallel: 1 - if: startsWith(github.event.ref, 'refs/tags/v') - needs: test - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - environment: PyPI - steps: - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - - name: Install upload requirements - run: | - pip install twine - - - name: Check distributables - run: | - python -m twine check \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*.whl - - - name: Upload distributables - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}" - TWINE_REPOSITORY_URL: "${{ secrets.PYPI_REPOSITORY_URL }}" - run: | - python -m twine upload --skip-existing \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*.whl diff --git a/.github/workflows/basemap-data.yml b/.github/workflows/basemap-data.yml deleted file mode 100644 index 629213f31..000000000 --- a/.github/workflows/basemap-data.yml +++ /dev/null @@ -1,137 +0,0 @@ -name: basemap-data - -env: - PKGDIR: "packages/basemap_data" - PIP_DEFAULT_TIMEOUT: 10 - PIP_DISABLE_PIP_VERSION_CHECK: 1 - PIP_PREFER_BINARY: 1 - PIP_RETRIES: 0 - PYTHONUNBUFFERED: "1" - PYTHONWARNINGS: "ignore:DEPRECATION" - -on: - push: - paths: - - ".github/workflows/basemap-data.yml" - - "packages/basemap_data/**" - pull_request: - paths: - - ".github/workflows/basemap-data.yml" - - "packages/basemap_data/**" - workflow_dispatch: - -jobs: - - checkout: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Upload checkout - uses: actions/upload-artifact@v4 - with: - name: checkout - path: . - - build: - strategy: - matrix: - python-version: - ["2.7"] - max-parallel: 1 - needs: checkout - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Build sdist and wheel - run: | - cd ${{ env.PKGDIR }} - python setup.py sdist - pip wheel -w dist --no-deps dist/*.zip - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - test: - strategy: - matrix: - python-version: - ["2.6", "2.7", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", - "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: build - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - - name: Install package - run: | - pip install ${{ env.PKGDIR }}/dist/*.whl - - - name: Test package - run: | - python -c "from mpl_toolkits import basemap_data; print(basemap_data)" - - upload: - strategy: - matrix: - python-version: - ["2.7"] - max-parallel: 1 - if: startsWith(github.event.ref, 'refs/tags/v') - needs: test - runs-on: ubuntu-latest - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - environment: PyPI - steps: - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build - path: ${{ env.PKGDIR }}/dist - - - name: Install upload requirements - run: | - pip install twine - - - name: Check distributables - run: | - python -m twine check \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*.whl - - - name: Upload distributables - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}" - TWINE_REPOSITORY_URL: "${{ secrets.PYPI_REPOSITORY_URL }}" - run: | - python -m twine upload --skip-existing \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*.whl diff --git a/.github/workflows/basemap-for-manylinux.yml b/.github/workflows/basemap-for-manylinux.yml deleted file mode 100644 index 617568c9a..000000000 --- a/.github/workflows/basemap-for-manylinux.yml +++ /dev/null @@ -1,449 +0,0 @@ -name: basemap-for-manylinux - -env: - PKGDIR: "packages/basemap" - PIP_DEFAULT_TIMEOUT: 10 - PIP_DISABLE_PIP_VERSION_CHECK: 1 - PIP_PREFER_BINARY: 1 - PIP_RETRIES: 0 - PYTHONUNBUFFERED: "1" - PYTHONWARNINGS: "ignore:DEPRECATION" - -on: - push: - paths: - - ".github/workflows/basemap-for-manylinux.yml" - - "packages/basemap/**" - pull_request: - paths: - - ".github/workflows/basemap-for-manylinux.yml" - - "packages/basemap/**" - workflow_dispatch: - -jobs: - - checkout: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v1 - - - name: Upload checkout - uses: actions/upload-artifact@v1 - with: - name: checkout - path: . - - lint: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: checkout - container: "pylegacy/python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v1 - with: - name: checkout - path: . - - - name: Install lint requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements-lint.txt - - - name: Install library requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements.txt - - - name: Run Flake8 - run: | - cd ${{ env.PKGDIR }} - if [ -x "$(command -v flake8)" ]; then - flake8 src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test; - fi - - - name: Run PyLint - run: | - cd ${{ env.PKGDIR }} - if [ -x "$(command -v pylint)" ]; then - pylint src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test; - fi - - build-geos: - strategy: - matrix: - arch: - ["x64", "x86"] - max-parallel: 2 - fail-fast: false - needs: lint - runs-on: ubuntu-latest - container: "pylegacy/${{ matrix.arch }}-python:3.8-debian-4" - steps: - - - name: Download checkout - uses: actions/download-artifact@v1 - with: - name: checkout - path: . - - - name: Install CMake 3.6.2 - run: | - apt-get update - apt-get install -y libidn11 - pkgvers=3.6.2 - pkgname=cmake - pkgcode=cmake-${pkgvers} - case "${{ matrix.arch }}" in - x86) pkgfile=${pkgcode}-Linux-i386.tar.gz;; - *) pkgfile=${pkgcode}-Linux-x86_64.tar.gz;; - esac - wget https://github.com/Kitware/CMake/releases/download/v${pkgvers}/${pkgfile} -P /tmp - tar -xf /tmp/${pkgfile} --strip-components=1 -C /usr - rm -rf /tmp/${pkgfile} - - - name: Install GCC toolchain - run: | - apt-get update - apt-get install -y gcc g++ make - - - name: Build GEOS from source - run: | - cd ${{ env.PKGDIR }} - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - - - name: Upload GEOS artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-geos-${{ matrix.arch }} - path: ${{ env.PKGDIR }}/extern - - build: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: build-geos - runs-on: ubuntu-latest - container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-4" - steps: - - - name: Download checkout - uses: actions/download-artifact@v1 - with: - name: checkout - path: . - - - name: Download GEOS artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-geos-${{ matrix.arch }} - path: ${{ env.PKGDIR }}/extern - - - name: Install GCC toolchain - run: | - apt-get update - apt-get install -y gcc g++ make - - - name: Build old numpy from source - run: | - case "${{ matrix.arch }}" in - x64) arch="x86_64" ;; - x86) arch="i686" ;; - esac - case "${{ matrix.python-version }}" in - 2.6|3.[23]) pkgvers=1.11.3; tag=manylinux1 ;; - 2.7|3.[456789]) pkgvers=1.16.6; tag=manylinux1 ;; - 3.10) pkgvers=1.21.4; tag=manylinux1 ;; - 3.11) pkgvers=1.23.3; tag=manylinux_2_17 ;; - *) pkgvers=1.26.1; tag=manylinux_2_28 ;; - esac - case "${{ matrix.python-version }}" in - 3.11|3.12) - # Dirty solution to get NumPy headers for Python 3.11 and 3.12. - kwds="--plat=${tag}_${arch}" - pip download --no-deps ${kwds} "numpy==${pkgvers}" - oldpkgfile=$(ls *.whl | head -n1) - newpkgfile=$(echo "${oldpkgfile}" | sed "s/${tag}/linux/") - mv "${oldpkgfile}" "${newpkgfile}" - pip install "${newpkgfile}" - rm "${newpkgfile}" - ;; - *) - pip install "numpy == ${pkgvers}" - ;; - esac - - - 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 - case "${{ matrix.python-version }}" in - 3.11|3.12) - kwds="--no-build-isolation" - pip install setuptools wheel "cython >= 0.29, < 3.1" - ;; - esac - cd ${{ env.PKGDIR }} - python setup.py sdist - pip wheel -w dist --no-deps ${kwds} dist/*.zip - - - name: Upload build artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - repair: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: build - runs-on: ubuntu-latest - container: "pylegacy/${{ matrix.arch }}-python:3.8-debian-10" - steps: - - - name: Download GEOS artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-geos-${{ matrix.arch }} - path: ${{ env.PKGDIR }}/extern - - - name: Download build artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - - name: Install auditwheel - run: | - apt-get update - apt-get install -y unzip - pip install patchelf - pip install "auditwheel < 4.0" - - - name: Repair wheel - run: | - cd ${{ env.PKGDIR }} - export LD_LIBRARY_PATH="$(readlink -f extern/lib)" - auditwheel repair -w dist dist/*.whl - - - name: Upload build artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - test: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - exclude: - # Missing precompiled binaries for `numpy`, `matplotlib`, - # `pyproj`, `pillow` and `lxml`. - - arch: "x86" - python-version: "3.12" - max-parallel: 3 - fail-fast: false - needs: repair - runs-on: ubuntu-latest - container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v1 - with: - name: checkout - path: . - - - name: Download build artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - - name: Install numpy from source - run: | - apt-get update - apt-get install -y gcc g++ make - pip install "numpy < 1.24" - if: matrix.arch == 'x86' && (matrix.python-version >= '3.8' || matrix.python-version >= '3.10') - - - name: Install test requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements-test.txt - - - name: Install package (full) - run: | - whlpath=$(ls ${{ env.PKGDIR }}/dist/*-manylinux1*.whl | head -n1) - pip install "${whlpath}[owslib,pillow]" - - - name: Test package - run: | - cd ${{ env.PKGDIR }} - export COVERAGE_FILE=.coverage.${{ matrix.python-version }} - python -m pytest \ - --cov="mpl_toolkits.basemap" --cov-report=term \ - --ignore=dist --ignore=build - - - name: Upload test artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-test - path: ${{ env.PKGDIR }}/.coverage.${{ matrix.python-version }} - - coverage: - needs: test - runs-on: ubuntu-latest - container: "pylegacy/python:3.8-debian-10" - steps: - - - name: Checkout - uses: actions/checkout@v1 - - - name: Download test artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-test - path: ${{ env.PKGDIR }} - - - name: Install test requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements-test.txt - - - name: Compute combined coverage - run: | - cd ${{ env.PKGDIR }} - coverage combine - coverage html - coverage report - - - name: Upload coverage artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-coverage - path: ${{ env.PKGDIR }}/htmlcov - - docs: - needs: test - runs-on: ubuntu-latest - container: "pylegacy/python:3.8-debian-10" - steps: - - - name: Download checkout - uses: actions/download-artifact@v1 - with: - name: checkout - path: . - - - name: Install doc requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements-doc.txt - - - name: Download build artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-build-x64-3.8 - path: ${{ env.PKGDIR }}/dist - - - name: Install package - run: | - cd ${{ env.PKGDIR }} - pip install dist/*-manylinux1*.whl - - - name: Run sphinx - run: | - cd ${{ env.PKGDIR }} - python -m sphinx doc/source public - - - name: Upload docs artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts-docs - path: ${{ env.PKGDIR }}/public - - - name: Upload github-pages artifact - uses: actions/upload-pages-artifact@v3 - with: - name: github-pages - path: ${{ env.PKGDIR }}/public - - pages: - if: startsWith(github.event.ref, 'refs/tags/v') - needs: docs - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - permissions: - pages: write - id-token: write - steps: - - name: Deploy github-pages - uses: actions/deploy-pages@v3 - id: deployment - - upload: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 1 - if: startsWith(github.event.ref, 'refs/tags/v') - needs: test - runs-on: ubuntu-latest - container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-10" - environment: PyPI - steps: - - - name: Download build artifacts - uses: actions/download-artifact@v1 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - - name: Install upload requirements - run: | - pip install twine - - - name: Check distributables - run: | - python -m twine check \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*-manylinux1*.whl - - - name: Upload distributables - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}" - TWINE_REPOSITORY_URL: "${{ secrets.PYPI_REPOSITORY_URL }}" - run: | - python -m twine upload --skip-existing \ - ${{ env.PKGDIR }}/dist/*.zip \ - ${{ env.PKGDIR }}/dist/*-manylinux1*.whl diff --git a/.github/workflows/basemap-for-windows.yml b/.github/workflows/basemap-for-windows.yml deleted file mode 100644 index 92eb337fc..000000000 --- a/.github/workflows/basemap-for-windows.yml +++ /dev/null @@ -1,326 +0,0 @@ -name: basemap-for-windows - -env: - PKGDIR: "packages/basemap" - PIP_DEFAULT_TIMEOUT: 10 - PIP_DISABLE_PIP_VERSION_CHECK: 1 - PIP_PREFER_BINARY: 1 - PIP_RETRIES: 0 - PYTHONUNBUFFERED: "1" - PYTHONWARNINGS: "ignore:DEPRECATION" - -on: - push: - paths: - - ".github/workflows/basemap-for-windows.yml" - - "!packages/basemap/doc/**" - - "packages/basemap/**" - pull_request: - paths: - - ".github/workflows/basemap-for-windows.yml" - - "!packages/basemap/doc/**" - - "packages/basemap/**" - workflow_dispatch: - -jobs: - - checkout: - runs-on: windows-2019 - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Upload checkout - uses: actions/upload-artifact@v4 - with: - name: checkout - path: . - - lint: - runs-on: windows-2019 - strategy: - matrix: - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: checkout - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Set Python - uses: pylegacy/actions/setup-pyenv-win@v2 - with: - architecture: ${{ matrix.arch }} - python-version: ${{ matrix.python-version }} - - - name: Set Python base packages - run: | - python -m pip install --upgrade pip setuptools wheel - - - name: Install lint requirements - run: | - cd ${{ env.PKGDIR }} - python -m pip install -r requirements-lint.txt - - - name: Install library requirements - run: | - cd ${{ env.PKGDIR }} - python -m pip install -r requirements.txt - - - name: Run Flake8 - run: | - cd ${{ env.PKGDIR }} - if (Get-Command flake8 -errorAction SilentlyContinue) - { - flake8 src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test; - } - - - name: Run PyLint - run: | - cd ${{ env.PKGDIR }} - if (Get-Command pylint -errorAction SilentlyContinue) - { - pylint src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test; - } - - build-geos: - strategy: - matrix: - arch: - ["x64", "x86"] - msvc-toolset: - ["9.0", "14.0"] - include: - - msvc-toolset: "9.0" - python-version: "2.7" - - msvc-toolset: "14.0" - python-version: "3.5" - max-parallel: 4 - fail-fast: false - needs: lint - runs-on: windows-2019 - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Set MSVC toolset - uses: pylegacy/actions/setup-msvc@v2 - with: - arch: ${{ matrix.arch }} - toolset: ${{ matrix.msvc-toolset }} - - - name: Set CMake - uses: jwlawson/actions-setup-cmake@v2.0 - with: - cmake-version: "3.24.2" - - - name: Set Python - uses: pylegacy/actions/setup-pyenv-win@v2 - with: - architecture: ${{ matrix.arch }} - python-version: ${{ matrix.python-version }} - - - name: Build GEOS from source - run: | - cd ${{ env.PKGDIR }} - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', toolset='${{ matrix.msvc-toolset }}', njobs=16)" - - - name: Upload GEOS artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts-geos-${{ matrix.arch }}-msvc${{ matrix.msvc-toolset }} - path: ${{ env.PKGDIR }}/extern - - build: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 3 - fail-fast: false - needs: build-geos - runs-on: windows-2019 - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Set Python - uses: pylegacy/actions/setup-pyenv-win@v2 - with: - architecture: ${{ matrix.arch }} - python-version: ${{ matrix.python-version }} - - - name: Set Python base packages - run: | - python -m pip install --upgrade pip setuptools wheel - - - name: Build old numpy from source - run: | - 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" } - "^3\.10$" { Set-Variable -Name "pkgvers" -Value "1.21.4" } - "^3\.11$" { Set-Variable -Name "pkgvers" -Value "1.23.3" } - default { Set-Variable -Name "pkgvers" -Value "1.26.1" } - } - $env:SETUPTOOLS_USE_DISTUTILS = "stdlib" - python -m pip install "numpy == ${pkgvers}" - - - name: Set MSVC toolset version - run: | - if ("${{ matrix.python-version }}" -eq "2.7") { - echo "msvc-toolset=9.0" >> $env:GITHUB_ENV - } else { - echo "msvc-toolset=14.0" >> $env:GITHUB_ENV - } - - - name: Set MSVC toolset - uses: pylegacy/actions/setup-msvc@v2 - with: - arch: ${{ matrix.arch }} - toolset: ${{ env.msvc-toolset }} - - - name: Download GEOS artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-geos-${{ matrix.arch }}-msvc${{ env.msvc-toolset }} - path: ${{ env.PKGDIR }}/extern - - - name: Build sdist and wheel - run: | - cd ${{ env.PKGDIR }} - $env:GEOS_DIR = "$env:GITHUB_WORKSPACE/${{ env.PKGDIR }}/extern" - python -m pip install -r requirements-setup.txt - python setup.py sdist - python -m pip wheel -w dist --no-deps (Get-Item dist/*.zip) - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - test: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - exclude: - # Missing precompiled binaries for `numpy` and `matplotlib`. - - arch: "x86" - python-version: "3.12" - max-parallel: 3 - fail-fast: false - needs: build - runs-on: windows-2019 - steps: - - - name: Download checkout - uses: actions/download-artifact@v4 - with: - name: checkout - path: . - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - - name: Set Python - uses: pylegacy/actions/setup-pyenv-win@v2 - with: - architecture: ${{ matrix.arch }} - python-version: ${{ matrix.python-version }} - - - name: Set Python base packages - run: | - python -m pip install --upgrade pip setuptools wheel - - - name: Install test requirements - run: | - cd ${{ env.PKGDIR }} - pip install -r requirements-test.txt - - - name: Install package (full) - run: | - $whlpath = "$(Get-Item ${{ env.PKGDIR }}/dist/*-win*.whl)" - python -m pip install "${whlpath}[owslib,pillow]" - - - name: Test package - run: | - cd ${{ env.PKGDIR }} - $env:COVERAGE_FILE = ".coverage.${{ matrix.arch }}.${{ matrix.python-version }}" - python -m pytest ` - --cov="mpl_toolkits.basemap" --cov-report=term ` - --ignore=dist --ignore=build - - - name: Upload test artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts-test-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/.coverage.${{ matrix.arch }}.${{ matrix.python-version }} - - upload: - strategy: - matrix: - arch: - ["x64", "x86"] - python-version: - ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - max-parallel: 1 - if: startsWith(github.event.ref, 'refs/tags/v') - needs: test - runs-on: windows-2019 - environment: PyPI - steps: - - - name: Set Python - uses: pylegacy/actions/setup-pyenv-win@v2 - with: - architecture: ${{ matrix.arch }} - python-version: ${{ matrix.python-version }} - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }} - path: ${{ env.PKGDIR }}/dist - - - name: Install upload requirements - run: | - python -m pip install twine - - - name: Check distributables - run: | - python -m twine check ` - ${{ env.PKGDIR }}/dist/*.zip ` - ${{ env.PKGDIR }}/dist/*.whl - - - name: Upload distributables - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}" - TWINE_REPOSITORY_URL: "${{ secrets.PYPI_REPOSITORY_URL }}" - run: | - python -m twine upload --skip-existing ` - ${{ env.PKGDIR }}/dist/*.whl From d1b35493cb4ee389bd7b4da78969ad4e1ddef5d2 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 10:28:35 +0100 Subject: [PATCH 02/31] consolidate workflows --- .github/workflows/build-data.yml | 86 ++++++++++++++++++++ .github/workflows/build.yml | 134 +++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 .github/workflows/build-data.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-data.yml b/.github/workflows/build-data.yml new file mode 100644 index 000000000..79ff13df1 --- /dev/null +++ b/.github/workflows/build-data.yml @@ -0,0 +1,86 @@ +name: Build Data Packages + +env: + PYTHONUNBUFFERED: "1" + PYTHONWARNINGS: "ignore:DEPRECATION" + +on: + push: + paths: + - "packages/basemap_data/**" + - "packages/basemap_data_hires/**" + pull_request: + paths: + - "packages/basemap_data/**" + - "packages/basemap_data_hires/**" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + package: [basemap_data, basemap_data_hires] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Build package + run: | + cd packages/${{ matrix.package }} + pip install build + python -m build + + - uses: actions/upload-artifact@v4 + with: + name: dist-${{ matrix.package }} + path: packages/${{ matrix.package }}/dist/* + + upload_testpypi: + needs: [build] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + strategy: + matrix: + package: [basemap_data, basemap_data_hires] + environment: + name: TestPyPI + url: https://test.pypi.org/p/${{ matrix.package }} + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist-${{ matrix.package }} + path: dist + + - name: Upload to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + upload_pypi: + needs: [build, upload_testpypi] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + strategy: + matrix: + package: [basemap_data, basemap_data_hires] + environment: + name: PyPI + url: https://pypi.org/p/${{ matrix.package }} + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist-${{ matrix.package }} + path: dist + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..2b725cc9a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,134 @@ +name: Build and Test + +env: + PKGDIR: "packages/basemap" + CIBW_BUILD_VERBOSITY: 1 + PYTHONUNBUFFERED: "1" + PYTHONWARNINGS: "ignore:DEPRECATION" + +on: + push: + paths: + - ".github/workflows/**" + - "packages/basemap/**" + - "packages/basemap_data/**" + - "packages/basemap_data_hires/**" + pull_request: + paths: + - ".github/workflows/**" + - "packages/basemap/**" + - "packages/basemap_data/**" + - "packages/basemap_data_hires/**" + workflow_dispatch: + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macos-11] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.2 + + - name: Build wheels + env: + CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux + CIBW_BEFORE_BUILD: > + pip install numpy cython && + python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" + CIBW_BEFORE_TEST: "pip install -r {project}/requirements-test.txt" + CIBW_TEST_COMMAND: > + cd {project} && python -m pytest --cov="mpl_toolkits.basemap" + --cov-report=term --ignore=dist --ignore=build + CIBW_BUILD: "cp27-* cp35-* cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_ENVIRONMENT: "GEOS_DIR={project}/extern" + run: | + cd ${{ env.PKGDIR }} + python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }} + path: ${{ env.PKGDIR }}/wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Build sdist + run: | + cd ${{ env.PKGDIR }} + pip install build + python -m build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: ${{ env.PKGDIR }}/dist/*.tar.gz + + upload_testpypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + environment: + name: TestPyPI + url: https://test.pypi.org/p/basemap + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: wheels-* + path: dist + merge-multiple: true + + - uses: actions/download-artifact@v4 + with: + name: sdist + path: dist + + - name: Upload to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + upload_pypi: + needs: [build_wheels, build_sdist, upload_testpypi] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + environment: + name: PyPI + url: https://pypi.org/p/basemap + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: wheels-* + path: dist + merge-multiple: true + + - uses: actions/download-artifact@v4 + with: + name: sdist + path: dist + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 69684e06ad43e1f092fedfc63c50df6f3f4a6702 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 10:32:38 +0100 Subject: [PATCH 03/31] drop eol py versions --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b725cc9a..d979051fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build - CIBW_BUILD: "cp27-* cp35-* cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" CIBW_ENVIRONMENT: "GEOS_DIR={project}/extern" run: | cd ${{ env.PKGDIR }} From 5820b797ce9994daec2c4e73cc1955e7db6f7f62 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 11:56:03 +0100 Subject: [PATCH 04/31] update pyproject.toml --- packages/basemap/pyproject.toml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index 6a50e2c78..db98b9d4b 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -1,15 +1,22 @@ [build-system] requires = [ - 'setuptools', + 'setuptools>=42', 'wheel', - 'numpy == 1.26.1; python_version >= "3.12"', - '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")', - 'cython >= 0.29, < 3.1; python_version >= "3.3" or python_version < "3.0"', - 'cython >= 0.26, < 0.27; python_version == "3.2"' + 'numpy>=1.21.4; python_version == "3.9"', + 'numpy>=1.21.4; python_version == "3.10"', + 'numpy>=1.23.3; python_version == "3.11"', + 'numpy>=1.26.1; python_version >= "3.12"', + 'cython>=0.29.21,<3.1' ] build-backend = "setuptools.build_meta" + +[project] +name = "basemap" +dynamic = ["version"] +description = "Plot data on map projections with matplotlib" +requires-python = ">=3.9" +dependencies = [ + "numpy>=1.21.4", + "matplotlib>=3.4.0", + "pyproj>=3.0.0" +] From c0087d18fc94ca273552c67e3e2ce1ee9ef7053b Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 11:57:37 +0100 Subject: [PATCH 05/31] update pyproject.toml --- packages/basemap/pyproject.toml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index db98b9d4b..1bdf241ee 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -14,9 +14,39 @@ build-backend = "setuptools.build_meta" name = "basemap" dynamic = ["version"] description = "Plot data on map projections with matplotlib" +readme = "README.md" requires-python = ">=3.9" +license = {text = "MIT"} +authors = [ + {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} +] +maintainers = [ + {name = "The Matplotlib Developers"} +] +keywords = ["matplotlib", "plotting", "map", "projection"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Visualization", +] dependencies = [ "numpy>=1.21.4", "matplotlib>=3.4.0", "pyproj>=3.0.0" ] + +[project.urls] +Homepage = "https://matplotlib.org/basemap" +Documentation = "https://matplotlib.org/basemap/api/basemap_api.html" +Repository = "https://github.com/matplotlib/basemap" +"Bug Tracker" = "https://github.com/matplotlib/basemap/issues" + +[tool.setuptools] +packages = ["mpl_toolkits.basemap"] +package-dir = {"" = "src"} From 075e1a7d680eb88ba0b6ad9e7bf73d264152e37b Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:02:30 +0100 Subject: [PATCH 06/31] fix pre-build --- .github/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d979051fd..f50812390 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,15 +43,22 @@ jobs: - name: Build wheels env: CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux + CIBW_BEFORE_ALL: > + yum install -y geos-devel || + apt-get update && apt-get install -y libgeos-dev || + brew install geos CIBW_BEFORE_BUILD: > - pip install numpy cython && + pip install --upgrade pip && + pip install numpy>=1.21.4 cython>=0.29.21 && python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - CIBW_BEFORE_TEST: "pip install -r {project}/requirements-test.txt" + CIBW_ENVIRONMENT: > + GEOS_DIR=/project/packages/basemap/extern + SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" - CIBW_ENVIRONMENT: "GEOS_DIR={project}/extern" + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + run: | cd ${{ env.PKGDIR }} python -m cibuildwheel --output-dir wheelhouse From 924c5cb71f8815b03334bc826d4c235b2e736e9e Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:04:30 +0100 Subject: [PATCH 07/31] update wheels for ubuntu --- .github/workflows/build.yml | 3 +++ packages/basemap/pyproject.toml | 30 ++++++++---------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f50812390..5bf8b22ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,9 @@ jobs: env: CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux CIBW_BEFORE_ALL: > + sudo apt-get install software-properties-common + sudo add-apt-repository ppa:ubuntugis/ppa + sudo apt-get install geos yum install -y geos-devel || apt-get update && apt-get install -y libgeos-dev || brew install geos diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index 1bdf241ee..c7bdf4535 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta" [project] name = "basemap" -dynamic = ["version"] +dynamic = ["version", "optional-dependencies"] description = "Plot data on map projections with matplotlib" readme = "README.md" requires-python = ">=3.9" @@ -20,33 +20,19 @@ license = {text = "MIT"} authors = [ {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} ] -maintainers = [ - {name = "The Matplotlib Developers"} -] -keywords = ["matplotlib", "plotting", "map", "projection"] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: Visualization", -] dependencies = [ "numpy>=1.21.4", "matplotlib>=3.4.0", "pyproj>=3.0.0" ] -[project.urls] -Homepage = "https://matplotlib.org/basemap" -Documentation = "https://matplotlib.org/basemap/api/basemap_api.html" -Repository = "https://github.com/matplotlib/basemap" -"Bug Tracker" = "https://github.com/matplotlib/basemap/issues" - [tool.setuptools] packages = ["mpl_toolkits.basemap"] package-dir = {"" = "src"} +py-modules = [] + +[tool.setuptools.package-data] +"mpl_toolkits.basemap" = ["data/*"] + +[tool.setuptools.exclude-package-data] +"*" = ["*.pyc", "**/__pycache__/*", "**/.DS_Store/*"] From 35996b957d7608d8c2c8256452631e98c29f809e Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:06:22 +0100 Subject: [PATCH 08/31] install geos depending on OS --- .github/workflows/build.yml | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5bf8b22ae..636aec201 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,25 +43,31 @@ jobs: - name: Build wheels env: CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux - CIBW_BEFORE_ALL: > - sudo apt-get install software-properties-common - sudo add-apt-repository ppa:ubuntugis/ppa - sudo apt-get install geos - yum install -y geos-devel || - apt-get update && apt-get install -y libgeos-dev || - brew install geos - CIBW_BEFORE_BUILD: > - pip install --upgrade pip && - pip install numpy>=1.21.4 cython>=0.29.21 && - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - CIBW_ENVIRONMENT: > - GEOS_DIR=/project/packages/basemap/extern - SETUPTOOLS_USE_DISTUTILS=stdlib - CIBW_TEST_COMMAND: > - cd {project} && python -m pytest --cov="mpl_toolkits.basemap" - --cov-report=term --ignore=dist --ignore=build - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" - + # Linux setup + CIBW_BEFORE_ALL_LINUX: > + sudo apt-get update && + sudo apt-get install -y software-properties-common && + sudo add-apt-repository ppa:ubuntugis/ppa && + sudo apt-get update && + sudo apt-get install -y libgeos-dev + # Windows setup + CIBW_BEFORE_ALL_WINDOWS: > + choco install geos + # macOS setup + CIBW_BEFORE_ALL_MACOS: > + brew install geos + + CIBW_BEFORE_BUILD: > + pip install --upgrade pip && + pip install numpy>=1.21.4 cython>=0.29.21 && + python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" + CIBW_ENVIRONMENT: > + GEOS_DIR=/project/packages/basemap/extern + SETUPTOOLS_USE_DISTUTILS=stdlib + CIBW_TEST_COMMAND: > + cd {project} && python -m pytest --cov="mpl_toolkits.basemap" + --cov-report=term --ignore=dist --ignore=build + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" run: | cd ${{ env.PKGDIR }} python -m cibuildwheel --output-dir wheelhouse From 56d4e342823a8df5d3ac1787334fccda3cf3f497 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:07:48 +0100 Subject: [PATCH 09/31] install geos depending on OS --- .github/workflows/build.yml | 48 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 636aec201..d379581c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,31 +43,29 @@ jobs: - name: Build wheels env: CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux - # Linux setup - CIBW_BEFORE_ALL_LINUX: > - sudo apt-get update && - sudo apt-get install -y software-properties-common && - sudo add-apt-repository ppa:ubuntugis/ppa && - sudo apt-get update && - sudo apt-get install -y libgeos-dev - # Windows setup - CIBW_BEFORE_ALL_WINDOWS: > - choco install geos - # macOS setup - CIBW_BEFORE_ALL_MACOS: > - brew install geos - - CIBW_BEFORE_BUILD: > - pip install --upgrade pip && - pip install numpy>=1.21.4 cython>=0.29.21 && - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - CIBW_ENVIRONMENT: > - GEOS_DIR=/project/packages/basemap/extern - SETUPTOOLS_USE_DISTUTILS=stdlib - CIBW_TEST_COMMAND: > - cd {project} && python -m pytest --cov="mpl_toolkits.basemap" - --cov-report=term --ignore=dist --ignore=build - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + CIBW_BEFORE_ALL: > + if [ "$runner_os" == "linux" ]; then + sudo apt-get update && + sudo apt-get install -y software-properties-common && + sudo add-apt-repository ppa:ubuntugis/ppa && + sudo apt-get update && + sudo apt-get install -y libgeos-dev + elif [ "$runner_os" == "windows" ]; then + choco install geos + elif [ "$runner_os" == "macos" ]; then + brew install geos + fi + CIBW_BEFORE_BUILD: > + pip install --upgrade pip && + pip install numpy>=1.21.4 cython>=0.29.21 && + python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" + CIBW_ENVIRONMENT: > + GEOS_DIR=/project/packages/basemap/extern + SETUPTOOLS_USE_DISTUTILS=stdlib + CIBW_TEST_COMMAND: > + cd {project} && python -m pytest --cov="mpl_toolkits.basemap" + --cov-report=term --ignore=dist --ignore=build + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" run: | cd ${{ env.PKGDIR }} python -m cibuildwheel --output-dir wheelhouse From 8b721dc6a1c1c7ea5482bb42b4e23f335046201a Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:09:54 +0100 Subject: [PATCH 10/31] install geos depending on OS2 --- .github/workflows/build.yml | 111 +++++++----------------------------- 1 file changed, 21 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d379581c5..ba4d80350 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,14 +11,10 @@ on: paths: - ".github/workflows/**" - "packages/basemap/**" - - "packages/basemap_data/**" - - "packages/basemap_data_hires/**" pull_request: paths: - ".github/workflows/**" - "packages/basemap/**" - - "packages/basemap_data/**" - - "packages/basemap_data_hires/**" workflow_dispatch: jobs: @@ -32,6 +28,25 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install GEOS (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository ppa:ubuntugis/ppa + sudo apt-get update + sudo apt-get install -y libgeos-dev + + - name: Install GEOS (Windows) + if: runner.os == 'Windows' + run: | + choco install geos + + - name: Install GEOS (macOS) + if: runner.os == 'macOS' + run: | + brew install geos + - name: Set up Python uses: actions/setup-python@v4 with: @@ -42,25 +57,13 @@ jobs: - name: Build wheels env: - CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux - CIBW_BEFORE_ALL: > - if [ "$runner_os" == "linux" ]; then - sudo apt-get update && - sudo apt-get install -y software-properties-common && - sudo add-apt-repository ppa:ubuntugis/ppa && - sudo apt-get update && - sudo apt-get install -y libgeos-dev - elif [ "$runner_os" == "windows" ]; then - choco install geos - elif [ "$runner_os" == "macos" ]; then - brew install geos - fi + CIBW_SKIP: "pp* *-musllinux*" CIBW_BEFORE_BUILD: > pip install --upgrade pip && pip install numpy>=1.21.4 cython>=0.29.21 && python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" CIBW_ENVIRONMENT: > - GEOS_DIR=/project/packages/basemap/extern + GEOS_DIR={project}/extern SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" @@ -74,75 +77,3 @@ jobs: with: name: wheels-${{ matrix.os }} path: ${{ env.PKGDIR }}/wheelhouse/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - - name: Build sdist - run: | - cd ${{ env.PKGDIR }} - pip install build - python -m build --sdist - - - uses: actions/upload-artifact@v4 - with: - name: sdist - path: ${{ env.PKGDIR }}/dist/*.tar.gz - - upload_testpypi: - needs: [build_wheels, build_sdist] - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - environment: - name: TestPyPI - url: https://test.pypi.org/p/basemap - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v4 - with: - pattern: wheels-* - path: dist - merge-multiple: true - - - uses: actions/download-artifact@v4 - with: - name: sdist - path: dist - - - name: Upload to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - upload_pypi: - needs: [build_wheels, build_sdist, upload_testpypi] - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - environment: - name: PyPI - url: https://pypi.org/p/basemap - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v4 - with: - pattern: wheels-* - path: dist - merge-multiple: true - - - uses: actions/download-artifact@v4 - with: - name: sdist - path: dist - - - name: Upload to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 From f43725e6ad1f2ad3bed2b7a87132dd4bdf6ba4e6 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:13:09 +0100 Subject: [PATCH 11/31] build geos from source on windows --- .github/workflows/build.yml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba4d80350..c444ae1b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,17 +5,7 @@ env: CIBW_BUILD_VERBOSITY: 1 PYTHONUNBUFFERED: "1" PYTHONWARNINGS: "ignore:DEPRECATION" - -on: - push: - paths: - - ".github/workflows/**" - - "packages/basemap/**" - pull_request: - paths: - - ".github/workflows/**" - - "packages/basemap/**" - workflow_dispatch: + GEOS_VERSION: "3.6.5" jobs: build_wheels: @@ -39,8 +29,16 @@ jobs: - name: Install GEOS (Windows) if: runner.os == 'Windows' + shell: bash run: | - choco install geos + wget https://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2 + tar xjf geos-${GEOS_VERSION}.tar.bz2 + cd geos-${GEOS_VERSION} + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/geos-install .. + cmake --build . --config Release --target install + echo "GEOS_DIR=$GITHUB_WORKSPACE/geos-install" >> $GITHUB_ENV - name: Install GEOS (macOS) if: runner.os == 'macOS' @@ -60,9 +58,14 @@ jobs: CIBW_SKIP: "pp* *-musllinux*" CIBW_BEFORE_BUILD: > pip install --upgrade pip && - pip install numpy>=1.21.4 cython>=0.29.21 && - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - CIBW_ENVIRONMENT: > + pip install numpy>=1.21.4 cython>=0.29.21 + CIBW_ENVIRONMENT_WINDOWS: > + GEOS_DIR=${{ env.GEOS_DIR }} + SETUPTOOLS_USE_DISTUTILS=stdlib + CIBW_ENVIRONMENT_LINUX: > + GEOS_DIR={project}/extern + SETUPTOOLS_USE_DISTUTILS=stdlib + CIBW_ENVIRONMENT_MACOS: > GEOS_DIR={project}/extern SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > From 6b6521f0292809f1a0d171cd7be041dfe8409f1f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:14:31 +0100 Subject: [PATCH 12/31] fix deletion triggers --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c444ae1b3..cc8ca1244 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,17 @@ name: Build and Test +on: + push: + branches: [main, master, develop] + tags: ["v*"] + paths: + - ".github/workflows/**" + - "packages/basemap/**" + pull_request: + branches: [main, master, develop] + paths: + - ".github/workflows/**" + - "packages/basemap/**" + workflow_dispatch: # Allows manual workflow runs env: PKGDIR: "packages/basemap" From 19ad51bba57052a9be8ee8df22bc221d2434234d Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:16:18 +0100 Subject: [PATCH 13/31] bump --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc8ca1244..2da4bc9cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,6 @@ on: - ".github/workflows/**" - "packages/basemap/**" workflow_dispatch: # Allows manual workflow runs - env: PKGDIR: "packages/basemap" CIBW_BUILD_VERBOSITY: 1 From 808ec0b0d18fc760aa883ecbbf7a60ffd954978d Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 12:21:54 +0100 Subject: [PATCH 14/31] use python script to install geos --- .github/workflows/build.yml | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2da4bc9cd..8534c2bce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,34 +29,6 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Install GEOS (Linux) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y software-properties-common - sudo add-apt-repository ppa:ubuntugis/ppa - sudo apt-get update - sudo apt-get install -y libgeos-dev - - - name: Install GEOS (Windows) - if: runner.os == 'Windows' - shell: bash - run: | - wget https://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2 - tar xjf geos-${GEOS_VERSION}.tar.bz2 - cd geos-${GEOS_VERSION} - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/geos-install .. - cmake --build . --config Release --target install - echo "GEOS_DIR=$GITHUB_WORKSPACE/geos-install" >> $GITHUB_ENV - - - name: Install GEOS (macOS) - if: runner.os == 'macOS' - run: | - brew install geos - - name: Set up Python uses: actions/setup-python@v4 with: @@ -69,8 +41,9 @@ jobs: env: CIBW_SKIP: "pp* *-musllinux*" CIBW_BEFORE_BUILD: > - pip install --upgrade pip && - pip install numpy>=1.21.4 cython>=0.29.21 + pip install --upgrade pip + pip install numpy cython + python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" CIBW_ENVIRONMENT_WINDOWS: > GEOS_DIR=${{ env.GEOS_DIR }} SETUPTOOLS_USE_DISTUTILS=stdlib From ac4b5e7aae1e9139ba1ec2e0afbfd37022fe119c Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 14:49:13 +0100 Subject: [PATCH 15/31] fix numpy on build and free on runtime --- packages/basemap/pyproject.toml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index c7bdf4535..50fe5f38c 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -2,10 +2,7 @@ requires = [ 'setuptools>=42', 'wheel', - 'numpy>=1.21.4; python_version == "3.9"', - 'numpy>=1.21.4; python_version == "3.10"', - 'numpy>=1.23.3; python_version == "3.11"', - 'numpy>=1.26.1; python_version >= "3.12"', + 'numpy==2.0.0; python_version >= "3.9"', 'cython>=0.29.21,<3.1' ] build-backend = "setuptools.build_meta" @@ -21,7 +18,7 @@ authors = [ {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} ] dependencies = [ - "numpy>=1.21.4", + "numpy>=2.0", "matplotlib>=3.4.0", "pyproj>=3.0.0" ] From 1a99575f09dbd2ca3d1a7456cdba3e590390f607 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 14:51:06 +0100 Subject: [PATCH 16/31] use env variable for geo_version --- .github/workflows/build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8534c2bce..cce96cfa3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,12 @@ name: Build and Test + +env: + PKGDIR: "packages/basemap" + CIBW_BUILD_VERBOSITY: 1 + PYTHONUNBUFFERED: "1" + PYTHONWARNINGS: "ignore:DEPRECATION" + GEO_VERSION: "3.6.5" + on: push: branches: [main, master, develop] @@ -41,16 +49,8 @@ jobs: env: CIBW_SKIP: "pp* *-musllinux*" CIBW_BEFORE_BUILD: > - pip install --upgrade pip - pip install numpy cython - python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)" - CIBW_ENVIRONMENT_WINDOWS: > - GEOS_DIR=${{ env.GEOS_DIR }} - SETUPTOOLS_USE_DISTUTILS=stdlib - CIBW_ENVIRONMENT_LINUX: > - GEOS_DIR={project}/extern - SETUPTOOLS_USE_DISTUTILS=stdlib - CIBW_ENVIRONMENT_MACOS: > + python -c "import utils; utils.GeosLibrary(${{ env.GEO_VERSION }}).build('extern', njobs=16)" + CIBW_ENVIRONMENT: > GEOS_DIR={project}/extern SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > From 60c26a467a40ffd1f17bb9c2bfbae99ce1272ddd Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 14:51:28 +0100 Subject: [PATCH 17/31] setup cmake tools per os --- .github/workflows/build.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cce96cfa3..4c6c4b222 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,23 +9,14 @@ env: on: push: - branches: [main, master, develop] - tags: ["v*"] paths: - ".github/workflows/**" - "packages/basemap/**" pull_request: - branches: [main, master, develop] paths: - ".github/workflows/**" - "packages/basemap/**" - workflow_dispatch: # Allows manual workflow runs -env: - PKGDIR: "packages/basemap" - CIBW_BUILD_VERBOSITY: 1 - PYTHONUNBUFFERED: "1" - PYTHONWARNINGS: "ignore:DEPRECATION" - GEOS_VERSION: "3.6.5" + workflow_dispatch: jobs: build_wheels: @@ -37,11 +28,32 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.9" + - name: Setup CMake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: "3.16.x" + + - name: Setup C++ toolchain (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y build-essential + + - name: Setup C++ toolchain (Windows) + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v1.1 + + - name: Setup C++ toolchain (macOS) + if: runner.os == 'macOS' + run: | + xcode-select --install || true + - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.16.2 From 4748d6515813ee25f8fdb089926d7f5b92f990e0 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 14:53:21 +0100 Subject: [PATCH 18/31] add deps from req to toml --- .github/workflows/build-data.yml | 2 +- packages/basemap/pyproject.toml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-data.yml b/.github/workflows/build-data.yml index 79ff13df1..3f24c176c 100644 --- a/.github/workflows/build-data.yml +++ b/.github/workflows/build-data.yml @@ -43,7 +43,7 @@ jobs: upload_testpypi: needs: [build] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') strategy: matrix: diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index 50fe5f38c..749b82d29 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -20,7 +20,10 @@ authors = [ dependencies = [ "numpy>=2.0", "matplotlib>=3.4.0", - "pyproj>=3.0.0" + "pyproj>=3.0.0", + "packaging >= 16.0, < 25.0", + "pyshp >= 1.2, < 2.4", + "basemap_data >= 1.3.2, < 1.4" ] [tool.setuptools] From 2be129215ed22f658741b6663a725801ddb7ee81 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 14:58:57 +0100 Subject: [PATCH 19/31] env variable needs to be a string --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c6c4b222..9c5d208e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: env: CIBW_SKIP: "pp* *-musllinux*" CIBW_BEFORE_BUILD: > - python -c "import utils; utils.GeosLibrary(${{ env.GEO_VERSION }}).build('extern', njobs=16)" + python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('extern', njobs=16)" CIBW_ENVIRONMENT: > GEOS_DIR={project}/extern SETUPTOOLS_USE_DISTUTILS=stdlib From 9e33072e0e658ca9cf0824a067afd9e7fb9e5a77 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:05:26 +0100 Subject: [PATCH 20/31] attempt fix path --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c5d208e6..1fd34a02a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,6 +64,9 @@ jobs: python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('extern', njobs=16)" CIBW_ENVIRONMENT: > GEOS_DIR={project}/extern + CPATH={project}/extern/include + LIBRARY_PATH={project}/extern/lib + LD_LIBRARY_PATH={project}/extern/lib SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" From 06b6f8c05ed293e71a7964669d8ac3876bf3f21e Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:09:27 +0100 Subject: [PATCH 21/31] attempt add include dir --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fd34a02a..5d82eb37f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,6 +67,7 @@ jobs: CPATH={project}/extern/include LIBRARY_PATH={project}/extern/lib LD_LIBRARY_PATH={project}/extern/lib + CFLAGS="-I{project}/extern/include" SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" From 7558d9331337a809befddc49e3117e406b086e30 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:15:45 +0100 Subject: [PATCH 22/31] make path explicit --- .github/workflows/build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d82eb37f..814a712b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,11 +63,10 @@ jobs: CIBW_BEFORE_BUILD: > python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('extern', njobs=16)" CIBW_ENVIRONMENT: > - GEOS_DIR={project}/extern - CPATH={project}/extern/include - LIBRARY_PATH={project}/extern/lib - LD_LIBRARY_PATH={project}/extern/lib - CFLAGS="-I{project}/extern/include" + GEOS_DIR=/project/packages/basemap/extern + CPATH=/project/packages/basemap/extern/include + LIBRARY_PATH=/project/packages/basemap/extern/lib + LD_LIBRARY_PATH=/project/packages/basemap/extern/lib SETUPTOOLS_USE_DISTUTILS=stdlib CIBW_TEST_COMMAND: > cd {project} && python -m pytest --cov="mpl_toolkits.basemap" From c9e25c7b8296be06fb97e377eb4a47a8790fd87e Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:46:22 +0100 Subject: [PATCH 23/31] prepping to convert to toml --- packages/basemap/pyproject.toml | 81 ++++++++++++--- packages/basemap/setup.cfg | 42 -------- packages/basemap/src/_geoslib.pyx | 2 +- packages/basemap_data/setup.cfg | 12 --- packages/basemap_data/setup.py | 137 -------------------------- packages/basemap_data_hires/setup.cfg | 10 -- packages/basemap_data_hires/setup.py | 115 --------------------- 7 files changed, 68 insertions(+), 331 deletions(-) delete mode 100644 packages/basemap/setup.cfg delete mode 100644 packages/basemap_data/setup.cfg delete mode 100644 packages/basemap_data/setup.py delete mode 100644 packages/basemap_data_hires/setup.cfg delete mode 100644 packages/basemap_data_hires/setup.py diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index 749b82d29..93dfdcb4f 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -1,15 +1,15 @@ [build-system] requires = [ - 'setuptools>=42', - 'wheel', - 'numpy==2.0.0; python_version >= "3.9"', - 'cython>=0.29.21,<3.1' + "setuptools>=42", + "wheel", + "numpy==2.0.0; python_version >= '3.9'", + "cython>=0.29.21,<3.1" ] build-backend = "setuptools.build_meta" [project] name = "basemap" -dynamic = ["version", "optional-dependencies"] +dynamic = ["version", "dependencies", "optional-dependencies"] description = "Plot data on map projections with matplotlib" readme = "README.md" requires-python = ">=3.9" @@ -17,22 +17,75 @@ license = {text = "MIT"} authors = [ {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} ] -dependencies = [ - "numpy>=2.0", - "matplotlib>=3.4.0", - "pyproj>=3.0.0", - "packaging >= 16.0, < 25.0", - "pyshp >= 1.2, < 2.4", - "basemap_data >= 1.3.2, < 1.4" +maintainers = [ + {name = "Víctor Molina García", email = "molinav@users.noreply.github.com"} ] +keywords = ["GIS", "maps", "plots"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Software Development :: Libraries :: Python Modules" +] + +[project.urls] +Homepage = "https://matplotlib.org/basemap" +Documentation = "https://matplotlib.org/basemap/" +Repository = "https://github.com/matplotlib/basemap" +"Bug Tracker" = "https://github.com/matplotlib/basemap/issues" [tool.setuptools] packages = ["mpl_toolkits.basemap"] package-dir = {"" = "src"} -py-modules = [] +license-files = ["LICENSE", "LICENSE.geos"] [tool.setuptools.package-data] "mpl_toolkits.basemap" = ["data/*"] [tool.setuptools.exclude-package-data] -"*" = ["*.pyc", "**/__pycache__/*", "**/.DS_Store/*"] +"*" = ["*.pyc", "**/__pycache__/*"] + +[tool.setuptools.dynamic] +version = {attr = "mpl_toolkits.basemap.__version__"} +dependencies = {file = "requirements.txt"} + +[tool.setuptools.dynamic.optional-dependencies] +doc = {file = ["requirements-doc.txt"]} +lint = {file = ["requirements-lint.txt"]} +test = {file = ["requirements-test.txt"]} +owslib = {file = ["requirements-owslib.txt"]} +pillow = {file = ["requirements-pillow.txt"]} + +[tool.pytest.ini_options] +filterwarnings = [ + "error", + "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated:DeprecationWarning:unittest2.compatibility:143", + "ignore:datetime.datetime.utcfromtimestamp() is deprecated:DeprecationWarning:dateutil.tz.tz:37" +] + +[tool.coverage.paths] +source = [ + "src", + "/opt/pyenv/versions/**/site-packages" +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "def __str__", + "raise NotImplementedError", + "if __name__ == .__main__.:"] + + + +[tool.flake8] +ignore = ["E301", "E306", "E402", "E501", "E731", "F401", "F403", "W503", "W504"] diff --git a/packages/basemap/setup.cfg b/packages/basemap/setup.cfg deleted file mode 100644 index 58e39b69a..000000000 --- a/packages/basemap/setup.cfg +++ /dev/null @@ -1,42 +0,0 @@ -[metadata] -license_files = - LICENSE - LICENSE.geos - -[sdist] -formats = zip - -[flake8] -ignore = - E301,E306,E402,E501,E731,F401,F403,W503,W504 -# E301: expected-blank-line-missing -# E306: no-blank-line-before-nested-def -# E402: module-import-not-at-top-file -# E501: line-too-long -# E731: used-lambda -# F401: unused-import -# F403: wildcard-import -# W503: line-break-before-binary-operator -# W504: line-break-after-binary-operator - -[tool:pytest] -filterwarnings = - error - # To be removed when replacing `unittest2`. - ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated:DeprecationWarning:unittest2.compatibility:143 - # To be removed with `dateutil` release after 2.8.2. - # See: https://github.com/dateutil/dateutil/issues/1314 - ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:dateutil.tz.tz:37 - -[coverage:paths] -source = - src - /opt/pyenv/versions/**/site-packages - -[coverage:report] -exclude_lines = - pragma: no cover - def __repr__ - def __str__ - raise NotImplementedError - if __name__ == .__main__.: diff --git a/packages/basemap/src/_geoslib.pyx b/packages/basemap/src/_geoslib.pyx index 676ac4d4b..6d1e36914 100644 --- a/packages/basemap/src/_geoslib.pyx +++ b/packages/basemap/src/_geoslib.pyx @@ -112,7 +112,7 @@ cdef extern from "geos_c.h": # Cython 3: Next cdef needs "noexcept" declaration unless # the compiler directive "legacy_implicit_noexcept" is used # ("noexcept" syntax supported since Cython 0.29.31). -cdef void notice_h(const char *fmt, ...): +cdef void notice_h(const char *fmt, ...) noexcept: pass #format = PyBytes_FromString(fmt) #message = PyBytes_FromString(msg) diff --git a/packages/basemap_data/setup.cfg b/packages/basemap_data/setup.cfg deleted file mode 100644 index 46fc44d00..000000000 --- a/packages/basemap_data/setup.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[metadata] -license_files = - COPYING - COPYING.LESSER - LICENSE.epsg - LICENSE.mit - -[sdist] -formats = zip - -[bdist_wheel] -universal = 1 diff --git a/packages/basemap_data/setup.py b/packages/basemap_data/setup.py deleted file mode 100644 index 2d8e4e620..000000000 --- a/packages/basemap_data/setup.py +++ /dev/null @@ -1,137 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- -# flake8: noqa: E122 -"""basemap_data -- Data assets for matplotlib basemap.""" - -import io -import os -import itertools -from setuptools import setup -from setuptools import find_packages - - -def get_content(name, splitlines=False): - """Return the file contents with project root as root folder.""" - - here = os.path.abspath(os.path.dirname(__file__)) - path = os.path.join(here, name) - with io.open(path, "r", encoding="utf-8") as fd: - content = fd.read() - if splitlines: - content = [row for row in content.splitlines() if row] - return content - - -# Define some helper lists. -basenames = [ - "countries", - "countriesmeta", - "gshhs", - "gshhsmeta", - "rivers", - "riversmeta", - "states", - "statesmeta" -] -resolutions = [ - "c", - "l", - "i", - "h", - "f", -] -grids = [ - "1.25", - "2.5", - "5", - "10", -] - -# Define data assets. -data_dat_files = [ - "%s_%s.dat" % (basename, res) - for basename, res in itertools.product(basenames, resolutions[:3]) -] -data_bin_files = [ - "lsmask_%smin_%s.bin" % (grid, res) - for grid, res in itertools.product(grids, resolutions) -] -data_usc_files = [ - "UScounties.%s" % ext - for ext in ("dbf", "prj", "shp", "shx") -] -data_other_files = [ - "epsg", - "bmng.jpg", - "etopo1.jpg", - "shadedrelief.jpg", -] - -data_files = data_dat_files + data_bin_files + data_usc_files + data_other_files - -setup(**{ - "name": - "basemap_data", - "version": - "1.3.2", - "license": - "GNU Lesser General Public License v3 or later (LGPLv3+)", - "description": - "Data assets for matplotlib basemap", - "long_description": - get_content("README.md"), - "long_description_content_type": - "text/markdown", - "url": - "https://matplotlib.org/basemap", - "author": - "Jeff Whitaker", - "author_email": - "jeffrey.s.whitaker@noaa.gov", - "maintainer": - "Víctor Molina García", - "maintainer_email": - "molinav@users.noreply.github.com", - "classifiers": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Education", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering :: Visualization", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - "keywords": [ - "GIS", - "maps", - "plots", - ], - "namespace_packages": [ - "mpl_toolkits.basemap_data", - ], - "package_dir": - {"": "src"}, - "packages": - find_packages(where="src"), - "package_data": { - "mpl_toolkits.basemap_data": - data_files, - }, - "python_requires": - ", ".join([ - ">=2.6", - "!=3.0.*", - "!=3.1.*", - "<4", - ]), - "project_urls": { - "Bug Tracker": - "https://github.com/matplotlib/basemap/issues", - "Documentation": - "https://matplotlib.org/basemap/", - "Source": - "https://github.com/matplotlib/basemap", - }, -}) diff --git a/packages/basemap_data_hires/setup.cfg b/packages/basemap_data_hires/setup.cfg deleted file mode 100644 index e408a4da9..000000000 --- a/packages/basemap_data_hires/setup.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[metadata] -license_files = - COPYING - COPYING.LESSER - -[sdist] -formats = zip - -[bdist_wheel] -universal = 1 diff --git a/packages/basemap_data_hires/setup.py b/packages/basemap_data_hires/setup.py deleted file mode 100644 index 7dbe83cf6..000000000 --- a/packages/basemap_data_hires/setup.py +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- -# flake8: noqa: E122 -"""basemap_data_hires -- High-resolution data assets for matplotlib basemap.""" - -import io -import os -import itertools -from setuptools import setup -from setuptools import find_packages - - -def get_content(name, splitlines=False): - """Return the file contents with project root as root folder.""" - - here = os.path.abspath(os.path.dirname(__file__)) - path = os.path.join(here, name) - with io.open(path, "r", encoding="utf-8") as fd: - content = fd.read() - if splitlines: - content = [row for row in content.splitlines() if row] - return content - - -# Define some helper lists. -basenames = [ - "countries", - "countriesmeta", - "gshhs", - "gshhsmeta", - "rivers", - "riversmeta", - "states", - "statesmeta" -] -resolutions = [ - "c", - "l", - "i", - "h", - "f", -] - -# Define data assets. -data_files = [ - "%s_%s.dat" % (basename, res) - for basename, res in itertools.product(basenames, resolutions[3:]) -] - -setup(**{ - "name": - "basemap_data_hires", - "version": - "1.3.2", - "license": - "GNU Lesser General Public License v3 or later (LGPLv3+)", - "description": - "High-resolution data assets for matplotlib basemap", - "long_description": - get_content("README.md"), - "long_description_content_type": - "text/markdown", - "url": - "https://matplotlib.org/basemap", - "author": - "Jeff Whitaker", - "author_email": - "jeffrey.s.whitaker@noaa.gov", - "maintainer": - "Víctor Molina García", - "maintainer_email": - "molinav@users.noreply.github.com", - "classifiers": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Education", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering :: Visualization", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - "keywords": [ - "GIS", - "maps", - "plots", - ], - "namespace_packages": [ - "mpl_toolkits.basemap_data", - ], - "package_dir": - {"": "src"}, - "packages": - find_packages(where="src"), - "package_data": { - "mpl_toolkits.basemap_data": - data_files, - }, - "python_requires": - ", ".join([ - ">=2.6", - "!=3.0.*", - "!=3.1.*", - "<4", - ]), - "project_urls": { - "Bug Tracker": - "https://github.com/matplotlib/basemap/issues", - "Documentation": - "https://matplotlib.org/basemap/", - "Source": - "https://github.com/matplotlib/basemap", - }, -}) From 354278d3baac27256c3af9761dd6f49a3d9af7aa Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:47:06 +0100 Subject: [PATCH 24/31] prepping data for pyproject.toml --- packages/basemap_data/build.py | 31 ++++++++++++++ packages/basemap_data/pyproject.toml | 63 ++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 packages/basemap_data/build.py create mode 100644 packages/basemap_data/pyproject.toml diff --git a/packages/basemap_data/build.py b/packages/basemap_data/build.py new file mode 100644 index 000000000..b3f686095 --- /dev/null +++ b/packages/basemap_data/build.py @@ -0,0 +1,31 @@ +import itertools + + +def get_data_files(): + # Define some helper lists + basenames = [ + "countries", + "countriesmeta", + "gshhs", + "gshhsmeta", + "rivers", + "riversmeta", + "states", + "statesmeta", + ] + resolutions = ["c", "l", "i", "h", "f"] + grids = ["1.25", "2.5", "5", "10"] + + # Define data assets + data_dat_files = [ + f"{basename}_{res}.dat" + for basename, res in itertools.product(basenames, resolutions[:3]) + ] + data_bin_files = [ + f"lsmask_{grid}min_{res}.bin" + for grid, res in itertools.product(grids, resolutions) + ] + data_usc_files = [f"UScounties.{ext}" for ext in ("dbf", "prj", "shp", "shx")] + data_other_files = ["epsg", "bmng.jpg", "etopo1.jpg", "shadedrelief.jpg"] + + return data_dat_files + data_bin_files + data_usc_files + data_other_files diff --git a/packages/basemap_data/pyproject.toml b/packages/basemap_data/pyproject.toml new file mode 100644 index 000000000..6c7c33d55 --- /dev/null +++ b/packages/basemap_data/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" + +[project] +name = "basemap_data" +version = "1.3.2" +description = "Data assets for matplotlib basemap" +readme = "README.md" +requires-python = ">=3.9" # Updated to match main package +license = {text = "GNU Lesser General Public License v3 or later (LGPLv3+)"} +authors = [ + {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} +] +maintainers = [ + {name = "Víctor Molina García", email = "molinav@users.noreply.github.com"} +] +keywords = ["GIS", "maps", "plots"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Software Development :: Libraries :: Python Modules" +] + +[project.urls] +Homepage = "https://matplotlib.org/basemap" +Documentation = "https://matplotlib.org/basemap/" +Repository = "https://github.com/matplotlib/basemap" +"Bug Tracker" = "https://github.com/matplotlib/basemap/issues" + +[tool.setuptools] +packages = ["mpl_toolkits.basemap_data"] +package-dir = {"" = "src"} +license-files = [ + "COPYING", + "COPYING.LESSER", + "LICENSE.epsg", + "LICENSE.mit" +] + +[tool.setuptools.package-data] +"mpl_toolkits.basemap_data" = [ + # This will be populated from build.py + "data/*" +] + +[tool.setuptools.sdist] +formats = ["zip"] + +[tool.setuptools.bdist-wheel] +universal = true From 7d8c6b32da2c33d1dc738e38ff6e10f13e05019d Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:47:34 +0100 Subject: [PATCH 25/31] prepping data_hires for pyproject.toml --- packages/basemap_data_hires/build.py | 22 ++++++++ packages/basemap_data_hires/pyproject.toml | 61 ++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 packages/basemap_data_hires/build.py create mode 100644 packages/basemap_data_hires/pyproject.toml diff --git a/packages/basemap_data_hires/build.py b/packages/basemap_data_hires/build.py new file mode 100644 index 000000000..11b421161 --- /dev/null +++ b/packages/basemap_data_hires/build.py @@ -0,0 +1,22 @@ +import itertools + + +def get_data_files(): + # Define some helper lists + basenames = [ + "countries", + "countriesmeta", + "gshhs", + "gshhsmeta", + "rivers", + "riversmeta", + "states", + "statesmeta", + ] + resolutions = ["c", "l", "i", "h", "f"] + + # Define data assets + return [ + f"{basename}_{res}.dat" + for basename, res in itertools.product(basenames, resolutions[3:]) + ] diff --git a/packages/basemap_data_hires/pyproject.toml b/packages/basemap_data_hires/pyproject.toml new file mode 100644 index 000000000..1caba0318 --- /dev/null +++ b/packages/basemap_data_hires/pyproject.toml @@ -0,0 +1,61 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" + +[project] +name = "basemap_data_hires" +version = "1.3.2" +description = "High-resolution data assets for matplotlib basemap" +readme = "README.md" +requires-python = ">=3.9" # Updated to match main package +license = {text = "GNU Lesser General Public License v3 or later (LGPLv3+)"} +authors = [ + {name = "Jeff Whitaker", email = "jeffrey.s.whitaker@noaa.gov"} +] +maintainers = [ + {name = "Víctor Molina García", email = "molinav@users.noreply.github.com"} +] +keywords = ["GIS", "maps", "plots"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Software Development :: Libraries :: Python Modules" +] + +[project.urls] +Homepage = "https://matplotlib.org/basemap" +Documentation = "https://matplotlib.org/basemap/" +Repository = "https://github.com/matplotlib/basemap" +"Bug Tracker" = "https://github.com/matplotlib/basemap/issues" + +[tool.setuptools] +packages = ["mpl_toolkits.basemap_data"] +package-dir = {"" = "src"} +license-files = [ + "COPYING", + "COPYING.LESSER" +] + +[tool.setuptools.package-data] +"mpl_toolkits.basemap_data" = [ + # This will be populated from build.py + "data/*" +] + +[tool.setuptools.sdist] +formats = ["zip"] + +[tool.setuptools.bdist-wheel] +universal = true From a282d482e7a35f0702679d26c2470a6f4d90e137 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 15:48:25 +0100 Subject: [PATCH 26/31] prepping basemap for pyproject.toml --- packages/basemap/build.py | 9 ++ packages/basemap/setup.py | 309 +++++++------------------------------- 2 files changed, 65 insertions(+), 253 deletions(-) create mode 100644 packages/basemap/build.py diff --git a/packages/basemap/build.py b/packages/basemap/build.py new file mode 100644 index 000000000..d89af428c --- /dev/null +++ b/packages/basemap/build.py @@ -0,0 +1,9 @@ +def get_requirements(filename): + """Read requirements from file.""" + with open(filename) as f: + return [line.strip() for line in f if line.strip() and not line.startswith('#')] + +def get_package_data(): + return { + "mpl_toolkits.basemap": ["data/*"] + } \ No newline at end of file diff --git a/packages/basemap/setup.py b/packages/basemap/setup.py index 4c98a8776..c6a70f32f 100644 --- a/packages/basemap/setup.py +++ b/packages/basemap/setup.py @@ -1,272 +1,75 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- # flake8: noqa: E122 -"""basemap -- Plot data on map projections with matplotlib.""" - -import io -import os -import re -import sys -import glob -import warnings -from setuptools import setup -from setuptools import find_packages -from setuptools.command.sdist import sdist -from setuptools.extension import Extension - -try: - import Cython - cython_major_version = int(Cython.__version__.split(".", 1)[0]) -except ImportError: - cython_major_version = 0 - - -def get_content(name, splitlines=False): - """Return the file contents with project root as root folder.""" - - here = os.path.abspath(os.path.dirname(__file__)) - path = os.path.join(here, name) - with io.open(path, "r", encoding="utf-8") as fd: - content = fd.read() - if splitlines: - content = [row for row in content.splitlines() if row] - return content - - -def get_version(pkgname): - """Return package version without importing the file.""" - - here = os.path.abspath(os.path.dirname(__file__)) - path = os.path.join(*[here, "src"] + pkgname.split(".") + ["__init__.py"]) - with io.open(path, "r", encoding="utf-8") as fd: - pattern = r"""\n__version__[ ]*=[ ]*["']([^"]+)["']""" - return re.search(pattern, fd.read()).group(1) +import os, sys, glob, warnings +import numpy as np +from setuptools import setup, Extension def get_geos_install_prefix(): """Return GEOS installation prefix or None if not found.""" - env_candidate = os.environ.get("GEOS_DIR", None) if env_candidate is not None: - candidates = [env_candidate] - else: - candidates = [os.path.expanduser("~/local"), os.path.expanduser("~"), - "/usr/local", "/usr", "/opt/local", "/opt", "/sw"] + return env_candidate + + candidates = [ + os.path.expanduser("~/local"), + os.path.expanduser("~"), + "/usr/local", + "/usr", + "/opt/local", + "/opt", + "/sw", + ] - # Prepare filename pattern to find the GEOS library. extensions = {"win32": "dll", "cygwin": "dll", "darwin": "dylib"} libext = extensions.get(sys.platform, "so*") - libname = "*geos_c*.{0}".format(libext) + libname = f"*geos_c*.{libext}" libdirs = ["bin", "lib", "lib/x86_64-linux-gnu", "lib64"] for prefix in candidates: - libfiles = [] for libdir in libdirs: - libfiles.extend(glob.glob(os.path.join(prefix, libdir, libname))) - hfile = os.path.join(prefix, "include", "geos_c.h") - if os.path.isfile(hfile) and libfiles: - return prefix - - # At this point, the GEOS library was not found, so we throw a warning if - # the user is trying to build the library. - build_cmds = ("bdist_wheel", "build", "install") - if any(cmd in sys.argv[1:] for cmd in build_cmds): - warnings.warn(" ".join([ - "Cannot find GEOS library and/or headers in standard locations", - "('{0}'). Please install the corresponding packages using your", - "software management system or set the environment variable", - "GEOS_DIR to point to the location where GEOS is installed", - "(for example, if 'geos_c.h' is in '/usr/local/include'", - "and 'libgeos_c' is in '/usr/local/lib', then you need to", - "set GEOS_DIR to '/usr/local'", - ]).format("', '".join(candidates)), RuntimeWarning) + if glob.glob(os.path.join(prefix, libdir, libname)): + hfile = os.path.join(prefix, "include", "geos_c.h") + if os.path.isfile(hfile): + return prefix return None -class basemap_sdist(sdist): # pylint: disable=invalid-name - """Custom `sdist` so that it will not pack DLLs on Windows if present.""" - - def run(self): - """Custom `run` command.""" - - # Replace DLL data files and add GEOS build script. - orig_data_files = self.distribution.data_files - self.distribution.data_files = [ - (".", glob.glob(os.path.join("utils", "*.py")))] - - # Run the original `run` method and leave `data_files` as it was found. - try: - sdist.run(self) - finally: - self.distribution.data_files = orig_data_files - - -# Initialise include and library dirs. -data_files = [] -include_dirs = [] -library_dirs = [] -runtime_library_dirs = [] - -# Define NumPy include dirs. -numpy_include_path = os.environ.get("NUMPY_INCLUDE_PATH", None) -if numpy_include_path is not None: - include_dirs.append(numpy_include_path) -else: - try: - import numpy - include_dirs.append(numpy.get_include()) - except ImportError as err: - cmds = ("bdist_wheel", "build", "install") - if any(cmd in sys.argv[1:] for cmd in cmds): - warnings.warn("unable to locate NumPy headers", RuntimeWarning) - -# Define GEOS include, library and runtime dirs. -geos_install_prefix = get_geos_install_prefix() -if geos_install_prefix is not None: - include_dirs.append(os.path.join(geos_install_prefix, "include")) - library_dirs.append(os.path.join(geos_install_prefix, "lib")) - library_dirs.append(os.path.join(geos_install_prefix, "lib64")) - runtime_library_dirs = library_dirs - if os.name == "nt" or sys.platform == "cygwin": - # On Windows: - # - DLLs get installed under `bin`. - # - We need to inject later the DLL in the wheel using `data_files`. - # - We do not use `runtime_library_dirs` as workaround for a - # `distutils` bug (http://bugs.python.org/issue2437). - library_dirs.append(os.path.join(geos_install_prefix, "bin")) - runtime_library_dirs = [] - dlls = glob.glob(os.path.join(geos_install_prefix, "*", "*geos_c*.dll")) - if dlls: - data_files.append(("../..", sorted(dlls))) - -# Define `_geoslib` extension module. It cannot be installed in the -# `mpl_toolkits.basemap` namespace or `Basemap` objects will not be pickleable. -ext_modules = [ - Extension(**{ - "name": - "_geoslib", - "sources": [ - "src/_geoslib.pyx", - ], - "libraries": [ - "geos_c", - ], - "include_dirs": - include_dirs, - "library_dirs": - library_dirs, - "runtime_library_dirs": - runtime_library_dirs, - }), -] -for ext in ext_modules: - ext.cython_directives = [ - ("language_level", str(sys.version_info[0])), - ("legacy_implicit_noexcept", True), - ][:1 + int(cython_major_version >= 3)] - -# Define all the different requirements. -setup_requires = get_content("requirements-setup.txt", splitlines=True) -install_requires = get_content("requirements.txt", splitlines=True) -if sys.version_info[:2] == (3, 2): - # Hack for Python 3.2 because pip < 8 cannot handle version markers. - marker1 = '; python_version == "3.2"' - marker2 = '; python_version >= "2.7"' - setup_requires = [ - item.replace(marker1, "").replace(marker2, "") for item in setup_requires - if item.endswith(marker1) or item.endswith(marker2) - or "python_version" not in item] - install_requires = [ - item.replace(marker1, "").replace(marker2, "") for item in install_requires - if item.endswith(marker1) or item.endswith(marker2) - or "python_version" not in item] -else: - marker1 = '; python_version == "3.2"' - setup_requires = [item for item in setup_requires if not item.endswith(marker1)] - install_requires = [item for item in install_requires if not item.endswith(marker1)] - -setup(**{ - "name": - "basemap", - "version": - get_version("mpl_toolkits.basemap"), - "license": - "MIT", - "description": - "Plot data on map projections with matplotlib", - "long_description": - get_content("README.md"), - "long_description_content_type": - "text/markdown", - "url": - "https://matplotlib.org/basemap", - "author": - "Jeff Whitaker", - "author_email": - "jeffrey.s.whitaker@noaa.gov", - "maintainer": - "Víctor Molina García", - "maintainer_email": - "molinav@users.noreply.github.com", - "classifiers": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Education", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering :: Visualization", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - "keywords": [ - "GIS", - "maps", - "plots", - ], - "namespace_packages": [ - "mpl_toolkits", - ], - "package_dir": - {"": "src"}, - "packages": - find_packages(where="src"), - "ext_modules": - ext_modules, - "data_files": - data_files, - "python_requires": - ", ".join([ - ">=2.6", - "!=3.0.*", - "!=3.1.*", - "<3.13", - ]), - "setup_requires": - setup_requires, - "install_requires": - install_requires, - "extras_require": { - "doc": - get_content("requirements-doc.txt", splitlines=True), - "lint": - get_content("requirements-lint.txt", splitlines=True), - "test": - get_content("requirements-test.txt", splitlines=True), - "owslib": - get_content("requirements-owslib.txt", splitlines=True), - "pillow": - get_content("requirements-pillow.txt", splitlines=True), - }, - "cmdclass": { - "sdist": basemap_sdist, - }, - "project_urls": { - "Bug Tracker": - "https://github.com/matplotlib/basemap/issues", - "Documentation": - "https://matplotlib.org/basemap/", - "Source": - "https://github.com/matplotlib/basemap", - }, -}) +def get_extension_kwargs(): + include_dirs = [np.get_include()] + library_dirs = [] + runtime_library_dirs = [] + data_files = [] + + # Get GEOS paths + geos_prefix = get_geos_install_prefix() + if geos_prefix: + include_dirs.append(os.path.join(geos_prefix, "include")) + lib_dir = os.path.join(geos_prefix, "lib") + lib64_dir = os.path.join(geos_prefix, "lib64") + library_dirs.extend([lib_dir, lib64_dir]) + runtime_library_dirs = library_dirs.copy() + + if os.name == "nt" or sys.platform == "cygwin": + bin_dir = os.path.join(geos_prefix, "bin") + library_dirs.append(bin_dir) + runtime_library_dirs = [] + dlls = glob.glob(os.path.join(geos_prefix, "*", "*geos_c*.dll")) + if dlls: + data_files.append(("../..", sorted(dlls))) + + return { + "name": "_geoslib", + "sources": ["src/_geoslib.pyx"], + "libraries": ["geos_c"], + "include_dirs": include_dirs, + "library_dirs": library_dirs, + "runtime_library_dirs": runtime_library_dirs, + } + + +setup( + ext_modules=[Extension(**get_extension_kwargs())], + data_files=get_extension_kwargs().get("data_files", []), +) From 08f77e88945d0e5d8dc4d5df3ca7a7dd424fca6d Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 16:08:55 +0100 Subject: [PATCH 27/31] Clean up commit -- make path dependent on os --- .github/workflows/build.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 814a712b5..4ad0660c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,15 @@ jobs: if: runner.os == 'Windows' uses: microsoft/setup-msbuild@v1.1 + - name: Setup Visual Studio Developer Command Prompt + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Windows development tools + if: runner.os == 'Windows' + run: | + choco install visualstudio2019buildtools visualstudio2019-workload-vctools cmake + - name: Setup C++ toolchain (macOS) if: runner.os == 'macOS' run: | @@ -63,13 +72,13 @@ jobs: CIBW_BEFORE_BUILD: > python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('extern', njobs=16)" CIBW_ENVIRONMENT: > - GEOS_DIR=/project/packages/basemap/extern - CPATH=/project/packages/basemap/extern/include - LIBRARY_PATH=/project/packages/basemap/extern/lib - LD_LIBRARY_PATH=/project/packages/basemap/extern/lib - SETUPTOOLS_USE_DISTUTILS=stdlib + GEOS_DIR=${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern' || '/extern' }} + CFLAGS=-I${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern\\include' || '/extern/include' }} + LDFLAGS=-L${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern\\lib' || '/extern/lib' }} CIBW_TEST_COMMAND: > - cd {project} && python -m pytest --cov="mpl_toolkits.basemap" + cd {project} + pip install pytest + python -m pytest --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" run: | From 82f8f145be279b0773c1f707809b5e4e77221adc Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 19:18:21 +0100 Subject: [PATCH 28/31] Rebasing to clean up history. Nearly done. --- .github/workflows/build.yml | 85 +++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ad0660c6..8d813bb5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2019, macos-11] + os: [ubuntu-latest, windows-2019, macos-11] steps: - uses: actions/checkout@v4 @@ -45,19 +45,10 @@ jobs: sudo apt-get update sudo apt-get install -y build-essential - - name: Setup C++ toolchain (Windows) - if: runner.os == 'Windows' - uses: microsoft/setup-msbuild@v1.1 - - name: Setup Visual Studio Developer Command Prompt if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 - - name: Install Windows development tools - if: runner.os == 'Windows' - run: | - choco install visualstudio2019buildtools visualstudio2019-workload-vctools cmake - - name: Setup C++ toolchain (macOS) if: runner.os == 'macOS' run: | @@ -66,21 +57,71 @@ jobs: - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.16.2 + - name: Set GEO src directory + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + echo "GEO_DIR=D:/a/basemap/basemap/geo" >> $GITHUB_ENV + else + echo "GEO_DIR=/project/geo" >> $GITHUB_ENV + fi + - name: Build wheels env: - CIBW_SKIP: "pp* *-musllinux*" + CIBW_BUILD: "cp{39,310,311,312}-{manylinux_x86_64,win_amd64,macosx_x86_64}" + CIBW_SKIP: "*-manylinux_i686 *-musllinux* pp*" CIBW_BEFORE_BUILD: > - python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('extern', njobs=16)" - CIBW_ENVIRONMENT: > - GEOS_DIR=${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern' || '/extern' }} - CFLAGS=-I${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern\\include' || '/extern/include' }} - LDFLAGS=-L${{ github.workspace }}${{ runner.os == 'Windows' && '\\extern\\lib' || '/extern/lib' }} - CIBW_TEST_COMMAND: > - cd {project} - pip install pytest - python -m pytest --cov="mpl_toolkits.basemap" - --cov-report=term --ignore=dist --ignore=build - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + python -c "import utils; utils.GeosLibrary('${{ env.GEO_VERSION }}').build('${{ env.GEO_DIR}}', njobs=16)" + + CIBW_ENVIRONMENT_WINDOWS: | + GEOS_DIR=${{ env.GEO_DIR }} + INCLUDE=${{ env.GEO_DIR }}/include;%%INCLUDE%% + LIB=${{ env.GEO_DIR }}/lib;%%LIB%% + PATH=${{ env.GEO_DIR }}/bin;%%PATH%% + + CIBW_ENVIRONMENT_LINUX: | + GEOS_DIR=${{ env.GEO_DIR }} + CFLAGS="-I${{ env.GEO_DIR }}/include" + LDFLAGS="-L${{ env.GEO_DIR }}/lib" + LD_LIBRARY_PATH="${{ env.GEO_DIR }}/lib:$LD_LIBRARY_PATH" + + CIBW_ENVIRONMENT_MACOS: | + GEOS_DIR=${{ env.GEO_DIR }} + CFLAGS=-I${{ env.GEO_DIR }}/include + LDFLAGS=-L${{ env.GEO_DIR }}/lib + DYLD_LIBRARY_PATH=${{ env.GEO_DIR }}/lib:$DYLD_LIBRARY_PATH + + CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- + mkdir -p {dest_dir}/.libs && + cp ${{ env.GEO_DIR }}/lib/libgeos*.so* {dest_dir}/.libs/ && + auditwheel repair + --lib-sdir .libs + -w {dest_dir} + {wheel} + + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- + mkdir "{dest_dir}\libs" && + copy "%GEO_DIR%\bin\geos*.dll" "{dest_dir}\libs\" && + copy "{wheel}" "{dest_dir}\" && + dir /s /b "{dest_dir}\libs" + + CIBW_REPAIR_WHEEL_COMMAND_MACOS: >- + mkdir -p {dest_dir}/.libs && + cp ${{ env.GEO_DIR }}/lib/libgeos*.dylib {dest_dir}/.libs/ && + delocate-wheel -w {dest_dir} -v {wheel} + + CIBW_TEST_COMMAND_WINDOWS: >- + pip install pytest pytest-cov && + echo "Project path: {project}" && + dir /s /b "{project}" && + dir /s /b "{project}\packages\basemap" && + python -m pytest "{project}\packages\basemap\test" --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build + + CIBW_TEST_COMMAND: >- + cd {project} && + pip install pytest pytest-cov && + python -m pytest --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build + run: | cd ${{ env.PKGDIR }} python -m cibuildwheel --output-dir wheelhouse From 09daa6797f40b523baf83da9466e529aef49d941 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sun, 16 Feb 2025 23:19:04 +0100 Subject: [PATCH 29/31] typo --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d813bb5f..3e5268701 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -113,9 +113,7 @@ jobs: CIBW_TEST_COMMAND_WINDOWS: >- pip install pytest pytest-cov && echo "Project path: {project}" && - dir /s /b "{project}" && - dir /s /b "{project}\packages\basemap" && - python -m pytest "{project}\packages\basemap\test" --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build + python -m pytest "{project}\test" --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build CIBW_TEST_COMMAND: >- cd {project} && From 6aec73630f63fb01a8032346070d9961248c16ef Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 17 Feb 2025 07:34:15 +0100 Subject: [PATCH 30/31] install wheel in test env windows --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e5268701..522923c9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,6 +112,7 @@ jobs: CIBW_TEST_COMMAND_WINDOWS: >- pip install pytest pytest-cov && + pip install {wheel} && echo "Project path: {project}" && python -m pytest "{project}\test" --cov="mpl_toolkits.basemap" --cov-report=term --ignore=dist --ignore=build From 4d1fdfb3d762ffac1e735feed8d75aa9af02f74f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Mon, 17 Feb 2025 07:46:24 +0100 Subject: [PATCH 31/31] update namespace --- packages/basemap/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/basemap/pyproject.toml b/packages/basemap/pyproject.toml index 93dfdcb4f..d6881fce6 100644 --- a/packages/basemap/pyproject.toml +++ b/packages/basemap/pyproject.toml @@ -44,6 +44,7 @@ Repository = "https://github.com/matplotlib/basemap" [tool.setuptools] packages = ["mpl_toolkits.basemap"] +namespace-packages = ["mpl_toolkits"] package-dir = {"" = "src"} license-files = ["LICENSE", "LICENSE.geos"]