Generate python stub files for code completion in IDEs for nanobind modules.
Project description
nanobind-stubgen
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
Help
usage: nanobind-stubgen [-h] [--out OUT] module
Nanobind Stubs Generator
positional arguments:
module Module to create stubs (e.g. nanogui).
optional arguments:
-h, --help show this help message and exit
--out OUT Output path for the generated pyi files.
About
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file nanobind_stubgen-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: nanobind_stubgen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f67caf83d9883faf701e62ff91e64672a523a32d5913590eaa8e65c967fe499 |
|
MD5 | 3ea78e903d0017014af6c8a38dcc68a5 |
|
BLAKE2b-256 | 23a46e422da61506fc70674db8a30e0c80e2a9473c5b3723d6d12913b35354e4 |