Skip to content

Commit

Permalink
Merge branch 'SciTools:main' into nat-earth-version
Browse files Browse the repository at this point in the history
  • Loading branch information
lgolston authored Oct 26, 2024
2 parents 1654f0a + 1a36e4e commit 727e25f
Show file tree
Hide file tree
Showing 73 changed files with 1,161 additions and 442 deletions.
77 changes: 60 additions & 17 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Tests

on: [push, pull_request]
on:
push:
pull_request:
schedule:
# 10th of each month
- cron: "0 0 10 * *"
workflow_dispatch:

jobs:
build:
Expand All @@ -11,12 +17,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
shapely-dev: [false]
python-version: ['3.10', '3.11', '3.12', '3.13-dev']
use-network: [true]
include:
- os: ubuntu-latest
python-version: '3.11'
shapely-dev: true
use-network: false

steps:
- uses: actions/checkout@v4
Expand All @@ -30,28 +36,30 @@ jobs:
cache: 'pip'

- name: Minimum packages
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
if: |
matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' &&
(github.event_name == 'push' || github.event_name == 'pull_request')
id: minimum-packages
run: |
pip install cython==0.29.24 matplotlib==3.5.3 numpy==1.21 owslib==0.24.1 pyproj==3.1 scipy==1.6.3 shapely==1.7.1 pyshp==2.3.1
pip install cython==0.29.28 matplotlib==3.6 numpy==1.23 owslib==0.27 pyproj==3.3.1 scipy==1.9 shapely==2.0 pyshp==2.3.1
- name: Coverage packages
id: coverage
# only want the coverage to be run on the latest ubuntu
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
# only want the coverage to be run on the latest ubuntu and for code changes i.e. push and pr
if: |
matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' &&
(github.event_name == 'push' || github.event_name == 'pull_request')
run: |
echo "CYTHON_COVERAGE=1" >> $GITHUB_ENV
# Also add doctest here to avoid windows runners which expect a different path separator
echo "EXTRA_TEST_ARGS=--cov=cartopy -ra --doctest-modules" >> $GITHUB_ENV
pip install cython
- name: Install Shapely dev
if: matrix.shapely-dev
- name: Install Nightlies
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: |
# Install Shapely from source on ubuntu
sudo apt-get update
sudo apt-get install -yy libgeos-dev
pip install git+https://github.com/shapely/shapely.git@main
# Install Nightly builds from Scientific Python
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple matplotlib pyproj scipy shapely
- name: Install Cartopy
id: install
Expand All @@ -68,6 +76,7 @@ jobs:
- name: Testing
id: test
if: matrix.use-network
# we need to force bash to use line continuations on Windows
shell: bash
run: |
Expand All @@ -79,9 +88,18 @@ jobs:
pytest -rfEsX -n 4 \
--color=yes \
--mpl --mpl-generate-summary=html \
--mpl-results-path="cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.shapely-dev }}" \
--mpl-results-path="cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}" \
--pyargs cartopy ${EXTRA_TEST_ARGS}
- name: No Network Tests
# Ensure any test that needs network access has been marked as such
if: ${{ ! matrix.use-network }}
run: |
pip install pytest-socket
pytest -rfEsX -n 4 \
--color=yes \
--pyargs cartopy -m "not natural_earth and not network" --disable-socket
- name: Coveralls
if: steps.coverage.conclusion == 'success'
env:
Expand All @@ -93,5 +111,30 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: image-failures-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.shapely-dev }}
path: cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.shapely-dev }}
name: image-failures-${{ matrix.os }}-${{ matrix.python-version }}
path: cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}

# Separate dependent job to only upload one issue from the matrix of jobs
create-issue:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [build]
permissions:
issues: write
runs-on: ubuntu-latest
name: Create issue on failure

steps:
- name: Create issue on failure
uses: imjohnbo/issue-bot@v3
with:
title: "[TST] Upcoming dependency test failures"
body: |
The build with nightly wheels from matplotlib, pyproj, scipy, shapely and
their dependencies has failed. Check the logs for any updates that need to
be made in cartopy.
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
pinned: false
close-previous: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86 changes: 38 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Build and upload to PyPI

concurrency:
Expand All @@ -18,8 +19,22 @@ on:
- reopened
- labeled

permissions:
contents: read

jobs:
build_sdist:
if: >-
github.event_name == 'release' ||
(github.event_name == 'pull_request' && (
(
github.event.action == 'labeled' &&
github.event.label.name == 'CI: build wheels'
) ||
contains(github.event.pull_request.labels.*.name,
'CI: build wheels')
)
)
name: Build source distribution
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -56,72 +71,47 @@ jobs:
path: dist/*.tar.gz
if-no-files-found: error

generate-wheels-matrix:
if: |
github.event_name == 'release' ||
(github.event_name == 'pull_request' && (
(
github.event.action == 'labeled' &&
github.event.label.name == 'CI: build wheels'
) ||
contains(github.event.pull_request.labels.*.name,
'CI: build wheels')
)
)
name: Generate wheels matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
run: pipx install cibuildwheel==2.16.2
- id: set-matrix
run: |
MATRIX=$(
{
cibuildwheel --print-build-identifiers --platform linux \
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos \
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --platform windows \
| jq -nRc '{"only": inputs, "os": "windows-2019"}'
} | jq -sc
)
echo "include=$MATRIX" >> $GITHUB_OUTPUT
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
# Skip 32 bit builds and musllinux due to lack of numpy wheels
CIBW_SKIP: "*-win32 *_i686 *-musllinux*"
CIBW_ARCHS_MACOS: x86_64 arm64

build_wheels:
name: Build ${{ matrix.os }} ${{ matrix.only }}
needs: [generate-wheels-matrix, build_sdist]
needs: build_sdist
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
runs-on: ${{ matrix.os }}
include:
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: windows-2019
cibw_archs: "auto64"
- os: macos-latest
cibw_archs: "x86_64"
- os: macos-latest
cibw_archs: "arm64"
defaults:
run:
shell: bash
steps:

steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: cibw-sdist
path: dist

- uses: pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce # v2.17.0
- name: Build wheels for CPython
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
with:
only: ${{ matrix.only }}
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
# Skip 32 bit builds and musllinux due to lack of numpy wheels
CIBW_SKIP: "*-win32 *_i686 *-musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.only }}
name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish to PyPI
Expand All @@ -144,4 +134,4 @@ jobs:
merge-multiple: true

- name: Publish Package
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.10.3
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
autoupdate_schedule: 'quarterly'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v5.0.0"
hooks:
# Prevent giant files from being committed
- id: check-added-large-files
Expand All @@ -26,7 +26,7 @@ repos:
# Trims trailing whitespace
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
rev: "v2.3.0"
hooks:
- id: codespell
types_or: [python, markdown, rst]
Expand All @@ -37,7 +37,7 @@ repos:
- id: sort-all
types: [file, python]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.9'
rev: 'v0.6.9'
hooks:
- id: ruff
args: [--fix]
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please see docs/source/whats_new.rst for a changelog.
Please see docs/source/whatsnew/ for a changelog.
16 changes: 8 additions & 8 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Other binaries
Additional pre-built binaries can be found at a variety of sources, including:

* `Conda <https://conda.io/miniconda.html>`_
* Christoph Gohlke (https://www.lfd.uci.edu/~gohlke/pythonlibs/)
* Christoph Gohlke (https://github.com/cgohlke/geospatial-wheels/)
maintains unofficial Windows binaries of cartopy.
* `OSGeo Live <https://live.osgeo.org>`_.

Expand Down Expand Up @@ -59,20 +59,20 @@ To use it::

Further information about the required dependencies can be found here:

**Python** 3.9 or later (https://www.python.org/)
**Python** 3.10 or later (https://www.python.org/)
Python 2 support was removed in v0.19.

**Matplotlib** 3.5 or later (https://matplotlib.org/)
**Matplotlib** 3.6 or later (https://matplotlib.org/)
Python package for 2D plotting. Python package required for any
graphical capabilities.

**Shapely** 1.7.1 or later (https://github.com/shapely/shapely)
**Shapely** 2.0 or later (https://github.com/shapely/shapely)
Python package for the manipulation and analysis of planar geometric objects.

**pyshp** 2.3 or later (https://pypi.python.org/pypi/pyshp)
Pure Python read/write support for ESRI Shapefile format.

**pyproj** 3.1.0 or later (https://github.com/pyproj4/pyproj/)
**pyproj** 3.3.1 or later (https://github.com/pyproj4/pyproj/)
Python interface to PROJ (cartographic projections and coordinate transformations library).

Optional Dependencies
Expand All @@ -83,17 +83,17 @@ to install these optional dependencies. They are also included in some of the
optional groups when installing. For example, use `pip install .[ows]` to install
the optional OWS libraries.

**Pillow** 6.1.0 or later (https://python-pillow.org)
**Pillow** 9.1 or later (https://python-pillow.org)
A popular fork of PythonImagingLibrary.

**pykdtree** 1.2.2 or later (https://github.com/storpipfugl/pykdtree)
A fast kd-tree implementation that is used for faster warping
of images than SciPy.

**SciPy** 1.6.3 or later (https://www.scipy.org/)
**SciPy** 1.9 or later (https://www.scipy.org/)
A Python package for scientific computing.

**OWSLib** 0.24.1 or later (https://pypi.python.org/pypi/OWSLib)
**OWSLib** 0.27 or later (https://pypi.python.org/pypi/OWSLib)
A Python package for client programming with the Open Geospatial
Consortium (OGC) web service, and which gives access to Cartopy ogc
clients.
Expand Down
5 changes: 3 additions & 2 deletions docs/make_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def utm_plot():

COASTLINE_RESOLUTION = {ccrs.OSNI: '10m',
ccrs.OSGB: '50m',
ccrs.EuroPP: '50m'}
ccrs.EuroPP: '50m',
ccrs.LambertZoneII: '10m'}


PRJ_SORT_ORDER = {'PlateCarree': 1,
Expand All @@ -91,7 +92,7 @@ def utm_plot():
'Orthographic': 2, 'UTM': 2, 'AlbersEqualArea': 2,
'AzimuthalEquidistant': 2, 'Sinusoidal': 2,
'InterruptedGoodeHomolosine': 3, 'RotatedPole': 3,
'OSGB': 4, 'EuroPP': 5,
'OSGB': 4, 'LambertZoneII': 4.1, 'EuroPP': 5,
'Geostationary': 6, 'NearsidePerspective': 7,
'EckertI': 8.1, 'EckertII': 8.2, 'EckertIII': 8.3,
'EckertIV': 8.4, 'EckertV': 8.5, 'EckertVI': 8.6}
Expand Down
Binary file modified docs/source/_static/cartopy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/_static/copyright_license.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Data Provider;Cartopy Function;Citation (short);Citation (long);License;Terms of Use Information
OpenStreetMap;:mod:`img_tiles.OSM <cartopy.io.img_tiles>`;|copy| OpenStreetMap;Map data |copy| OpenStreetMap contributors;`Open Database Licence <www.opendatacommons.org/licenses/odbl>`_;`Legal FAQ <https://wiki.openstreetmap.org/wiki/Legal_FAQ#3a._I_would_like_to_use_OpenStreetMap_maps._How_should_I_credit_you.3F>`_
OpenStreetMap;:mod:`img_tiles.OSM <cartopy.io.img_tiles>`;|copy| OpenStreetMap;Map data |copy| OpenStreetMap contributors;`Open Database Licence <https://www.opendatacommons.org/licenses/odbl>`_;`Legal FAQ <https://wiki.openstreetmap.org/wiki/Legal_FAQ#3a._I_would_like_to_use_OpenStreetMap_maps._How_should_I_credit_you.3F>`_
Natural Earth raster + vector map data;:class:`NaturalEarthFeature <cartopy.feature.NaturalEarthFeature>`;Made with Natural Earth.;Made with Natural Earth. Free vector and raster map data @ naturalearthdata.com.;`Public Domain <https://creativecommons.org/publicdomain/>`_;`Terms of Use <https://www.naturalearthdata.com/about/terms-of-use/>`_
6 changes: 3 additions & 3 deletions docs/source/citation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ For example::

Cartopy. Met Office. git@github.com:SciTools/cartopy.git. 2015-02-18. 7b2242e.

.. _How to cite and describe software: https://software.ac.uk/so-exactly-what-software-did-you-use
.. _How to cite and describe software: https://www.software.ac.uk/publication/how-cite-and-describe-software


[Jackson] Jackson, M. 2012. `How to cite and describe software`_. Accessed 2013-03-06.
[Jackson] Jackson, M. 2012. `How to cite and describe software`_. Accessed 2024-03-15.


.. _referencing_copyright:
Expand Down Expand Up @@ -87,4 +87,4 @@ The corresponding information for the data providers included in cartopy is list
.. |---| unicode:: U+02014 .. em dash
:trim:

The `feature_creation example <./examples/feature_creation.html>`_ shows such annotation for Natural Earth data.
The `feature_creation example <./gallery/lines_and_polygons/feature_creation.html>`_ shows such annotation for Natural Earth data.
Loading

0 comments on commit 727e25f

Please sign in to comment.