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.0.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.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

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

Hashes for endstone_stubgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b83564c0c5992ced613916004a0dc578e3ae63c334741a0863946d3259111ba
MD5 5de411b283e2a597c764c271c0bc3f96
BLAKE2b-256 e9b5b48c330fce48ceb3e396bb4669fd4cb300e0e2016a69cbf81667cc5c5385

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_stubgen-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for endstone_stubgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50806446047afb9f258e0df142a320ebc294e2c477caeeee26c3fc06cc4ac940
MD5 bc5680124634aafbaed50c48972cce1c
BLAKE2b-256 65ca7a49fd13a4bcacbd3463c8d5515ecabe90c4e7dbf294fc000df84e440bc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_stubgen-0.1.0-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