Jij-Inc / pyo3-stub-gen

Stub file (*.pyi) generator for PyO3
Apache License 2.0
61 stars 12 forks source link

Document: Why create the stub file in Rust side not in Python side? #65

Open termoshtt opened 3 months ago

termoshtt commented 3 months ago

The difference from https://github.com/MusicalNinjas/pyo3-stubgen or similar approach should be explained in README.

JacobHayes commented 3 months ago

I wonder if it has to do with this note from the pyo3-stubgen's (the other repo) README:

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.

I think the __text_signature__ in the generated extension module doesn't contain enough information, so pyo3-stub-gen (this repo) needs to see the source before compiling to the extension.

edit: ah haha, didn't see you were a maintainer so guessing you know the answer and this is just a placeholder to document it. :)