Skip to main content

nanobind-stubgen PyPI

Generate Python stub files (pyi) for code completion in IDEs for nanobind modules.

Installation

pip install nanobind-stubgen

Usage

Nanobind stubgen uses the inspect module to reverse engineer the module structure and detects nanobind types. The doc string of the nanobind types contains the function signature, which will be used to create the stub files.

To create pyi files for a module, first install the module and call nanobind-stubgen with the module name as first argument. Here is an example on how to generate stubs for nanogui:

nanobind-stubgen nanogui

It is possible to change the output path (by default it is the current directory) by specifying the parameter --out. To create the pyi files directly in the nanogui package directory, the following command can be used (note the changing python version):

nanobind-stubgen nanogui --out venv/lib/python3.9/site-packages

Limitations

  • The stub generator does not use the nanobind project, but the actual compiled python module. This means, that the generator can only detect module and function information that has been writen into the __doc__ string by nanobind.
  • Only some imports in the pyi files are added
  • Method overloading is supported but only to some extent

Help

positional arguments:
  module             Module to create stubs (e.g. nanogui).

optional arguments:
  -h, --help         show this help message and exit
  --package PACKAGE  Optional package path to import module from.
  --out OUT          Output path for the generated pyi files.

About

MIT License

Metadata

Release files for nanobind-stubgen 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for nanobind-stubgen 0.1.5
File Interpreter ABI Platform Actions
nanobind_stubgen-0.1.5-py3-none-any.whl Python 3 none any Details for nanobind_stubgen-0.1.5-py3-none-any.whl

Release files / nanobind_stubgen-0.1.5-py3-none-any.whl

Download URL nanobind_stubgen-0.1.5-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f4e3c852dfb6ce2bd51fa5e710f3019180176669280fd00e7293e08dee76709
BLAKE2b-256 checksum
How to use checksums
d1b61b7cd5e2cfcc1cb49f62d29fe06ad8c19582c4965f7767d88405f3b70812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for nanobind-stubgen 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page