-
Notifications
You must be signed in to change notification settings - Fork 239
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
setup.py setup() not detected in __name__ == '__main__' block #1611
Comments
This requires parsing the AST and trying to figure out this setting. Cibuildwheel actually does exactly this (though some people dislike it). You have a non-standard What I'd highly recommend is moving as many of these keyword arguments as possible out of your setup.py's Of course, the simplest fix would be to remove the if statement. PS: setuptools has deprecated running tests with setup.py, so you could at least drop your test command code. |
I'll leave out the name == main bit and see what happens. Just found that CIBW_PROJECT_REQUIRES_PYTHON doc says this should work .. |
Again, I'd highly recommend moving all the static config to setup.cfg (remove from setup call, add to setup.cfg). This makes parsing it much easier for tooling like cibuildwheel. But if you remove the if statement, it should work, and it's probably a cibuildwheel bug if it doesn't (parsing arbitrary AST is hard). |
Removing the if name == main did make cibuildwheel pick up the python_requires bit. It is going to cause me other problems because some of my other tooling uses functions from setup.py and is going to require some ugly monkey patching to prevent setup() from running. It would be really nice if cibuildwheel ast parsing allows the name == main if statement. The test command code is not there for setuptools use, as in that is not the usual way tests are run. It is there as an arbitrary command to help with test configuration. For example a build option can say that a particular SQLite extension should be enabled, and when test runs from the same process it can verify that extension is actually present. When the test suite is run separately it auto-detects which extensions are present, but if there is a bug in setup.py where it is told to include an extension, and doesn't then that won't be caught. Putting stuff in setup.cfg has problems like in #1487 and then means the information is now in two places. Additionally setup.cfg is also there for the end users and provides a place for them to specify additional compilation options such as defines and libraries. (As in a generic thing that has been part of distutils forever.) I did try moving stuff to pyproject.toml [project] and it doesn't work because setuptools then starts complaining a lot, as I play a game of whack a mole moving the various keys and values. The fundamental issue here is that cibuildwheel is not allowing for a name == main block containing the setup call. I'll rename the ticket. The suggested fixes are one of:
|
No other package that I'm aware of uses Anyway, that's not really related to the issue here. IMO supporting |
What has happened with I'm looking forward to name == main working. Thanks for doing that work. |
Description
My setup.py setup() includes:
However cibuildwheel still tries and fails to compile under Python 3.6.
I understand there is CIBW_BUILD / CIBW_SKIP but that is then duplicating the python requires information.
I can add a [project] section to pyproject.toml but that leads to a lot of problems because it ends up fighting with setup() parameters and they really don't like it.
I believe cibuildwheel should establish the Python version support automatically whether it comes from setuptools or pyproject.toml, and not try to build on unsupported versions. My pyproject.toml is:
Build log
https://github.com/rogerbinns/apsw/actions/runs/6175182758/job/16761477543
CI config
https://github.com/rogerbinns/apsw/actions/runs/6175182758/workflow
The text was updated successfully, but these errors were encountered: