Skip to content

fix: repair example projects (sdist contents, collatz guard, abi3t wheel tag)#51

Merged
henryiii merged 2 commits into
mainfrom
fix/examples-broken
Jul 13, 2026
Merged

fix: repair example projects (sdist contents, collatz guard, abi3t wheel tag)#51
henryiii merged 2 commits into
mainfrom
fix/examples-broken

Conversation

@henryiii

@henryiii henryiii commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Fixes four broken example projects (all verified by building/running in a scratchpad copy):

  • setuptools plugin (examples/5_01_plugin/setuptools): the sdist omitted example.c, so building a wheel from the sdist failed with Cannot find source file: example.c. Adds sdist.inclusion-mode = "explicit" + sdist.include = ["**.c"]. The sdist fix was authored and verified by the user; reconciled to restore the editable.mode comment and pin scikit-build-core[setuptools]>=1 (matching the book convention) rather than >=1.0.3. Also adds requires-python = ">=3.14" to silence uv's warning.
  • collatz (examples/2_01_package/collatz): collatz_steps(0) (any n < 1) infinite-looped and hung the interpreter. Adds a std::domain_error guard (pybind11 maps it to ValueError) and syncs the chapter's inline snippet.
  • collatz CMakeLists: switches project(${SKBUILD_PROJECT_NAME} ...) to project(collatz ...) to match the chapter's typed snippet and allow bare-cmake configuration.
  • C-API free-threading (examples/6_01_free_threading/capi): adds wheel.py-api = "cp315t" so the stable-ABI build emits a single cp315-abi3t wheel, matching the chapter's claim of one reusable _core.abi3t.so. Also adds wheel.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.

henryiii added 2 commits July 13, 2026 00:18
…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
@henryiii henryiii force-pushed the fix/examples-broken branch from d30d303 to 925e3f0 Compare July 13, 2026 05:21
@henryiii henryiii merged commit 84c9d97 into main Jul 13, 2026
3 checks passed
@henryiii henryiii deleted the fix/examples-broken branch July 13, 2026 05:26
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.

1 participant