Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ jobs:
strategy:
fail-fast: false
matrix:
# macos-13 runners are still x86_64, macos-14 (latest) are arm64; we want to build
# the x86_64 wheel on/for x86_64 macs
os: [macos-13, windows-latest]
# macos-15-intel is x86_64; macos-latest is arm64
os: [macos-15-intel, windows-latest]
arch: [auto64]
build: ["*"]
skip: ["pp*"]
Expand Down Expand Up @@ -92,38 +91,36 @@ jobs:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.type }}

build_arch_wheels:
name: py${{ matrix.python }} on ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
# aarch64 uses qemu so it's slow, build each py version in parallel jobs
python: [310, 311, 312, 313, 314]
arch: [aarch64]
name: Build wheels on Linux ARM64
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v1.2.0
- name: Set up Python
uses: actions/setup-python@v5
with:
platforms: all
python-version: "3.x"
- name: Install dependencies
run: pip install cibuildwheel
- name: Build Wheels
run: python -m cibuildwheel --output-dir wheelhouse .
env:
CIBW_BUILD: cp${{ matrix.python }}-manylinux*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: "cp310-manylinux* cp311-manylinux* cp312-manylinux* cp313-manylinux* cp314-manylinux*"
- uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: wheels-${{ matrix.arch }}-${{ matrix.python }}
name: wheels-linux-arm64

deploy:
name: Upload if tagged commit
if: startsWith(github.ref, 'refs/tags/')
# but only if all build jobs completed successfully
needs: [build_wheels, build_arch_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -163,7 +160,5 @@ jobs:
draft: false
prerelease: ${{ env.IS_PRERELEASE }}

- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

43 changes: 6 additions & 37 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ Pyclipper is a Cython wrapper exposing public functions and classes of
the C++ translation of the `Angus Johnson's Clipper library (ver.
6.4.2) <http://www.angusj.com/delphi/clipper.php>`__.

Pyclipper releases were tested with Python 2.7 and 3.4 on Linux (Ubuntu
14.04, x64) and Windows (8.1, x64).

Source code is available on
`GitHub <https://github.com/fonttools/pyclipper>`__. The package is published on
`PyPI <https://pypi.python.org/pypi/pyclipper>`__.
Expand All @@ -35,45 +32,17 @@ About Clipper
Install
=======

Dependencies
------------

Cython dependency is optional. Cpp sources generated with Cython are
available in releases.

Note on using the ``setup.py``:

``setup.py`` operates in 2 modes that are based on the presence of the
``dev`` file in the root of the project.

- When ``dev`` is **present**, Cython will be used to compile the ``.pyx``
sources. This is the *development mode* (as you get it in the git
repository).
- When ``dev`` is **absent**, C/C++ compiler will be used to compile the
``.cpp`` sources (that were prepared in in the development mode).
This is the distribution mode (as you get it on PyPI).

This way the package can be used without or with an incompatible version
of Cython.

The idea comes from `Matt Shannon's bandmat
library <https://github.com/MattShannon/bandmat>`__.

From PyPI
---------

Cython not required.

::

pip install pyclipper


From source
-----------

Cython required.

Clone the repository:

::
Expand All @@ -85,15 +54,13 @@ Install:

::

python setup.py install

pip install .

After every modification of ``.pyx`` files compile with Cython:
For development, use an editable install:

::

python setup.py build_ext --inplace

pip install -e .

Clippers' preprocessor directives
---------------------------------
Expand Down Expand Up @@ -196,6 +163,8 @@ License
Changelog
=========

For recent versions, see the `GitHub Releases page <https://github.com/fonttools/pyclipper/releases>`__.

1.1.0
-------

Expand Down
Empty file removed dev
Empty file.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ requires = [
"setuptools_scm",
"cython",
]

build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-v -ra"
13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

61 changes: 10 additions & 51 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,9 @@
from __future__ import print_function
import sys
import os
from setuptools import setup, find_packages
from setuptools.extension import Extension
from io import open
from Cython.Distutils import build_ext

"""
Note on using the setup.py:
setup.py operates in 2 modes that are based on the presence of the 'dev' file in the root of the project.
- When 'dev' is present, Cython will be used to compile the .pyx sources. This is the development mode
(as you get it in the git repository).
- When 'dev' is absent, C/C++ compiler will be used to compile the .cpp sources (that were prepared in
in the development mode). This is the distribution mode (as you get it on PyPI).

This way the package can be used without or with an incompatible version of Cython.

The idea comes from: https://github.com/MattShannon/bandmat
"""
dev_mode = os.path.exists('dev')

if dev_mode:
from Cython.Distutils import build_ext

print('Development mode: Compiling Cython modules from .pyx sources.')
sources = ["src/pyclipper/_pyclipper.pyx", "src/clipper.cpp"]

from setuptools.command.sdist import sdist as _sdist

class sdist(_sdist):
""" Run 'cythonize' on *.pyx sources to ensure the .cpp files included
in the source distribution are up-to-date.
"""
def run(self):
from Cython.Build import cythonize
cythonize(sources, language_level="2")
_sdist.run(self)

cmdclass = {'sdist': sdist, 'build_ext': build_ext}

else:
print('Distribution mode: Compiling Cython generated .cpp sources.')
sources = ["src/pyclipper/_pyclipper.cpp", "src/clipper.cpp"]
cmdclass = {}


needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
pytest_runner = ['pytest_runner'] if needs_pytest else []
sources = ["src/pyclipper/_pyclipper.pyx", "src/clipper.cpp"]


ext = Extension("pyclipper._pyclipper",
Expand Down Expand Up @@ -73,12 +31,18 @@ def run(self):
maintainer="Cosimo Lupo",
maintainer_email="cosimo@anthrotype.com",
license='MIT',
url='https://github.com/greginvm/pyclipper',
url='https://github.com/fonttools/pyclipper',
keywords=[
'polygon clipping, polygon intersection, polygon union, polygon offsetting, polygon boolean, polygon, clipping, clipper, vatti'],
python_requires=">=3.10",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Cython",
"Programming Language :: C++",
"Environment :: Other Environment",
Expand All @@ -94,10 +58,5 @@ def run(self):
package_dir={"": "src"},
packages=find_packages(where="src"),
ext_modules=[ext],
setup_requires=[
'cython>=0.28',
'setuptools_scm>=1.11.1',
] + pytest_runner,
tests_require=['pytest'],
cmdclass=cmdclass,
cmdclass={'build_ext': build_ext},
)