-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Twisted's external C modules might be worth putting in an external package #7945
Comments
(In [45090]) Branching to external-cexts-7945. |
This is a branch that does this. It removes the support code from Twisted, and puts it in a new package. This will not work on the buildbots without some build script modification. The way to test it manually is (from a Twisted checkout):
To test something that specifically has cexts:
This branch may be backwards incompatible. |
Many thanks for working on this! I think that as a first step we should fix the buildbot infrastructure to support such changes. Regarding the incompatibility part, maybe we can leave deprecated placeholder in the places from were old C module were imported. In this way, users can just install the new package c extention package and continue to use the old code without updating the imports. What do you think? Why do we need to import raise in twisted/test/init.py ? Why not break each extension into its own package? Are the new c package Twisted specific ? For example sendmsg look like a generic support for Py2 and could be used in other projects which don't depend on Twisted. I see that portmap code is somehow reused / duplicated here https://github.com/racker/python-twisted-runner/tree/master/twisted/runner ... With a separate package python-twisted-runner could just depend on the new package which could be given a generic name like python-rcp-portmap or pyportmap or something like that. I am leaving this in the review queue so that it can receive feedback from the other developers. Thanks! |
Hi Adi! The buildbot will need some changes, yes. Also, this patch re-exports it, so no code needs to be changed -- the backwards incompatibility is that after this, if you "pip install Twisted", you won't get the C modules, even if you have a working C compiler. You would need to install the external C modules. The importing is to re-export it. The modules aren't strictly Twisted specific, and there's nothing stopping other things from using them -- but I can nearly guarantee that they're only useful to Twisted. The python-twisted-runner package is just an export of the existing twisted/runner directory, just split out by Rackspace for some reason. It's like the existing "sub projects" which are going to be removed shortly, so we needn't worry about them. |
Replying to hawkowl:
To discuss what kind of changes are needed I have created twisted-infra/braid#108
This patch has no newsfile. I think that the newsfile fragment should include a reference to the new package and instruct people to install that package in case they are using C extensions. We can make the new package available as 'twisted[cext]' ... but this can also be done in a separate ticket. Maybe we can start with defining the new package in install_requires and then deprecate it.
OK.
OK. Thanks for your comments! |
(In [45243]) Branching to external-cexts-7945-2. |
Heck of merge conflicts, please address them and resubmit :-(.
Thanks again for attempting to muck out these C files! Please address the above points and resubmit. |
Oops, almost forgot: please synchronize the version to Twisted's. |
(In [45438]) Branching to external-cexts-7945-3. |
Thanks for the review, Glyph.
The other changes that would happen to ReleaseProcess is that we would now have a (py2) .whl as well as a standard source tarball for Twisted. Not sure how we could really do a Py3 wheel (since it's a subset). But that's out of this ticket's scope, this ticket just makes it possible. Plus, because it's not Twisted as a whole, our .msi and .exe installers probably won't work the same. I would like to replace them with just I'm not sure how we're going to go from here. I think we need to modify the buildbots to make this really testable. |
(In [45683]) Branching to external-cexts-7945-4. |
Here's a PR on braid for the changes needed to do this on the buildbots (plus making an OS X 10.10 wheel): https://github.com/twisted-infra/braid/pull/135/files |
Hi, hawkowl are you going to continue working on twisted-infra/braid#135 and put it for review ? I would like to have the at least one Linux / OSX and Windows builder to check the new code. For the LICENCE file, maybe we can create a custom sdist step which will auto-copy the base LICENSE. I think that distributing .whl files should be fine and we no longer need .msi/.exe Just a minor comment. Why not create a separate method and call it changeCExtVersions ? in cexts/_twistedextensions/tests/test_dist.py I see this code
is it ok... why not use _twistedextensions
look strange ... for my taste. Why do we need the private namespace? Why not call it txcext ? Many thanks for your work. Please check my comments and resubmit. Also please add a few notes about how someone is supposed to test the changes. Thanks! |
I think this is a good time for a review. See: https://pypi.python.org/pypi/Twisted_platform_support for the manylinux wheels and https://github.com/twisted/twisted-platform-support for the repo The changes on this branch directly test that package. It means that Windows and Linux don't need a compiler for basically all the Pythons. |
Definitely planning to do a fuller review later, but: I am inclined to agree with Adi's earlier feedback that this should be |
Also, please grant PyPI access to the project to all current PyPI owners of Twisted, as well :). |
This will need to go through the compat exception process, it removes the (disused) portmap.c with no replacement, as it is a maintenance burden. Email forthcoming. |
I'm not necessarily opposed to that - portmap is nonsense, non-portable, and obviously nobody uses it - but it seems that compat-excepting this is a bit beside the point. We could simply include it in the new platform support package. |
Yeah, agreed. I did, and deprecated it in Twisted. |
Wow, isn't this a ticket? :) So, with some discussions with glyph and co, I have the following MULTI-POINT PLAN:
Sound good? |
Replying to hawkowl:
I think it's important to note the motivations behind each point.
The goal here is to have all the existing Windows test infra test some of the most Windows-sensitive components of Twisted, and to make it sensible to make updates to one project without having to span two codebases. By moving IOCPReactor out of Twisted rather than just the support modules, it will be easier to write updates to IOCPReactor itself as they may span between the support modules and the Python implementation code. Also worth noting: Technically this means it will be possible to violate Twisted's compatibility policy if we make an update to
This is so that we don't need to add public APIs for our test helpers or find ourselves having to do cross-project releases just to fix a bug, and so that installing from
More release automation is just generally a good thing :).
Sounds good to me. |
|
Update description to remove things that hopefully don't exist any more. |
Looks surprisingly simpler than I expected, but I do think we need one more pass:
Please address these points and resubmit; hopefully once the |
I'm happy to put this up for re-review. WRT review points:
This is done. It had to be regenerated because the name is now
MANIFEST is what is made if you don't have a MANIFEST.in. We should never have one outside of the dist dir (in the wheels, for example), and it shouldn't be checked in, a broken setup.py test added one so I added it as a future safeguard.
Done.
Done. |
One typo and some suggestions around the dev extra. Also, we'll need to update https://twistedmatrix.com/trac/wiki/TwistedDevelopment#Creatingyourworkenvironment to include installing twistedcextensions. Thanks so much for this multi-year effort - I'm excited to get this merged! |
|
|
|
|
|
This would involve:
As to why:
Twisted has a handful of (mostly optional) C extension modules, to provide support for the IOCP reactor, some inetd stuff, and sendmsg on Py2. The vast majority of Twisted's users do not require these C modules, and it only makes it harder to install (requiring python-dev + a compiler). If they were bundled into another package and distributed on PyPI, then it would make the majority case simpler, but still allowing easy access to the extension modules.
This has the following direct benefits:
Searchable metadata
The text was updated successfully, but these errors were encountered: