-
Notifications
You must be signed in to change notification settings - Fork 5
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
add support for 3.13t #28
base: default
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
GRAALVM_PYTHON is a bit of a hack because the tangle of #ifs in there are pretty good at undefining things needed to build successfully |
setup.py
Outdated
from Cython.Build import cythonize | ||
|
||
|
||
macros = None | ||
if sysconfig.get_config_var("abi_thread") == "t": |
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.
This needs a comment explaining why we need these changes
From what I can read at https://docs.python.org/3/howto/free-threading-extensions.html#building-extensions-for-the-free-threaded-build
as long as we use ciwheelbuilder this is not needed
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.
It will help to have a link to https://docs.python.org/3/howto/free-threading-python.html
and, is this the right way to check for thread free ?
In the Python docs I see
The sysconfig.get_config_var("Py_GIL_DISABLED") configuration variable can be used to determine whether the build supports free threading. If the variable is set to 1, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration.
Thanks for the PR... I pushed some changes to enable 3.13 wheels generation on this PR. I need to read more about the thread free variant of 3.13 ... We use cibuildwheel and it looks like we need to use |
probably more extensive testing needs to be done on the 3.13t binary, but it does work for my use case. 3.13t is going to be an extremely limited pool of users since you have to build Python yourself to even use 3.13t right now. oh wait, i was thinking of JIT. i forgot the installer has a free-threaded option. |
|
||
macros = None | ||
if sysconfig.get_config_var("abi_thread") == "t": | ||
macros = [("GRAALVM_PYTHON", "1"), ("Py_GIL_DISABLED", "1")] |
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.
I was thinking that we don't need this.
Instead, we can just use cibuildwheel and will take care of setting up the build environment.
Somehow cibuildwheel is not configured ok ... it is still producing wheels for 3.6 and 3.7 ... and there are no wheels for Python 3.13 t
|
I think that the build is now ok
Can you please try the wheel version from https://github.com/twisted/twisted-iocpsupport/actions/runs/13239410326/artifacts/2563932853 this should be the version that we will be publish to PyPi Thanks |
just tested twisted_iocpsupport-1.0.4-cp313-cp313t-win_amd64.whl from your artifacts and confirmed it's working with twisted 23.10 and twisted 24.11 |
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.
Thanks for the changes.
I left a few inline comments.
I am not an expert in Python C extensions... so I just want to make sure that we are ok and future developers will know why we made the current changes.
Can you please check if the changes in setup.py are needed ?
Maybe they are needed to build outside of of cibuildwheel ... but from the docs, it looks like only Py_GIL_DISABLED
is needed.
I think that GRAALVM_PYTHON
is not related to GIL... and I don't know if it has any effect with our current build process.
Please add some notes about why we need GRAALVM_PYTHON for free threading.
Thanks
setup.py
Outdated
from Cython.Build import cythonize | ||
|
||
|
||
macros = None | ||
if sysconfig.get_config_var("abi_thread") == "t": |
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.
It will help to have a link to https://docs.python.org/3/howto/free-threading-python.html
and, is this the right way to check for thread free ?
In the Python docs I see
The sysconfig.get_config_var("Py_GIL_DISABLED") configuration variable can be used to determine whether the build supports free threading. If the variable is set to 1, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration.
sorry, i just noticed your comments. yes, i added that code for building locally. i'll add some notes explaining my reasoning tomorrow. basically, it's not easy to set the correct defines because in the iocpsupport.c that gets generated the options get #undef and #define again in many places. GRAALVM_PYTHON just happened to set the right options needed to compile. edit- and sysconfig.get_config_var("Py_GIL_DISABLED") sounds good! |
Thanks for the info. As long as the code is documented, I think that we are good to merge this and trigger a new release for twisted-iocpsupport Thanks again for your help. |
add python 3.13t compatibility to twisted-iocpsupport
noticed it was needed after i posted this:
twisted/twisted#12425