Skip to content

Commit 1524fea

Browse files
authored
V0.2.0 (#8)
* Updated version. * Added new code.
1 parent dcc41ba commit 1524fea

7 files changed

Lines changed: 14545 additions & 14575 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/wheels.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
os: [ubuntu-latest, macos-13, macos-14]
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616

1717
- name: Build wheels
18-
uses: pypa/cibuildwheel@v3.1.3
18+
uses: pypa/cibuildwheel@v3.4.1
1919
env:
20-
# Build fails for PyPy and py3.14t
21-
CIBW_SKIP: pp* cp314t*
20+
# Build fails for PyPy and py3.14t; py3.9 is EOL and no longer supported
21+
CIBW_SKIP: pp* cp39* cp314t*
2222

2323
- uses: actions/upload-artifact@v4
2424
with:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ python setup.py build_ext --inplace --force
5555

5656
Remember to disable cython afterwards by setting `USE_CYTHON=False` in setup.py.
5757

58+
> **Maintainers:** see [scripts/RELEASE.md](scripts/RELEASE.md) for the full release process.
59+
5860
### License
5961

6062
The python wrapper code is licensed under Apache 2.0. [Zeo++

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = 'pyzeo'
7-
version = '0.1.7'
7+
version = '0.2.0'
88
description = 'Python interface to Zeo++'
99
readme = "README.md"
1010
authors = [{ name = "Lauri Himanen" }]
1111
license = { file = "LICENSE" }
12-
requires-python = ">=3.9"
12+
requires-python = ">=3.10"
1313
dependencies = []
1414
classifiers = [
1515
"Development Status :: 3 - Alpha",
1616
"Programming Language :: C++",
1717
"Programming Language :: Cython",
1818
"Programming Language :: Python",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
2322
"Programming Language :: Python :: 3.12",

scripts/RELEASE.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Making a release
2+
3+
pyzeo ships a Cython-based C++ extension. Following [Cython's
4+
recommendation](https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules),
5+
the **pre-generated `src/pyzeo/extension.cpp` is committed and shipped** so end
6+
users do not need Cython to build from source (`setup.py` sets
7+
`USE_CYTHON = False`).
8+
9+
Releases are published **manually with `twine`**: bump the version, regenerate
10+
the C++ from the `.pyx`, build wheels via the `wheels` GitHub Actions workflow,
11+
then upload the sdist + wheels to PyPI.
12+
13+
## Prerequisites
14+
15+
```sh
16+
python -m pip install --upgrade pip
17+
pip install --upgrade setuptools wheel cython build twine
18+
```
19+
20+
`setuptools`, `wheel` and `cython` are needed to regenerate the C++ source and
21+
compile (step 1); `build` and `twine` are used to package and upload (steps 3,
22+
5). On Python 3.12+ `distutils` was removed from the standard library, so an
23+
up-to-date `setuptools` (which vendors a `distutils` shim) is required.
24+
25+
- A C++ compiler and the Python development headers (step 1 compiles the
26+
extension after regenerating the C++). On Debian/Ubuntu, for the Python
27+
version you build with: `sudo apt install pythonX.Y-dev` (e.g.
28+
`python3.13-dev`). Without them the build fails with
29+
`fatal error: Python.h: No such file or directory`.
30+
- A PyPI account with upload rights to `pyzeo`, configured via `~/.pypirc` or a
31+
token passed to `twine`.
32+
- The [`gh`](https://cli.github.com/) CLI authenticated to this repo (used to
33+
trigger the workflow and download artifacts).
34+
35+
## 1. Regenerate the Cython C++ source
36+
37+
This keeps the shipped `extension.cpp` in sync with the current `extension.pyx`
38+
and a current Cython.
39+
40+
```sh
41+
# 1. In setup.py set: USE_CYTHON = True
42+
python setup.py build_ext --inplace --force
43+
# 2. Revert setup.py back to: USE_CYTHON = False
44+
```
45+
46+
Commit the regenerated `src/pyzeo/extension.cpp`. The `.so` produced is
47+
gitignored — do **not** commit it.
48+
49+
## 2. Bump the version
50+
51+
Edit `version` in `pyproject.toml`. Update the `requires-python` value and the
52+
`Programming Language :: Python :: 3.x` classifiers if the supported Python
53+
range changed (also update the matrix in `.github/workflows/test.yml` and
54+
`CIBW_SKIP` in `.github/workflows/wheels.yml` accordingly).
55+
56+
## 3. Build & sanity-check the sdist locally
57+
58+
```sh
59+
python -m build --sdist
60+
tar tzf dist/pyzeo-<version>.tar.gz | grep extension.cpp # must be present
61+
```
62+
63+
Optional but recommended — prove a from-source install compiles without Cython:
64+
65+
```sh
66+
python -m venv /tmp/pyzeo-test && source /tmp/pyzeo-test/bin/activate
67+
pip install dist/pyzeo-<version>.tar.gz
68+
cd tests && pytest
69+
deactivate
70+
```
71+
72+
> Note: only `extension.cpp` (not `.pyx`/`.pxd`) ships in the sdist. The bundled
73+
> `.cc`/`.h`/`.hh`/Eigen files come from the `setup.py` Extension sources +
74+
> `MANIFEST.in`.
75+
76+
## 4. Build the wheels (CI)
77+
78+
Push the version bump + regenerated `.cpp` to `main` (or a release branch and
79+
merge it). Then trigger the **wheels** workflow — it is `workflow_dispatch`-only:
80+
81+
```sh
82+
gh workflow run wheels.yml --ref main
83+
```
84+
85+
(Or via the GitHub Actions UI → "wheels" → Run workflow.)
86+
87+
When the run finishes, download the built wheels into `dist/` (one artifact per
88+
OS: ubuntu, macos-13, macos-14):
89+
90+
```sh
91+
gh run download <run-id> -n cibw-wheels-* -D dist/
92+
```
93+
94+
## 5. Upload to PyPI
95+
96+
```sh
97+
twine check dist/pyzeo-<version>* # validate sdist + wheels
98+
twine upload dist/pyzeo-<version>.tar.gz dist/pyzeo-<version>-*.whl
99+
```
100+
101+
Upload the sdist and all wheels together. To rehearse first, upload to TestPyPI:
102+
`twine upload --repository testpypi dist/pyzeo-<version>*`.
103+
104+
## 6. Tag the release
105+
106+
```sh
107+
git tag v<version>
108+
git push origin v<version>
109+
gh release create v<version> --generate-notes # optional GitHub Release
110+
```
111+
112+
## Checklist
113+
114+
- [ ] Regenerated `extension.cpp` (USE_CYTHON True → build → False) and committed it
115+
- [ ] Bumped `version` in `pyproject.toml` (+ classifiers / Python range if changed)
116+
- [ ] `python -m build --sdist`; confirmed `extension.cpp` is in the tarball
117+
- [ ] (Optional) clean-venv install of the sdist + `pytest` passes
118+
- [ ] Pushed to `main`, ran `gh workflow run wheels.yml`, downloaded artifacts
119+
- [ ] `twine check` + `twine upload` of sdist and all wheels
120+
- [ ] Tagged `v<version>` and pushed the tag

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import sys
22
import platform
3-
from distutils.ccompiler import new_compiler
4-
from distutils.sysconfig import customize_compiler
3+
# Import setuptools before distutils so that, on Python 3.12+ where distutils was
4+
# removed from the standard library, setuptools' vendored distutils shim is used.
55
from setuptools import setup
66
from setuptools.extension import Extension
7+
from distutils.ccompiler import new_compiler
8+
from distutils.sysconfig import customize_compiler
79
from subprocess import getoutput
810

911

1012
# Check python version
11-
if sys.version_info[:2] < (3, 8):
12-
raise RuntimeError("Python version >= 3.8 required.")
13+
if sys.version_info[:2] < (3, 10):
14+
raise RuntimeError("Python version >= 3.10 required.")
1315

1416
# The recommendation
1517
# (https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules)

0 commit comments

Comments
 (0)