Skip to content

Implement support for the free-threaded build of CPython 3.13 #84

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

Merged
merged 19 commits into from
Feb 20, 2025

Conversation

lysnikolaou
Copy link
Contributor

What do these changes do?

  • Add a matrix config for free-threaded Python to run tests with it.
  • Change configuration to correctly build wheels under the free-threaded build.

Are there changes in behavior for the user?

No.

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Dec 20, 2024
@lysnikolaou
Copy link
Contributor Author

Hey folks, thanks for all the review and sorry for the extended delay here, I was out on PTO. I've addressed most of the comments around adding some TODOs and replied to the rest.

Copy link

codspeed-hq bot commented Jan 13, 2025

CodSpeed Performance Report

Merging #84 will not alter performance

Comparing lysnikolaou:freethreading-support (e36539b) with master (4fe87bc)

Summary

✅ 4 untouched benchmarks

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.99%. Comparing base (4fe87bc) to head (e36539b).
Report is 22 commits behind head on master.

Files with missing lines Patch % Lines
packaging/pep517_backend/_backend.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
- Coverage   89.02%   88.99%   -0.04%     
==========================================
  Files          18       18              
  Lines         738      745       +7     
  Branches       75       75              
==========================================
+ Hits          657      663       +6     
- Misses         63       64       +1     
  Partials       18       18              
Flag Coverage Δ
CI-GHA 88.99% <93.75%> (-0.04%) ⬇️
MyPy 78.54% <92.85%> (+0.04%) ⬆️
OS-Linux 98.91% <80.00%> (-0.54%) ⬇️
OS-Windows 94.86% <77.77%> (-0.55%) ⬇️
OS-macOS 95.36% <80.00%> (-0.50%) ⬇️
Py-3.10.11 95.09% <80.00%> (-0.50%) ⬇️
Py-3.10.16 97.27% <80.00%> (-0.53%) ⬇️
Py-3.11.11 97.27% <80.00%> (-0.53%) ⬇️
Py-3.11.9 95.09% <80.00%> (-0.50%) ⬇️
Py-3.12.8 95.09% <80.00%> (-0.50%) ⬇️
Py-3.12.9 97.27% <80.00%> (-0.53%) ⬇️
Py-3.13.1 97.27% <80.00%> (+1.68%) ⬆️
Py-3.13.2 97.27% <80.00%> (-0.53%) ⬇️
Py-3.9.13 95.08% <80.00%> (-0.50%) ⬇️
Py-3.9.21 97.26% <80.00%> (-0.53%) ⬇️
Py-pypy7.3.16 96.66% <77.77%> (-0.58%) ⬇️
Py-pypy7.3.18 96.67% <77.77%> (-0.58%) ⬇️
VM-macos-latest 95.36% <80.00%> (-0.50%) ⬇️
VM-ubuntu-latest 98.91% <80.00%> (-0.54%) ⬇️
VM-windows-latest 94.86% <77.77%> (-0.55%) ⬇️
pytest 98.91% <80.00%> (-0.54%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lysnikolaou
Copy link
Contributor Author

Gentle ping on this. Is there anything I can do to move it forward?

bdraco
bdraco previously requested changes Jan 22, 2025
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lysnikolaou sorry for the delay

I think this is good to go once https://github.com/aio-libs/propcache/pull/84/files#r1925771536 is addressed

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest waiting for non-alpha Cython release. A Release Candidate is ok, but alpha is not.

@Dreamsorcerer
Copy link
Member

I would suggest waiting for non-alpha Cython release. A Release Candidate is ok, but alpha is not.

It's a compile-time experimental feature on cpython, I don't think anybody is expecting us to have a rock solid supported implementation. It's essentially a preview release at this point, so alpha is fine at this stage (and the only thing we can offer).

@asvetlov
Copy link
Member

If it is experimental, py3.13t should allow failures in build&tests, only py3.13 should use Cython alpha, and all stable builds should use stable Cython.
I worry a little about existing build stability; it would be sad if Cython alpha prevented us from publishing a new propcache release.

@Dreamsorcerer
Copy link
Member

The discussion above is to use it only on the 3.13t release. Stable Cython is used on other versions, so this has already been addressed.

@asvetlov
Copy link
Member

asvetlov commented Feb 7, 2025

@Dreamsorcerer I'm sorry; I've missed that the new config is applied to 3.13t only.
There are no objections from me anymore.

@lysnikolaou
Copy link
Contributor Author

The problem with this is that there's sadly no environment marker for free-threading in the constraint file (though there are plans for it). This creates a conflict between the specified build requirement and the Cython constraints for regular 3.13. Any ideas on how you'd like to proceed here?

@rgommers
Copy link

rgommers commented Feb 7, 2025

This creates a conflict between the specified build requirement and the Cython constraints for regular 3.13. Any ideas on how you'd like to proceed here?

What all other projects that have released cp313t wheels do here is to set the requirements for 3.13 in pyproject.toml and other metadata file for the default CPython build (i.e., 3.0.11 now, not 3.1.0a1) and disable build isolation to produce cp313t wheels, installing Cython alpha/nightly in the wheel build job. I think that's the only good option at the moment, or something equivalent like pointing at a different constraints file (requirements/cython_freethreading.txt ?).

@lysnikolaou
Copy link
Contributor Author

lysnikolaou commented Feb 7, 2025

Thanks @rgommers for the pointer! This is what an older verion of this PR did, though my understanding was that the maintainers did not like that. If everyone is okay with this, I can certainly revisit that approach.

@lysnikolaou lysnikolaou force-pushed the freethreading-support branch from c948a8a to 8207cbb Compare February 17, 2025 12:10
@webknjaz
Copy link
Member

a different constraints file (requirements/cython_freethreading.txt ?).

@lysnikolaou I do like this approach. It'd be nice to granularly override it just for 3.13t.

lysnikolaou and others added 4 commits February 17, 2025 18:38
- Move codspeed a an optional test dependency so that it's not used
  in cibuildwheel
- Use Cython 3.1alpha for the free-threaded build, and 3.0.x for
  others.
@lysnikolaou
Copy link
Contributor Author

I've update this PR to use the exact same approach as yarl (around building wheels). If someone could approve the workflows, that'd be really helpful.

@bdraco
Copy link
Member

bdraco commented Feb 20, 2025

I'm working on fixing the CI now

@bdraco
Copy link
Member

bdraco commented Feb 20, 2025

Once done, feel free to reach out on matrix or discord any time you need the CI kicked

@bdraco bdraco dismissed their stale review February 20, 2025 16:03

LGTM now

@bdraco bdraco merged commit ccab7f4 into aio-libs:master Feb 20, 2025
50 of 51 checks passed
@bdraco
Copy link
Member

bdraco commented Feb 20, 2025

Thanks @lysnikolaou

I'm doing release now. 🤞 that we don't hit qemu issues again

@bdraco
Copy link
Member

bdraco commented Feb 20, 2025

Manually checked all the workflows. Build looks good. Going to release it out now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy