The next-generation stub generator for pybind11 modules, built with Griffe and Jinja2
Project description
endstone-stubgen
A next-generation stub generator for pybind11 modules, built with Griffe and Jinja2.
Overview
endstone-stubgen generates precise .pyi type stubs for C++/pybind11 codebases. It replaces the legacy
pybind11-stubgen workflow with a modern, modular, and more accurate architecture.
Originally built to support Endstone's pybind11 bindings, it works equally well for any pybind11 project.
Features
- Griffe-based introspection — Robust parsing of Python modules, pybind11 extensions, and custom metadata
- Jinja2 templating — Clean, extensible rendering with fully customizable
.pyitemplates - High-accuracy type inference — Better handling of overloads, enums, default values, and pybind11-bound C++ types
- Deterministic output — Stable, reproducible stub generation for large codebases
- PEP 561 compliant — Generated stubs work seamlessly with mypy, pyright, and other type checkers
Installation
pip install endstone-stubgen
Or with uv:
uv add endstone-stubgen
Usage
Basic Usage
Generate stubs for a module:
stubgen <module_name>
Specify Output Directory
stubgen <module_name> -o stubs/
Dry Run
Parse the module and report errors without writing files:
stubgen <module_name> --dry-run
CLI Reference
usage: stubgen [-h] [-o OUTPUT_DIR] [--dry-run] MODULE_NAME
positional arguments:
MODULE_NAME Module name to generate stubs for
options:
-h, --help Show this help message and exit
-o, --output-dir The root directory for output stubs (default: current directory)
--dry-run Parse module and report errors without writing stubs
Example
Generate stubs for the endstone module:
stubgen endstone -o stubs/
This creates a stubs/ directory with .pyi files mirroring the module structure:
stubs/
└── endstone/
├── __init__.pyi
├── command.pyi
├── event.pyi
└── ...
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file endstone_stubgen-0.1.0.tar.gz.
File metadata
- Download URL: endstone_stubgen-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b83564c0c5992ced613916004a0dc578e3ae63c334741a0863946d3259111ba
|
|
| MD5 |
5de411b283e2a597c764c271c0bc3f96
|
|
| BLAKE2b-256 |
e9b5b48c330fce48ceb3e396bb4669fd4cb300e0e2016a69cbf81667cc5c5385
|
Provenance
The following attestation bundles were made for endstone_stubgen-0.1.0.tar.gz:
Publisher:
release.yml on EndstoneMC/stubgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
endstone_stubgen-0.1.0.tar.gz -
Subject digest:
2b83564c0c5992ced613916004a0dc578e3ae63c334741a0863946d3259111ba - Sigstore transparency entry: 834949418
- Sigstore integration time:
-
Permalink:
EndstoneMC/stubgen@f2f1bd5edbbca43a35385f29be3bdf9c55acefe8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/EndstoneMC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f2f1bd5edbbca43a35385f29be3bdf9c55acefe8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file endstone_stubgen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: endstone_stubgen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50806446047afb9f258e0df142a320ebc294e2c477caeeee26c3fc06cc4ac940
|
|
| MD5 |
bc5680124634aafbaed50c48972cce1c
|
|
| BLAKE2b-256 |
65ca7a49fd13a4bcacbd3463c8d5515ecabe90c4e7dbf294fc000df84e440bc0
|
Provenance
The following attestation bundles were made for endstone_stubgen-0.1.0-py3-none-any.whl:
Publisher:
release.yml on EndstoneMC/stubgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
endstone_stubgen-0.1.0-py3-none-any.whl -
Subject digest:
50806446047afb9f258e0df142a320ebc294e2c477caeeee26c3fc06cc4ac940 - Sigstore transparency entry: 834949425
- Sigstore integration time:
-
Permalink:
EndstoneMC/stubgen@f2f1bd5edbbca43a35385f29be3bdf9c55acefe8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/EndstoneMC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f2f1bd5edbbca43a35385f29be3bdf9c55acefe8 -
Trigger Event:
workflow_dispatch
-
Statement type: