fix: repair example projects (sdist contents, collatz guard, abi3t wheel tag)#51
Merged
Conversation
…eel tag) - setuptools plugin: include example.c in the sdist so a wheel builds from the sdist (sdist.inclusion-mode/include), pin scikit-build-core[setuptools]>=1, and add requires-python to silence uv's warning. Authored and verified by the user; reconciled to restore the editable.mode comment and use >=1. - collatz: guard n < 1 with std::domain_error (maps to ValueError) so collatz_steps(0) no longer infinite-loops; sync the chapter's inline snippet. - collatz CMakeLists: use project(collatz ...) to match the chapter and allow bare-cmake configuration instead of the unexplained SKBUILD_PROJECT_NAME. - C-API free-threading: set wheel.py-api = "cp315t" so the stable-ABI build produces a single cp315-abi3t wheel, matching the chapter's claim. Assisted-by: ClaudeCode:claude-opus-4-8
…eel tag) - setuptools plugin: include example.c in the sdist so a wheel builds from the sdist (sdist.inclusion-mode/include), pin scikit-build-core[setuptools]>=1, and add requires-python to silence uv's warning. Authored and verified by the user; reconciled to restore the editable.mode comment and use >=1. - collatz: guard n < 1 with std::domain_error (maps to ValueError) so collatz_steps(0) no longer infinite-loops; sync the chapter's inline snippet. - collatz CMakeLists: use project(collatz ...) to match the chapter and allow bare-cmake configuration instead of the unexplained SKBUILD_PROJECT_NAME. - C-API free-threading: set wheel.py-api = "cp315t" so the stable-ABI build produces a single cp315-abi3t wheel, matching the chapter's claim; also exclude **.cpp from the wheel, matching the pybind11/nanobind variants. Assisted-by: ClaudeCode:claude-opus-4-8
d30d303 to
925e3f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Fixes four broken example projects (all verified by building/running in a scratchpad copy):
examples/5_01_plugin/setuptools): the sdist omittedexample.c, so building a wheel from the sdist failed withCannot find source file: example.c. Addssdist.inclusion-mode = "explicit"+sdist.include = ["**.c"]. The sdist fix was authored and verified by the user; reconciled to restore theeditable.modecomment and pinscikit-build-core[setuptools]>=1(matching the book convention) rather than>=1.0.3. Also addsrequires-python = ">=3.14"to silence uv's warning.examples/2_01_package/collatz):collatz_steps(0)(anyn < 1) infinite-looped and hung the interpreter. Adds astd::domain_errorguard (pybind11 maps it toValueError) and syncs the chapter's inline snippet.project(${SKBUILD_PROJECT_NAME} ...)toproject(collatz ...)to match the chapter's typed snippet and allow bare-cmake configuration.examples/6_01_free_threading/capi): addswheel.py-api = "cp315t"so the stable-ABI build emits a singlecp315-abi3twheel, matching the chapter's claim of one reusable_core.abi3t.so. Also addswheel.exclude = ["**.cpp"]so the C++ source inside the package dir stays out of the wheel, matching the pybind11/nanobind variants from chore: minor example cleanups #52.