Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into maximum-insribed-ci…
Browse files Browse the repository at this point in the history
…rcle
  • Loading branch information
jorisvandenbossche committed Mar 10, 2024
2 parents 1069310 + 0772979 commit d74e625
Show file tree
Hide file tree
Showing 33 changed files with 1,262 additions and 175 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Expand Up @@ -4,12 +4,12 @@ jobs:
linux-aarch64-wheels:
working_directory: ~/linux-aarch64-wheels
machine:
image: ubuntu-2004:2022.04.1
image: default
# resource_class is what tells CircleCI to use an ARM worker for native arm builds
# https://circleci.com/product/features/resource-classes/
resource_class: arm.medium
environment:
GEOS_VERSION: 3.12.0
GEOS_VERSION: 3.12.1
CIBUILDWHEEL: 1
CIBW_BUILD: "cp*-manylinux_aarch64"
CIBW_ENVIRONMENT_PASS_LINUX: "GEOS_VERSION GEOS_INSTALL GEOS_CONFIG LD_LIBRARY_PATH"
Expand All @@ -21,7 +21,7 @@ jobs:
- run:
name: Build the Linux aarch64 wheels.
command: |
python3 -m pip install --user cibuildwheel==2.16.2
python3 -m pip install --user cibuildwheel==2.16.4
echo 'export GEOS_INSTALL=~/linux-aarch64-wheels/geosinstall/geos-"$GEOS_VERSION"' >> "$BASH_ENV"
echo 'export GEOS_CONFIG="$GEOS_INSTALL"/bin/geos-config' >> "$BASH_ENV"
echo 'export LD_LIBRARY_PATH="$GEOS_INSTALL"/lib' >> "$BASH_ENV"
Expand All @@ -39,5 +39,6 @@ workflows:
only:
- main
- maint-2.0
- wheels-linux-aarch64
tags:
only: /.*/
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Expand Up @@ -9,12 +9,12 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Run black, flake8 and isort
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1

- name: Validate citation file
shell: bash
Expand Down
54 changes: 41 additions & 13 deletions .github/workflows/release.yml
Expand Up @@ -13,6 +13,9 @@ on:
- "MANIFEST.in"
- "pyproject.toml"
- "setup.py"
schedule:
# in addition run weekly for nightly upload in case no other commits happened
- cron: '34 2 * * 0'

jobs:
build_sdist:
Expand All @@ -26,7 +29,7 @@ jobs:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand All @@ -37,16 +40,17 @@ jobs:
python -m build --sdist
twine check --strict dist/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: release-sdist
path: ./dist/*.tar.gz
retention-days: 30

build_wheels:
name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
GEOS_VERSION: "3.12.0"
GEOS_VERSION: "3.12.1"
strategy:
fail-fast: false
matrix:
Expand All @@ -71,12 +75,9 @@ jobs:
- os: macos-11
arch: x86_64
cmake_osx_architectures: x86_64
- os: macos-11
- os: macos-14
arch: arm64
cmake_osx_architectures: arm64
- os: macos-11
arch: universal2
cmake_osx_architectures: "x86_64;arm64"

steps:
- name: Checkout source
Expand All @@ -85,7 +86,7 @@ jobs:
fetch-depth: 0

- name: Cache GEOS build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ env.GEOS_VERSION }}-${{ hashFiles('ci/*') }}
Expand Down Expand Up @@ -114,10 +115,11 @@ jobs:
if: ${{ matrix.msvc_arch }}

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: cp36-* pp* *musllinux* *-manylinux_i686
CIBW_TEST_SKIP: "cp38-macosx_arm64"
CIBW_ENVIRONMENT_LINUX:
GEOS_VERSION=${{ env.GEOS_VERSION }}
GEOS_INSTALL=/host${{ runner.temp }}/geos-${{ env.GEOS_VERSION }}
Expand All @@ -135,27 +137,53 @@ jobs:
GEOS_INCLUDE_PATH='${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\include'
CIBW_BEFORE_ALL: ./ci/install_geos.sh
CIBW_BEFORE_ALL_WINDOWS: ci\install_geos.cmd
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
# TEMP don't use automated/isolated build environment, but manually
# install build dependencies so we can build with numpy 2.0
# once numpy 2.0 is out, this can be removed again
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
CIBW_BEFORE_BUILD: pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy setuptools cython
CIBW_BEFORE_BUILD_WINDOWS:
pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy setuptools cython
pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path ${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\bin -w {dest_dir} {wheel}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest --pyargs shapely.tests

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
retention-days: 5

nightly_upload:
name: Upload nightly wheels
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.repository == 'shapely/shapely' && github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: dist
- name: Upload wheels to Anaconda Cloud
uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{secrets.ANACONDA_ORG_UPLOAD_TOKEN}}

publish:
name: Publish on GitHub and PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# release on every tag
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: release-*
merge-multiple: true
path: dist

- name: Create GitHub Release
Expand Down
36 changes: 22 additions & 14 deletions .github/workflows/tests.yml
Expand Up @@ -14,28 +14,28 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
architecture: [x64]
geos: [3.8.3, 3.9.4, 3.10.5, 3.11.2, 3.12.0, main]
geos: [3.8.4, 3.9.5, 3.10.6, 3.11.3, 3.12.1, main]
include:
# 2019
- python: 3.8
geos: 3.8.3
geos: 3.8.4
numpy: 1.17.3
# 2020
- python: 3.9
geos: 3.9.4
geos: 3.9.5
numpy: 1.19.5
# 2021
- python: "3.10"
geos: 3.10.5
geos: 3.10.6
numpy: 1.21.3
# 2022
- python: "3.11"
geos: 3.11.2
geos: 3.11.3
numpy: 1.23.4
# 2023
- python: "3.12"
geos: 3.12.0
numpy: 1.26.0
geos: 3.12.1
numpy: 1.26.2
matplotlib: true
doctest: true
# extra ignore for dateutil Python 3.12 warning fixed upstream (waiting on release 2.8.3+)
Expand All @@ -49,17 +49,17 @@ jobs:
- os: windows-2019
architecture: x86
python: 3.8
geos: 3.8.3
geos: 3.8.4
numpy: 1.16.2
- os: windows-2019
architecture: x86
python: "3.11"
geos: 3.12.0
geos: 3.12.1
numpy: 1.24.4
# pypy (use explicit ubuntu version to not overwrite existing ubuntu-latest + geos 3.11.0 build)
- os: ubuntu-22.04
python: "pypy3.8"
geos: 3.12.0
geos: 3.12.1
numpy: 1.24.4

env:
Expand Down Expand Up @@ -93,14 +93,14 @@ jobs:
if: ${{ matrix.geos == 'main' }}

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}
allow-prereleases: true

- name: Cache GEOS and pip packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.architecture }}-geos-${{ env.GEOS_VERSION_SPEC }}-${{ hashFiles('ci/install_geos.sh') }}
path: |
Expand All @@ -122,7 +122,8 @@ jobs:
python -m pip install --disable-pip-version-check --upgrade pip
pip install --upgrade wheel setuptools
if [ -z "${{ matrix.numpy }}" ]; then
pip install --upgrade --pre Cython numpy pytest pytest-cov coveralls;
pip install --upgrade --pre Cython pytest pytest-cov coveralls;
pip install --upgrade --pre --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
else
pip install --upgrade Cython numpy==${{ matrix.numpy }} pytest pytest-cov coveralls;
fi
Expand Down Expand Up @@ -157,8 +158,15 @@ jobs:
if: ${{ matrix.os == 'windows-2019' }}

- name: Build and install Shapely
# for the numpy nightly build, we temporarily need to build without
# the standard build isolation based on build-system.requires, to
# ensure we build against numpy nightly (numpy 2.0 compat)
run: |
pip install -e .
if [ -z "${{ matrix.numpy }}" ]; then
pip install -e . --no-build-isolation
else
pip install -e .
fi
- name: Overview of the Python environment (pip list)
run: pip list
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Expand Up @@ -12,6 +12,7 @@ build:
jobs:
post_checkout:
# we need the tags for versioneer to work
- git fetch origin --depth 150
- git fetch --tags
pre_install:
# to avoid "dirty" version
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,7 @@ if: (branch = main OR tag IS present) AND (type = push)

env:
global:
- GEOS_VERSION=3.12.0
- GEOS_VERSION=3.12.1

cache:
directories:
Expand Down
17 changes: 15 additions & 2 deletions CHANGES.txt
Expand Up @@ -19,9 +19,13 @@ Improvements:
signature in the ``transformation`` function.
- The ``include_z`` in ``shapely.transform()`` now also allows ``None``, which
lets it automatically detect the dimensionality of each input geometry.
- Upgraded the GEOS version in the binary wheel distributions to 3.12.0.
- Add parameters ``method`` and ``keep_collapsed`` to ``shapely.make_valid()`` (#1941)
- Upgraded the GEOS version in the binary wheel distributions to 3.12.1.
- The ``voronoi_polygons`` now accepts the ``ordered`` keyword, optionally forcing the
order of polygons within the GeometryCollection to follow the order of input
coordinates. Requires at least GEOS 3.12. (#1968)

Breaking changes in GEOS 3.12.0:
Breaking changes in GEOS 3.12:

- ``oriented_envelope`` / ``minimum_rotated_rectangle`` changed its implementation
in GEOS 3.12. Be aware that results will change when updating GEOS. Coincidentally
Expand All @@ -33,6 +37,15 @@ Breaking changes in GEOS 3.12.0:
- The WKT representation of a MULTIPOINT changed from for example "MULTIPOINT (0 0, 1 1)"
to "MULTIPOINT ((0 0), (1 1))". (#1885)

2.0.3 (2024-02-16)
------------------

- Fix regression in the ``oriented_envelope`` ufunc to accept array-like input
in case of GEOS<3.12 (#1929).
- The binary wheels are not yet compatible with a future NumPy 2.0 release,
therefore a ``numpy<2`` upper pin was added to the requirements (#1972).
- Upgraded the GEOS version in the binary wheel distributions to 3.11.3.


2.0.2 (2023-10-12)
------------------
Expand Down
57 changes: 57 additions & 0 deletions docs/code/make_valid_methods.py
@@ -0,0 +1,57 @@
from matplotlib import pyplot as plt
import shapely
from shapely.plotting import plot_points, plot_polygon, plot_line

from figures import BLUE, GRAY, RED

input = shapely.MultiPolygon(
[
shapely.Polygon(
[
(2, 0),
(2, 12),
(7, 12),
(7, 10),
(7, 12),
(10, 12),
(8, 12),
(8, 0),
(2, 0),
],
[[(3, 10), (5, 10), (5, 12), (3, 12), (3, 10)]],
),
shapely.Polygon(
[(4, 2), (4, 8), (12, 8), (12, 2), (4, 2)],
[[(6, 4), (10, 4), (10, 6), (6, 6), (6, 4)]],
),
]
)

fig, ax = plt.subplots(1, 3, sharex=True, sharey=True, figsize=(11, 4), dpi=90)
plot_polygon(input, ax=ax[0], add_points=False, color=BLUE)
plot_points(input, ax=ax[0], color=GRAY, alpha=0.7)
ax[0].set_title("invalid input")
ax[0].set_aspect("equal")

# Structure makevalid
valid_structure = shapely.make_valid(input, method="structure", keep_collapsed=True)
plot_polygon(valid_structure, ax=ax[1], add_points=False, color=BLUE)
plot_points(valid_structure, ax=ax[1], color=GRAY, alpha=0.7)

ax[1].set_title("make_valid - structure")
ax[1].set_aspect("equal")

# Linework makevalid
valid_linework = shapely.make_valid(input)
for geom in valid_linework.geoms:
if isinstance(geom, shapely.MultiPolygon):
plot_polygon(geom, ax=ax[2], add_points=False, color=BLUE)
plot_points(geom, ax=ax[2], color=GRAY, alpha=0.7)
else:
plot_line(geom, ax=ax[2], color=RED, linewidth=1)
plot_points(geom, ax=ax[2], color=GRAY, alpha=0.7)
ax[2].set_title("make_valid - linework")
ax[2].set_aspect("equal")

fig.tight_layout()
plt.show()

0 comments on commit d74e625

Please sign in to comment.