Skip to content

Commit f998920

Browse files
authored
Merge pull request #66 from fonttools/remove-dev-trick
require 3.10; simplify build to always use Cython via isolated builds
2 parents 60edf4d + bb60146 commit f998920

7 files changed

Lines changed: 35 additions & 136 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ jobs:
4444
strategy:
4545
fail-fast: false
4646
matrix:
47-
# macos-13 runners are still x86_64, macos-14 (latest) are arm64; we want to build
48-
# the x86_64 wheel on/for x86_64 macs
49-
os: [macos-13, windows-latest]
47+
# macos-15-intel is x86_64; macos-latest is arm64
48+
os: [macos-15-intel, windows-latest]
5049
arch: [auto64]
5150
build: ["*"]
5251
skip: ["pp*"]
@@ -92,38 +91,36 @@ jobs:
9291
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.type }}
9392

9493
build_arch_wheels:
95-
name: py${{ matrix.python }} on ${{ matrix.arch }}
96-
runs-on: ubuntu-latest
97-
strategy:
98-
matrix:
99-
# aarch64 uses qemu so it's slow, build each py version in parallel jobs
100-
python: [310, 311, 312, 313, 314]
101-
arch: [aarch64]
94+
name: Build wheels on Linux ARM64
95+
runs-on: ubuntu-24.04-arm
10296
steps:
103-
- uses: actions/checkout@v2
97+
- uses: actions/checkout@v4
10498
with:
10599
fetch-depth: 0
106-
- uses: docker/setup-qemu-action@v1.2.0
100+
- name: Set up Python
101+
uses: actions/setup-python@v5
107102
with:
108-
platforms: all
103+
python-version: "3.x"
109104
- name: Install dependencies
110105
run: pip install cibuildwheel
111106
- name: Build Wheels
112107
run: python -m cibuildwheel --output-dir wheelhouse .
113108
env:
114-
CIBW_BUILD: cp${{ matrix.python }}-manylinux*
115-
CIBW_ARCHS: ${{ matrix.arch }}
109+
CIBW_BUILD: "cp310-manylinux* cp311-manylinux* cp312-manylinux* cp313-manylinux* cp314-manylinux*"
116110
- uses: actions/upload-artifact@v4
117111
with:
118112
path: wheelhouse/*.whl
119-
name: wheels-${{ matrix.arch }}-${{ matrix.python }}
113+
name: wheels-linux-arm64
120114

121115
deploy:
122116
name: Upload if tagged commit
123117
if: startsWith(github.ref, 'refs/tags/')
124118
# but only if all build jobs completed successfully
125119
needs: [build_wheels, build_arch_wheels, build_sdist]
126120
runs-on: ubuntu-latest
121+
permissions:
122+
id-token: write
123+
contents: write
127124

128125
steps:
129126
- uses: actions/checkout@v4
@@ -163,7 +160,5 @@ jobs:
163160
draft: false
164161
prerelease: ${{ env.IS_PRERELEASE }}
165162

166-
- uses: pypa/gh-action-pypi-publish@v1.4.2
167-
with:
168-
user: __token__
169-
password: ${{ secrets.PYPI_PASSWORD }}
163+
- name: Publish to PyPI
164+
uses: pypa/gh-action-pypi-publish@release/v1

MANIFEST.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.rst

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Pyclipper is a Cython wrapper exposing public functions and classes of
1010
the C++ translation of the `Angus Johnson's Clipper library (ver.
1111
6.4.2) <http://www.angusj.com/delphi/clipper.php>`__.
1212

13-
Pyclipper releases were tested with Python 2.7 and 3.4 on Linux (Ubuntu
14-
14.04, x64) and Windows (8.1, x64).
15-
1613
Source code is available on
1714
`GitHub <https://github.com/fonttools/pyclipper>`__. The package is published on
1815
`PyPI <https://pypi.python.org/pypi/pyclipper>`__.
@@ -35,45 +32,17 @@ About Clipper
3532
Install
3633
=======
3734

38-
Dependencies
39-
------------
40-
41-
Cython dependency is optional. Cpp sources generated with Cython are
42-
available in releases.
43-
44-
Note on using the ``setup.py``:
45-
46-
``setup.py`` operates in 2 modes that are based on the presence of the
47-
``dev`` file in the root of the project.
48-
49-
- When ``dev`` is **present**, Cython will be used to compile the ``.pyx``
50-
sources. This is the *development mode* (as you get it in the git
51-
repository).
52-
- When ``dev`` is **absent**, C/C++ compiler will be used to compile the
53-
``.cpp`` sources (that were prepared in in the development mode).
54-
This is the distribution mode (as you get it on PyPI).
55-
56-
This way the package can be used without or with an incompatible version
57-
of Cython.
58-
59-
The idea comes from `Matt Shannon's bandmat
60-
library <https://github.com/MattShannon/bandmat>`__.
61-
6235
From PyPI
6336
---------
6437

65-
Cython not required.
66-
6738
::
6839

6940
pip install pyclipper
70-
41+
7142

7243
From source
7344
-----------
7445

75-
Cython required.
76-
7746
Clone the repository:
7847

7948
::
@@ -85,15 +54,13 @@ Install:
8554

8655
::
8756

88-
python setup.py install
89-
57+
pip install .
9058

91-
After every modification of ``.pyx`` files compile with Cython:
59+
For development, use an editable install:
9260

9361
::
9462

95-
python setup.py build_ext --inplace
96-
63+
pip install -e .
9764

9865
Clippers' preprocessor directives
9966
---------------------------------
@@ -196,6 +163,8 @@ License
196163
Changelog
197164
=========
198165

166+
For recent versions, see the `GitHub Releases page <https://github.com/fonttools/pyclipper/releases>`__.
167+
199168
1.1.0
200169
-------
201170

dev

Whitespace-only changes.

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ requires = [
55
"setuptools_scm",
66
"cython",
77
]
8-
98
build-backend = "setuptools.build_meta"
9+
10+
[tool.pytest.ini_options]
11+
testpaths = ["tests"]
12+
addopts = "-v -ra"

setup.cfg

Lines changed: 0 additions & 13 deletions
This file was deleted.

setup.py

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,9 @@
1-
from __future__ import print_function
2-
import sys
3-
import os
41
from setuptools import setup, find_packages
52
from setuptools.extension import Extension
6-
from io import open
3+
from Cython.Distutils import build_ext
74

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

16-
This way the package can be used without or with an incompatible version of Cython.
17-
18-
The idea comes from: https://github.com/MattShannon/bandmat
19-
"""
20-
dev_mode = os.path.exists('dev')
21-
22-
if dev_mode:
23-
from Cython.Distutils import build_ext
24-
25-
print('Development mode: Compiling Cython modules from .pyx sources.')
26-
sources = ["src/pyclipper/_pyclipper.pyx", "src/clipper.cpp"]
27-
28-
from setuptools.command.sdist import sdist as _sdist
29-
30-
class sdist(_sdist):
31-
""" Run 'cythonize' on *.pyx sources to ensure the .cpp files included
32-
in the source distribution are up-to-date.
33-
"""
34-
def run(self):
35-
from Cython.Build import cythonize
36-
cythonize(sources, language_level="2")
37-
_sdist.run(self)
38-
39-
cmdclass = {'sdist': sdist, 'build_ext': build_ext}
40-
41-
else:
42-
print('Distribution mode: Compiling Cython generated .cpp sources.')
43-
sources = ["src/pyclipper/_pyclipper.cpp", "src/clipper.cpp"]
44-
cmdclass = {}
45-
46-
47-
needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
48-
pytest_runner = ['pytest_runner'] if needs_pytest else []
6+
sources = ["src/pyclipper/_pyclipper.pyx", "src/clipper.cpp"]
497

508

519
ext = Extension("pyclipper._pyclipper",
@@ -73,12 +31,18 @@ def run(self):
7331
maintainer="Cosimo Lupo",
7432
maintainer_email="cosimo@anthrotype.com",
7533
license='MIT',
76-
url='https://github.com/greginvm/pyclipper',
34+
url='https://github.com/fonttools/pyclipper',
7735
keywords=[
7836
'polygon clipping, polygon intersection, polygon union, polygon offsetting, polygon boolean, polygon, clipping, clipper, vatti'],
37+
python_requires=">=3.10",
7938
classifiers=[
8039
"Programming Language :: Python",
8140
"Programming Language :: Python :: 3",
41+
"Programming Language :: Python :: 3.10",
42+
"Programming Language :: Python :: 3.11",
43+
"Programming Language :: Python :: 3.12",
44+
"Programming Language :: Python :: 3.13",
45+
"Programming Language :: Python :: 3.14",
8246
"Programming Language :: Cython",
8347
"Programming Language :: C++",
8448
"Environment :: Other Environment",
@@ -94,10 +58,5 @@ def run(self):
9458
package_dir={"": "src"},
9559
packages=find_packages(where="src"),
9660
ext_modules=[ext],
97-
setup_requires=[
98-
'cython>=0.28',
99-
'setuptools_scm>=1.11.1',
100-
] + pytest_runner,
101-
tests_require=['pytest'],
102-
cmdclass=cmdclass,
61+
cmdclass={'build_ext': build_ext},
10362
)

0 commit comments

Comments
 (0)