Enable hinting for pyo3 extension modules by generating type and docstring stubs
Project description
pyo3-stubgen
pyo3-stubgen
generates .pyi
typing files for extension modules which were written in rust with pyo3.
It is designed to work for extension modules created in rust with pyo3 but should work with any compiled extension
modules which include a __text_signature__
and optionally a __doc__
attribute for functions.
Despite flake8's recommendation to the contrary, pyo3_stubgen
adds docstrings to the .pyi
files so that IDEs can
provide them in hover pop-ups.
You will need to manually add the typing information to the generated files as this is not included in any of the function attributes available and is just as dependent upon the semantics of your functions as on the technical implementation.
Note: Currently pyo3_stubgen
only generates info for functions. Classes are on the to-do list.
Installation
Install via pip:
(.venv)/projectroot$ pip install pyo3-stubgen
Usage
Easiest from the command line:
(.venv)/projectroot$ pyo3-stubgen MODULENAME OUTPUTLOCATION
See pyo3-stubgen --help
for more details
Alternatively via the python API. See the docs for more details.
Issues, Bugs, Ideas
Please contribute on github MusicalNinjas/pyo3-stubgen.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyo3_stubgen-0.3.0.tar.gz
.
File metadata
- Download URL: pyo3_stubgen-0.3.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57434fb833d5a3e54942e6f5fde486b56412bf02319cf528068254da58b95327 |
|
MD5 | 192d6d7c338065d8117bcc7a1341ee01 |
|
BLAKE2b-256 | 88dbdf405145366251eded9194a1bf2fdba544f44a4b5d571c519f7916ddec61 |
File details
Details for the file pyo3_stubgen-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pyo3_stubgen-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05c32ddf1981be043fa5015f24d625b4eb631c27769e0db475acf4b28e5acc3 |
|
MD5 | e66ab0fb2251328b43e544f88aabbec5 |
|
BLAKE2b-256 | 97fb92a4a232d31c00276085d03e6f96f28b940cc802cf69b07b8d892def293d |