Skip to content
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

Building wheels for package in subdirectory of project #294

Closed
filips123 opened this issue Mar 8, 2020 · 7 comments · Fixed by #295
Closed

Building wheels for package in subdirectory of project #294

filips123 opened this issue Mar 8, 2020 · 7 comments · Fixed by #295

Comments

@filips123
Copy link
Contributor

Is there any way to build wheels for a package in a subdirectory of the project?

Example of this is when GitHub project contains some C++ code, while Python bindings are located in some subdirectory of that project, like bindings/python. Then it's also not possible to just set project directory to that subdirectory because the BEFORE_BUILD script would expect the main C++ code to be normally present, while they won't be copied because they would be outside project directory.

@Czaki
Copy link
Contributor

Czaki commented Mar 8, 2020

Why using ../.. is not enough to solve this problem?

@filips123
Copy link
Contributor Author

But where could you use ../..?

@Czaki
Copy link
Contributor

Czaki commented Mar 9, 2020

But where could you use ../..?

In before build. But I see problem with docker.

I'm not sure if I good understand your problem. If you would like to use cibuildwheel to build wheel with python binding to library. Then this library is python independent, Then using CIBW_BEFORE_BUILD is bad idea because it is execute for each selected python.

For such case in my project I build c/c++ libs before I call cibuildwheel (for linux it is done with dockerfile and configured custom manylinux image)

If during build of library there is need to have access to proper python interpreter then I do not understand layout with hidden setup.py.

@filips123
Copy link
Contributor Author

Solution for BEFORE_BUILD that is executed too many times is to create a file and check it as described as temporarily solution in #54.

Although I agree that building library before running cibuildwheel and creating custom mwnylinux image would work, I think that this (specially creating custom image just for this build) would be more complicated than just specifying path to setup.py and script that is started once per environment.

@Czaki
Copy link
Contributor

Czaki commented Mar 9, 2020

Why? Dockerfile will be simple:

FROM quay.io/pypa/manylinux2010_x86_64
WORKDIR /opt/imagecodecs/build_utils

COPY library .
RUN make

ENV some_path_set

then task:

docker build -f Dockerfile -t custom_manylinux .

And set

CIBW_MANYLINUX_X86_64_IMAGE: custom_manylinux

@YannickJadoul
Copy link
Member

YannickJadoul commented Mar 9, 2020

Did we not also have /host as a mount point for the host machine's file system? That's easier than using a custom docker image. The only problem is that it's not allowed on CircleCI's docker, I think.

EDIT: Found it hidden in the docs; see https://cibuildwheel.readthedocs.io/en/stable/faq/#linux-builds-on-docker

@joerick
Copy link
Contributor

joerick commented May 2, 2020

Our solution was released in v1.4.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants