pybind11-stubgen
PEP 561 type stubs generator for pybind11 modules
Decision gist · record as of 2026-08-14
Yes, if you work with Python binary extensions and want static type checking or IDE support for them. It has no runtime dependencies, low friction, and solves a real problem—making opaque compiled code visible to the Python tooling ecosystem. Install it as a development or build-time tool.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python ~=3.7 or later; the target module must be importable in the environment where stubs are generated.
- Low install friction; no runtime dependencies.
- Actively maintained with recent commits and a steady release cadence since 2019.
License · maintenance · safety
BSD (permissive) — BSD license is permissive; you may use, modify, and distribute this package with minimal restrictions.
last release 2025-08-09 (370 days) · last repo commit 2026-08-04 · 359 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,336,440 downloads/mo, #4,032 on PyPI
Alternatives
Verify before relying
pip install pybind11-stubgen
pybind11-stubgen numpy- How well stub generation works for non-pybind11 extensions (documentation mentions it 'should work well' but provides no compatibility matrix).
- Whether generated stubs are compatible with all major type checkers (mypy, pyright, etc.) or have known limitations.
What it is and what it does
pybind11-stubgen is a command-line tool that introspects compiled Python extensions and generates PEP 561 type stub files (.pyi) for them. Binary extensions—whether built with pybind11, ctypes, or other C/C++ binding libraries—are normally opaque to static type checkers and IDEs because their signatures and types exist only at runtime in compiled code. This tool bridges that gap by extracting type information from the running module and writing it out as stub files that tools like mypy, pyright, and IDEs can read.
The tool is designed primarily for pybind11 modules but works with other binding approaches. It offers command-line options to handle edge cases like invalid expressions, unresolved names, and special handling for NumPy arrays. Once stubs are generated, they sit alongside your extension modules and enable full IDE autocomplete, type checking, and documentation generation for code that uses those extensions.
Use it for
- Generate stubs for NumPy or other scientific C extensions so type checkers can validate code using them.
- Enable IDE autocomplete and inline documentation for third-party binary modules without source access.
- Create type stubs for in-house pybind11 modules to integrate them into a typed Python codebase.
- Support static analysis in CI/CD pipelines that use mypy or similar tools on code importing compiled extensions.
- Publish type information alongside a compiled extension package to improve downstream user experience.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with Python binary extensions and want static type checking or IDE support for them.
It has no runtime dependencies, low friction, and solves a real problem—making opaque compiled code visible to the Python tooling ecosystem. Install it as a development or build-time tool.
Install
pybind11-stubgen on PyPI
Before you install
Low install friction; no runtime dependencies. Actively maintained with recent commits and a steady release cadence since 2019.
Requires Python ~=3.7 or later; the target module must be importable in the environment where stubs are generated.
License in practice
BSD license is permissive; you may use, modify, and distribute this package with minimal restrictions.
Quickstart
pip install pybind11-stubgen
pybind11-stubgen numpy
Verify before relying
- How well stub generation works for non-pybind11 extensions (documentation mentions it 'should work well' but provides no compatibility matrix).
- Whether generated stubs are compatible with all major type checkers (mypy, pyright, etc.) or have known limitations.
Package facts
| License | BSD permissive |
| Python support | Supports the current Python release ~=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 370 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,336,440 / month, #4,032 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pybind11_stubgen-2.5.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “type stubs for binary extensions”
- pybind11-stubgenGenerates PEP 561 type stubs for Python binary extensions, making…
- construct-typingAdds type hints and static type checking support to the construct…
- livekit-protocolProvides Python protocol stubs and type definitions for LiveKit's…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also types-enum34 · docutils-stubs · types-backports · types-click · types-SQLAlchemy · types-attrs · types-Flask · types-Pillow · types-factory-boy · pybind11