Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for Python bindings #30

Open
fjarri opened this issue Dec 2, 2020 · 5 comments
Open

Docs for Python bindings #30

fjarri opened this issue Dec 2, 2020 · 5 comments
Labels
CI Continuous integration documentation Improvements or additions to documentation Python Related to Python bindings
Milestone

Comments

@fjarri
Copy link
Contributor

fjarri commented Dec 2, 2020

Since pyO3 does not create any actual Python code, we need to just write sphinx docs with hardcoded API. Ideally if it has some doctests that are run automatically.

@fjarri fjarri added documentation Improvements or additions to documentation Python Related to Python bindings CI Continuous integration labels Dec 2, 2020
@fjarri
Copy link
Contributor Author

fjarri commented Dec 3, 2020

Documentation added in commit 702d2ec, need to publish it on RTD.

@fjarri fjarri added this to the v0.1.0 milestone Apr 7, 2021
@fjarri
Copy link
Contributor Author

fjarri commented May 5, 2021

Currently any API change requires changing .pyi and the docs too. Need to investigate if it is possible to avoid duplication. In particular:

  • if Sphinx can pick up docstrings directly from the built library (so we only need to write them in the Rust part of the bindings)
  • if Mypy can pick up typehints directly from the built library

Perhaps we can write a thin Python wrapper instead and store all the docs and typehints there. This way we can enable optional parameters too.

@fjarri
Copy link
Contributor Author

fjarri commented Jul 18, 2021

Update:

@fjarri
Copy link
Contributor Author

fjarri commented Nov 23, 2021

Took another attempt at keeping documentations as docstrings in Rust. While the type annotations issue can be worked around by using explicit parameter descriptors (:type:, :rtype:), there are more problems with Sphinx:

  • sometimes what's defined in #[text_signature] isn't picked up by Sphinx (even though everything seems fine if one calls help() on the method in REPL). I couldn't figure out what exactly leads to that.
  • Sphinx can't pick up the signature of the constructor defined this way

@fjarri
Copy link
Contributor Author

fjarri commented Nov 23, 2021

Also partially blocked by PyO3/pyo3#2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous integration documentation Improvements or additions to documentation Python Related to Python bindings
Projects
None yet
Development

No branches or pull requests

1 participant