-
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
[Feature Request] Optionally build wheels with bdist_wheel instead of pip #486
Comments
As I understand your Also, Your project structure does not allow to create, a source bundle because So if your cmake depends on the python version then make may not found that there is a need to recompile part of thew code. |
That doesn't seem like a great solution, in general. I'm a bit surprised though that we would have never had this problem before. We have had #294/#295/#319. The original issue, #294, might be interesting to look at, though. |
Perhaps this could be solved by disabling pip's build isolation? CIBW_ENVIRONMENT: "PIP_NO_BUILD_ISOLATION=1" |
@Czaki I hope I understand this correctly, I'm not well versed in Python package distribution: My project is built either by just using the toplevel I'm currently only interested in binary distributions so I haven't given |
So what in your code guarantee that python dependent parts will be recompiled if build without build isolation? Or you plan to create a separate cibuildwheel call per python version? |
I'm still not sure I understand so I'll explain what I did when I just built wheels on manylinux "manually": Inside the Docker container, for every Python installation under /opt/python, I ran |
And how did you clean the build result between cibuildwheel use build isolation to be sure that some artifacts from the previous build does not pollute the next wheel. There are two options. Cleaning is built inside your setup script (or you use temporary dir for build in cmake) then
should be enough
|
So what you really want is to be able to control the “.” in |
I think my main problem is that setuptools isn't really meant to work with files not included in the build directory and its subdirectories. So maybe I have to rethink what I'm doing. Alternatively it's possible to set |
This is possible, though:
https://cibuildwheel.readthedocs.io/en/stable/options/#command-line-options |
A few points now that I'm at a keyboard:
|
Ahh, @YannickJadoul points out we do have a hook for that. Yes, that sounds like exactly what you need. |
But that fixes the copying into Docker for manylinux, but not the issue with OK, maybe with what you said here:
|
|
Actually, maybe it doesn't: #466 (comment) Sounds like you still need a step where you collect the outer directories. You have access to everything inside the Or, as a last ditch effort, you could use |
You can see an example of a modified |
Ech. This amount of workarounds would almost suggest adding |
That seems like an idea. Thanks, I'll try it. It's unfortunate that this isn't really supported out of the box. Naturally it makes sense to me not have the setup.py in the project root directory when creating Python bindings to a C++ codebase. That way all the Python stuff could e.g. be moved into a separate repository and added as a submodule. I none of this works I guess I'll have to ditch that idea though. |
I think We should not support broken packages out of the box. Packages are supposed to be build with I have several codebases like that - and the general rule is, put setup.py in the top level, and everything else in But a user who doens't read your docs can just write pip install "blah", where blah can even be a remote git repo, and it works. I should not have to learn about custom packaging to build your package, it should work using standard commands out of the box. That's the idea, anyway. |
That's a good argument. I think I'll go back to a toplevel setup.py. At least this was a learning experience :D |
I am curious if you drop a [build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta:__legacy__" And then build with |
I might try this too. For now I can't get the toplevel
But I can't specify |
This is exactly like having a src directory. Follow the instructions for that. See setuptools docs or https://scikit-hep.org/developer/packaging Basically, set |
Ah, I got it. I think that clears up all my questions. That will hopefully allow me to use cibuildwheel without issues.Thanks a lot again! |
Thanks for holding on and trying out, and being open to the alternative suggestions, @Time0o! :-) |
I can't really find any documentation regarding:
but it does not appear to have any effect as far as pip copying to a temporary directory. In my own build, I tried adding it to my pyproject.toml and it had no effect. Also, from looking at the source code, there isn't any indication that it could have such an effect: It appears that the legacy backend has only minor differences compared to the normal backend. The real fix would be: pypa/pip#9091 However, it isn't clear when/if that may be merged. |
I'm in the following situation: I'm trying to build a a C++/Python project structured like this:
i.e. Python code and bindings are separated from the main C++ source code.
Now, I'm unable to to build this project with cibuildwheels because when
pip wheel ...
is executed from the package directory (python
in this case), pip copies the contents of that directory to a temporary directory before runningsetup.py
. At this point there is no clean way (it seems) of referencing my project's root directory fromsetup.py
anymore so the toplevelCMakeLists.txt
can't be found and the build fails.I have previously used
multibuild
which offers the option of building withpython setup.py bdist_wheel
instead, avoiding this problem. I think it would be sensible of making this possible with cibuildwhells as well by adding a command line option and modifyinglinux.py
etc. Is this pull-request worthy?EDIT: to clarify, my
setup.py
invokes CMake to build the C++ code as well as the Python bindings.The text was updated successfully, but these errors were encountered: