-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build and publish to PyPI via CI, use Limited API (Stable ABI) #2
Conversation
- Move metadata from setup.py into pyproject.toml - Add Adam Biser to the list of authors - Add myself (Laurence Dougal Myers) to the list of maintainers - Add minimum Python version of 2.7 - Increase version to 1.4 - Produce a wheel - setup.py: replace `distutils` with `setuptools` - README: convert to Markdown; add more contributor copyrights; update the example scripts. - .gitignore: ignore IDEA project dir, wheel build dirs, and venv (virtual environment) dir
Skip Python 3.6, which produces `UNKNOWN-` eggs due to bugs picking up system-level build dependencies, and Python 3.7. They've both reached EOL and are no longer supported. Taken directly from the docs. @see https://cibuildwheel.readthedocs.io/en/v2.16.2/setup/#github-actions
Remove cibuildwheel config to skip Python 3.6 and 3.7, just set the minimum version to v3.8
…ng support for Python 2.7)
… artifacts. Use v4 of upload/download actions.
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
@adambiser If you have time, I'd appreciate if you could have a quick look over my changes, particularly the C++ side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't comment too much on the accuracy of the code as it's been years since I've been involved with Python, but nothing immediately stands out as problematic - it looks good. Thanks for taking the time to do all these updates!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look correct to me.
This should allow all future versions of Python to run PyOPL, without needing a wheel built just for that version. ## Changes - setup.py: When building Python v3.11 or higher: - Set macro `Py_LIMITED_API` - Set option `py_limited_api` - Add tags `cp311` and `abi3` (cp311 is the lowest supported version) - pyopl.cpp: - Use a heap-allocated (dynamic) type. (Static types aren't supported by the Static ABI) - Replace `tp_alloc()` call with direct call to `PyType_GenericAlloc`. (The type object doesn't seem to be accessible in the static ABI, and I couldn't work out how to look up the `tp_alloc` pointer, so I've just assumed it will always use the default generic allocator)
- Change version to 2.0 - Publish to PyPI proper (not the Test PyPI)
… PCM data. This uses code adapted from DRO Trimmer by Laurence Dougal Myers. @see https://www.laurencedougalmyers.net/apps/drotrimmer/
b39cb5d
to
aa8a221
Compare
- Fix tests by CDing into the project directory. - Fix types to be compatible with Python v3.8. - Fix travelling up to test parent directory - Fix "path is on mount 'D:', start on mount 'C:'" on Windows by explicitly changing drive
Thank you both for the reviews. 🙂 I fixed up some issues, and added a simple regression test, mostly to make sure the wheels run properly on each build. I'll merge the changes and publish a new version to PyPI soon(ish, when I feel up to it). |
cibuildwheel
Py_LIMITED_API
py_limited_api
cp311
andabi3
(cp311 is the lowest supported version)PyOPLType
. (Static types aren't supported by the Limited API.)tp_alloc()
call with direct call toPyType_GenericAlloc
. (The type object doesn't seem to be accessible in the Limited API, and I couldn't work out how to look up thetp_alloc
pointer without a type object, so I've just assumed it will always use the default generic allocator.)README
to Markdownbytearray
forbuffer
Minimum supported version
The minimum supported version of Python is v3.8, since this is the oldest actively maintained version.
Python release status chart
https://devguide.python.org/versions/
ABI3 audit
It's possible to tag a wheel as adhering to
abi3
when it doesn't really, so I ranabi3audit
, which didn't find any problems.Testing
I've only tested the module on Python 3.11, Windows 64-bit.
PyPI entry
https://test.pypi.org/project/PyOPL/
Here's how the PyPI entry looks.
Click to see screenshots
CI workflow
Here's an example CI run.
https://github.com/Malvineous/pyopl/actions/runs/7668724733
Click to see screenshots
Building on Python 3.12 is skipped, because the build for v3.11 supports the stable ABI, so no need for a new wheel.
Closes #1