0

I have a few C++ extensions for a python library.

Previously, this library was shipped using setup.py and one could recompile via python setup.py build_ext --inplace if only the C++ files changed.

Since I had to change the build system to manage more complex dependencies, I switched over to pyproject.toml + scicit-build-core + CMake.

Unfortunately I cannot find any way of how to recompile the changed files in this new setup. At the moment I have to always call pip install . which goes through the whole python dependency management and compiles everything.

TLDR: What is the equivalent of make in this setup?


pip install --no-deps . gets rid of the python dependencies part, but it still recompiles all cpp files, even if they were not changed.

3
  • 1
    I'm not too famaliar with your build system, but --no-deps flag should do what you want. ie, pip install --no-deps .. It will compile everything in your library, but won't bother installing any of your libraries dependencies. Commented Jun 29 at 12:48
  • Thanks for the suggestion. I updated the question, because --no-deps only solves part of the problem. Commented Jun 30 at 14:47
  • There are many build back-ends (non-exhaustive list), find the one that works for you. There is no definitive answer to your question. Commented Jun 30 at 18:37

1 Answer 1

2

Option 1:

  1. Create a build directory:
    mkdir -p build && cd build

  2. Configure CMake once:

    cmake .. -DCMAKE_BUILD_TYPE=Debug

  3. Build incrementally:

    cmake --build . --config Debug -j$(nproc)

  4. Install locally (without reinstalling via pip):

    cmake --install . --prefix ../install

    Option 2:
    1. Install the CLI tool:
    pip install scikit-build-core[pyproject]
    2. Run an in-place build:
    python -m scikit_build_core.build --wheel --no-isolation

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

1 Comment

Option 2 throws an error, but option 1 works. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.