Other

项目介绍

pybind/pybind11-stubgen 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Other 许可证,目前获得 361 个 Star、70 次 Fork。

仓库全名
pybind/pybind11-stubgen
开源许可证
Other
Star 数
361
Fork 数
70
未关闭 Issue
22

README 摘要

About Static analysis tools and IDE usually struggle to understand python binary extensions. pybind11-stubgen generates stubs for python extensions to make them less opaque. While the CLI tool includes tweaks to target modules compiled specifically with pybind11 but it should work well with modules built with other libraries. Usage Contributing During development, you may need to update the reference stubs in…

完整内容见 GitHub 原始 README 或本页 。

常见问题

pybind11-stubgen 用什么语言开发?

主要使用 Python 编写,采用 Other 许可证,目前有 361 个 Star。

pybind11-stubgen 可以免费商用吗?

仓库标注的许可证为 Other,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 pybind11-stubgen 的源码?

可以直接克隆仓库:git clone https://github.com/pybind/pybind11-stubgen.git,默认分支为 main;安装与运行步骤见仓库 README。

pybind11-stubgen 最近还在维护吗?

仓库最近一次更新为 3 周前,当前有 22 个未关闭 Issue;Star 数为 361,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Generate stubs for python modules

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
509
价值分
237
活跃状态
活跃

README

pypi

About

Static analysis tools and IDE usually struggle to understand python binary extensions. pybind11-stubgen generates stubs for python extensions to make them less opaque.

While the CLI tool includes tweaks to target modules compiled specifically with pybind11 but it should work well with modules built with other libraries.

# Install
pip install pybind11-stubgen

# Generate stubs for numpy
pybind11-stubgen numpy

Usage

pybind11-stubgen [-h]
                 [-o OUTPUT_DIR]
                 [--root-suffix ROOT_SUFFIX]
                 [--ignore-invalid-expressions REGEX]
                 [--ignore-invalid-identifiers REGEX]
                 [--ignore-unresolved-names REGEX]
                 [--ignore-all-errors]
                 [--enum-class-locations REGEX:LOC]
                 [--numpy-array-wrap-with-annotated|
                  --numpy-array-use-type-var|
                  --numpy-array-remove-parameters]
                 [--print-invalid-expressions-as-is]
                 [--print-value-comments]
                 [--print-safe-value-reprs REGEX]
                 [--exit-code]
                 [--stub-extension EXT]
                 MODULE_NAME [MODULE_NAMES ...]

Contributing

During development, you may need to update the reference stubs in tests/stubs. This can be done locally using a convenience tox configuration. Ensure that all Python interpreters required by the test suite are available in your environment. For example, you can install them via uv:

uv python install 3.10 3.11 3.12 3.13

To enable the repository hooks locally:

uv sync
uv run pre-commit install

To regenerate the reference stubs run:

uv venv
source .venv/bin/activate
uv tool install tox --with tox-uv
uv run tox

评论

暂无评论