pybind / scikit_build_example

An example combining scikit-build and pybind11
Other
91 stars 29 forks source link

How to build this package in place ? #70

Closed VincentRouvreau closed 1 year ago

VincentRouvreau commented 1 year ago

Thanks for the great examples and sorry for the naive question, but I am not a python packaging expert, but when I do:

$ pip install -e .
Obtaining file:///home/gailuron/workspace/formations/scikit_build_example
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/gailuron/workspace/formations/scikit_build_example has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.

And I don't know where to start to fix this error.

Maybe proposing a setup.py like this one. But the information are quite redundant with the pyproject.toml.

henryiii commented 1 year ago

scikit-build-core does not support editable installs yet. See https://github.com/scikit-build/scikit-build-core/issues/114. It's one of the next features I'm planning on working on, but it's not supported yet.

If you set build-dir, you can get a persistent build dir, which will greatly reduce rebuild times, which might be partially what you are looking for.

VincentRouvreau commented 1 year ago

Thanks for the quick answer, I will give it a try.

district10 commented 7 months ago

@henryiii Hello henryiii, how to specify build-dir?

Tried pip install --help | grep build, pip wheel --help | grep build, still no idea how to setup build dir to just ./build.

henryiii commented 7 months ago

It's a feature of the build backend (scikit-build-core, in this case). You can do -Cbuild-dir=build for either pip or build, or you can set in pyproject.toml:

[tool.scikit-build]
build-dir = "build"

(though, if setting in pyproject.toml, I'd use "build/{wheel_tag}", since otherwise different versions of Python will share the same build directory).

See https://scikit-build-core.readthedocs.io/en/latest/configuration.html#other-options.