Skip to content

Conversation

@henryiii
Copy link
Contributor

@henryiii henryiii commented May 21, 2023

This is an experiment using scikit-build-core for the example. Several things are handled by scikit-build-core automatically, like auto downloading cmake/ninja if needed, backporting FindPython 3.26.1 if an older CMake is used, auto-discovery of properly placed cmake Config files (which nanobind seems to do!), release types (which technically were always handled by scikit-build), and better SDist & wheel directory handling.

How is ABI3 specified? I didn't see it set for the old setup.py. There's a setting in scikit-build-core for it; like every setting, it can be in pyproject.toml, as a --config-settings option, or via an environment variable.. I can work on implementing an overrides system to control settings based on the Python being used, would that be enough? I can also provide a nice way to communicate to CMakeLists.txt if ABI3 is requested. Just need to know what the expectation here is.

Closes #19.

@wjakob
Copy link
Owner

wjakob commented May 24, 2023

This looks amazing! To me it looks like a nice improvement without any downside. Are there potential gotchas/limitations that I am not aware of?

Regarding ABI3 builds: Ideally, the normal pip install should target the current Python version, while the GHA wheel action additionally makes an ABI3 wheel to be future-proof.

However, nanobind's ABI3 support depends on Python 3.12, and that wasn't officially supported by cibuildwheel yet. (But it might be soon, with the Python3.12b1 having been released 2 days ago). Anyways, that's why ABI3 isn't mentioned in this example project (yet!)

Minor: I saw that you reduced the minimum CMake version to 3.15. I am not 100% sure that this will be compatible with the nanobind CMake scripts (have not tested it though.). Is there a particular reason for this change?

@henryiii
Copy link
Contributor Author

henryiii commented May 25, 2023

It's not as hackable as something based on setuptools (which is not really a downside...). Features are carefully being added as needed. Otherwise, I think it should be a solid upgrade.

A way to detect ABI 3 should be available in the next release (though I might change the in-main version before release, there is something there now). I think overrides will be coming soon too, hopefully 0.5.

I checked nanobind and it puts 3.15 (or was it 3.14?) as the minimum version - if that's the case, scikit-build-core supports and is tested on 3.15+. Since it backports FindPython from 3.26.1 (configurable), you actually can use the features required for making wheels, like Development.Module, ABI3, etc. in CMake 3.15+.

I didn't run a test on 3.15 though.

@wjakob wjakob mentioned this pull request May 31, 2023
@henryiii henryiii force-pushed the henryiii/chore/scikit-build-core branch from c188b43 to 38e70a3 Compare May 31, 2023 19:13
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

bump cibuildwheel to try builds with Python 3.12b1

tweaks

another attempt

WIP: try branch for Windows fix

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

chore: use py-abi fix

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

WIP: try nanobind patch

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

fix: try new branch
@henryiii henryiii force-pushed the henryiii/chore/scikit-build-core branch from 44d7c86 to 9e07cde Compare May 31, 2023 22:14
Copy link
Contributor Author

@henryiii henryiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I could PR that later)

@henryiii
Copy link
Contributor Author

Going to try it without the require statement. It’s a cibuildwheel bug if it doesn’t work.

@henryiii
Copy link
Contributor Author

Looks good to me:

6 wheels produced in 10 minutes:
  nanobind_example-0.0.1-cp310-cp310-win_amd64.whl        34 kB
  nanobind_example-0.0.1-cp311-cp311-win_amd64.whl        34 kB
  nanobind_example-0.0.1-cp312-abi3-win_amd64.whl         33 kB
  nanobind_example-0.0.1-cp38-cp38-win_amd64.whl          34 kB
  nanobind_example-0.0.1-cp39-cp39-win_amd64.whl          34 kB
  nanobind_example-0.0.1-pp39-pypy39_pp73-win_amd64.whl   32 kB

@henryiii henryiii marked this pull request as ready for review May 31, 2023 22:45
@wjakob
Copy link
Owner

wjakob commented May 31, 2023

Amazing 🎊. Thank you very much, Henry!

@wjakob wjakob merged commit 1028861 into wjakob:master May 31, 2023
wjakob pushed a commit that referenced this pull request May 31, 2023
This commit switches from scikit-build to scikit-build-core, which significantly simplifies the example build system and brings other benefits like a stable ABI3 wheels.
@henryiii henryiii deleted the henryiii/chore/scikit-build-core branch May 31, 2023 23:15
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 this pull request may close these issues.

pip install in editable mode currently doesn't work

2 participants