pybind/scikit_build_example

Beginner freindlyness

Opened this issue · 3 comments

famura commented

Hi there, I found this repo when I was deciding on how to port some C++ code to python.

I used to go the way via described in the cmake_example, but after watching @henryiii 's talk from SciPy22 I thought about scikit_build_example would be worth a try.

However, I find it quite hard to understand what the (minimum) necessary components are and how this example works, especially since new/unknown/fancy tools like nox and ruff are used.
For example in this file a beginner wonders if the imports from future are necessary. Comments would be helpful there as well as in the CMakeLists.txt where one can not assume that beginners know where SKBUILD_PROJECT_NAME etc. come from.

Please don't get me wrong, I appreciate this project. I just think it needs a bit more documentation to be really usable for a broader audience

+1. I'll trying to migrate some of my binding projects from <pybind/cmake_example> to <pybind/scikit_build_example>. Before this, I can use the binding project like normal cmake project, but now I have no idea where PROJECT_BINARY_DIR is (So I can't configure vs-code's intellisense to use build/compile_commands.json, then I can't have any auto-completion, which is terrible).

The very minimum is at https://scikit-build-core.readthedocs.io/en/latest/getting_started.html, which is just three files. This repo is a bit more, but still intended to be somewhat minimal, and scientific-python/cookie is "all the bells and whistles" (as described by and in sync with the accompanying development guide.

Open to specific suggestions! I can start by adding some comments.

Thanks for quick reply. It works! For me, it's:

  1. add build-dir = "build" to pyproject.toml/[tool.scikit-build]
  2. use pip install --no-build-isolation --config-settings=editable.rebuild=true -ve. to build
  3. configure .vscode/c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Linux",
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}