Open sydduckworth opened 1 year ago
A few corrections/details: mkdocstrings does support getting docstrings from stubs. And the public version also supports cross-references (what you call hyperlinks here I assume), but in parameters sections (and the like), not directly in the rendered signature.
@pawamoy thanks for the info! Clearly I didn't spend enough time exploring mkdocs.
ella's Python bindings are generated from Rust using pyo3/maturin. Unfortunately it seems that it's difficult to effectively create API documentation and type definitions for generated code.
Requirements
Implementation
So far I haven't been able to find a single approach that satisfies all of these requirements. To meet all of them it seems like information would need to be duplicated or even triplicated.
For the actual documentation, the three options would be to put the documentation:
.pyi
type stub filesFor type hints, the two options would be to put the type information:
.pyi
type stub files* the free version of mkdocstrings (the API generator tool for mkdocs) doesn't support hyperlinks/cross-references in the function signature, although it does in parameter blocks.
Conclusions
There isn't a single implementation that meets all use cases. I think the best option for now is to use pdoc as the documentation generator with Rust docstrings and type stub files. This doesn't get us docstrings in Pylance but it does get us type information at least. It may not be too difficult to write a script that copies the Rust docstrings into the stub files.