Add Python 3.13 support and deploy a compiled wheel to PyPI#680
Add Python 3.13 support and deploy a compiled wheel to PyPI#680erikbern merged 16 commits intospotify:mainfrom
Conversation
Add support for Python 3.13 and configure deployment to PyPI. * **CI Configuration**: Update `.github/workflows/ci.yml` to include Python version 3.13 in the `python-version` matrix. * **Setup.py**: Update `setup.py` to list supported Python versions up to 3.13 in the `classifiers` list. * **Tox Configuration**: Update `tox.ini` to include Python 3.13 in the `envlist`. * **Publish Workflow**: Add a new GitHub Actions workflow in `.github/workflows/publish.yml` for publishing the package to PyPI. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/spotify/annoy?shareId=XXXX-XXXX-XXXX-XXXX).
|
Side note: I would be happy to implement Trusted Publishing for publishing to PyPI instead if you prefer |
|
Nice! But I don't think the publish step will work unless you have proper credentials set up? |
|
@erikbern Correct. It either needs the secret to be configured in GitHub Actions or I can change the code to use the Trusted Publishing option if you configure that on the PyPI side (which is what I recommend and we use since it is more secure - it restricts only GitHub Actions from the GitHub repository to publish to PyPI via OIDC). |
|
This workflow would make sense for a pure Python project, but not for a compiled one: I don’t think we should go for a single wheel built for x86_64 linux glibc if we can have all the platforms for no cost. State-of-the-art for compiled wheels published from GitHub is cibuildwheel’s GitHub action, which is very easy to set up! Please update the workflow for that one, it’ll make the package much more useful! |
|
@flying-sheep That makes sense. I'll try to remember to update the next time that I am in front of computer |
…g wheels * Install cibuildwheel instead of setuptools, wheel, and twine * Build wheels using cibuildwheel and save them to the `dist` folder * Upload built wheels as artifacts * Remove `sdist` build step
|
As per @flying-sheep 's suggestion, I have switched the workflow to use |
|
Wonderful! @erikbern could we get a release with this soon? |
|
@flying-sheep I did a quick test now in a GitHub Codespace and found a little bug that with the help of ChatGPT I was able to resolve. It looks like builds for all platforms works now. @erikbern How can I help you get this merged? |
…ish.yml` Thank you `mathematicalmichael` for the PR suggestion Co-authored-by: Michael Pilosov <40366263+mathematicalmichael@users.noreply.github.com>
Thank you to `mathematicalmichael` for the suggestion Co-authored-by: Michael Pilosov <40366263+mathematicalmichael@users.noreply.github.com>
|
@benglewis I wanted to give this a proper test with (trusted) publishing, and noticed that while everything built for macos and windows, the final step of "publish package" fails because its only meant to run on linux. a fix: move publishing out to a separate step publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
path: dist
merge-multiple: true
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}though now there's an error due to markup. oh the things testing reveals... PR with fixes: benglewis#1 (including ensuring sdist is uploaded) |
Co-authored-by: Ben Lewis <hello@blewis.me>
|
quick update:
demonstration of publishing to pypi under my own namespace as a test:
ive checked that I can |
|
Python 3.14 came out this month. Maybe it makes sense to update this to build wheels that are compatible with Python 3.14 as well? |
|
@ngoldbaum Once I merge @mathematicalmichael 's changes, then I can update this PR with Python 3.14 and hopefully @erikbern can then merge this :) |
|
Merging this with benglewis#1 (and added 3.14 support) would be awesome, but I think ideally every binary package should instead build ABI3 / stable ABI wheels. Stable ABI wheels can be installed with any Python version ≥ the ABI version you targeted (e.g.
|
|
I agree abi3 wheels are nice, but one note is that the free-threaded build does not (yet) support the stable ABI. So cp314-cp314t wheels are still needed. IMO supporting the free-threaded build shouldn't be blocked on setting up abi3 wheels, which free-threading suppory can't benefit from. |
validated publishing
|
@erikbern Please take a look at this again 🙏 It would be great to put this in |
|
Thanks! |
|
I'll poke at opening a followup for 3.14 and 3.14t support. |

Add support for Python 3.13 and configure deployment to PyPI.
.github/workflows/ci.ymlto include Python version 3.13 in thepython-versionmatrix.setup.pyto list supported Python versions up to 3.13 in theclassifierslist.tox.inito include Python 3.13 in theenvlist..github/workflows/publish.ymlfor publishing the package to PyPI.For more details, open the Copilot Workspace session.