Skip to content

Use pybind11-stubgen to create typestubs for extensions#87

Draft
jbcoe wants to merge 31 commits intoNetHack-LE:mainfrom
jbcoe:jbcoe/generate-typestubs
Draft

Use pybind11-stubgen to create typestubs for extensions#87
jbcoe wants to merge 31 commits intoNetHack-LE:mainfrom
jbcoe:jbcoe/generate-typestubs

Conversation

@jbcoe
Copy link
Collaborator

@jbcoe jbcoe commented Feb 11, 2026

Generated typestubs will allow us to give richer type information and enable a type-checker as part of our CI workflow.

I've created a custom action to generate the typestubs. A newer bindings generator link nanobind already exposes CMake rules to generate typestubs.

Needs (sadly) #108 to be merged first.

@jbcoe jbcoe force-pushed the jbcoe/generate-typestubs branch from 9b6791d to 4414e0f Compare February 11, 2026 10:43
@jbcoe jbcoe force-pushed the jbcoe/generate-typestubs branch 2 times, most recently from 02e76e3 to 4a2f8cd Compare February 22, 2026 01:20
@jbcoe jbcoe force-pushed the jbcoe/generate-typestubs branch from 564345c to ecde6bb Compare March 6, 2026 12:53
@jbcoe jbcoe force-pushed the jbcoe/generate-typestubs branch from 2495a9b to 98a723d Compare March 18, 2026 22:42
… as a COMMAND, CMake resolves it to the actual executable at build time via the target machinery, not by embedding a string path at configure time. This is the distinction: a target reference stays late-bound, a variable like ${Python_EXECUTABLE} gets expanded to a string immediately at configure time and baked into build.ninja.
@jbcoe
Copy link
Collaborator Author

jbcoe commented Mar 18, 2026

This is interacting poorly with the fast editable build I set up.

I'm reluctant to use --no-build-isolation as suggested in https://scikit-build-core.readthedocs.io/en/stable/configuration/#editable-installs

I'll think about how we might make progress. Faster rebuilds seem useful as do typestubs.

jbcoe added 3 commits March 21, 2026 12:38
This reverts commit 0b96483.

Fast rebuilds with uv and scikit-build and use of Python tooling
within a CMake build are incompatible. The isolated environment
used for the build means that the Python executable cached in the
build directory is not valid when the build directory is used for
a rebuild.
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