6

I have Cython code that wraps C++ code, which needs compiled before running. To do this, I use the following line: python setup.py build_ext --inplace

However, a great thing about python is the setup.py file and the ability to install packages to pip. All previous version of my code were able to be installed to pip and then called without being moved to a local directory for whoever was using it. Just like numpy, scipy, etc.

Is there any way to pip install a package and have the Cython files compiled at the same time?

7
  • You'll have to distribute the backend too Commented Apr 17, 2020 at 0:59
  • Could you explain what you mean by distributing the backend? @MadPhysicist Commented Apr 17, 2020 at 1:04
  • You'll have to provide the C++ code to link against Commented Apr 17, 2020 at 2:17
  • Right but how do I tell pip to build that C++ code (made possible by pyx and pxd files) when I do a pip install path/to/package.zip? Commented Apr 17, 2020 at 2:20
  • And what happens when you call pip install? Did you try it? Commented Apr 17, 2020 at 5:10

1 Answer 1

2

If you have the ability to run python setup.py build_ext --inplace, and it works. A pip install is essentially a build not inplace. Therefore, if you run pip install path/to/folder.zip and everything is properly defined in setup.py, then the necessary files with be compiled and able to be called in the package.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.