Skip to main content

The next-generation stub generator for pybind11 modules, built with Griffe and Jinja2

Project description

endstone-stubgen

PyPI version Python versions License CI

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 .pyi templates
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

endstone_stubgen-0.1.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

endstone_stubgen-0.1.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file endstone_stubgen-0.1.1.tar.gz.

File metadata

  • Download URL: endstone_stubgen-0.1.1.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

Hashes for endstone_stubgen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7997d76d09c008325051444c7f7017b556f56fc7936fdb0de3d05a962a6973bf
MD5 357ac80ff1aefc024d3902f4b9330aa7
BLAKE2b-256 8a291681daeffccb388fc0447c86399c94c1aa90c11d98eef06663fb9696d386

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_stubgen-0.1.1.tar.gz:

Publisher: release.yml on EndstoneMC/stubgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file endstone_stubgen-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for endstone_stubgen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4048c11b393b9963457a3ab399de2449857391ece56f3e1cc40c627381284fe3
MD5 bbb1901d4538aaf0ccbef0e2b8fd84d8
BLAKE2b-256 3946426a0c607734f84dbf5a1ea5f34aa27e00dd5f09791def25de39494c6aef

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_stubgen-0.1.1-py3-none-any.whl:

Publisher: release.yml on EndstoneMC/stubgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page