Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust/Python Docstrings #282

Answered by pawamoy
ccmao1130 asked this question in Q&A
Discussion options

Hi! How are Rust docstrings handled in mkdocstrings? For example, in this method I see all of the attributes, but they're missing descriptions:
image

When you go to the source code, we have the descriptions:
image

How do I port over the descriptions from Rust to mkdocstrings?

You must be logged in to vote

Hi @ccmao1130, thanks for the question 🙂 Griffe doesn't read Rust sources. I guess the API data is extracted from the compiled modules, and since you only added docs to the Rust sources and not into the compiled objects' docstrings, Griffe isn't able to see the docstrings. I suppose it's possible to write a Griffe extension that reads the Rust sources (more specifically, Pyo3 declarations) to enhance the collected data. The alternative would be to provide stubs files (*.pyi files) containing the same docstrings for each produced Python object, or to somehow instruct Pyo3 to see the __doc__ values on each object.

Feel free to open feature requests on our issue trackers 🙂

Replies: 1 comment

Comment options

Hi @ccmao1130, thanks for the question 🙂 Griffe doesn't read Rust sources. I guess the API data is extracted from the compiled modules, and since you only added docs to the Rust sources and not into the compiled objects' docstrings, Griffe isn't able to see the docstrings. I suppose it's possible to write a Griffe extension that reads the Rust sources (more specifically, Pyo3 declarations) to enhance the collected data. The alternative would be to provide stubs files (*.pyi files) containing the same docstrings for each produced Python object, or to somehow instruct Pyo3 to see the __doc__ values on each object.

Feel free to open feature requests on our issue trackers 🙂

You must be logged in to vote
0 replies
Answer selected by ccmao1130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
griffe extension Can be solved with a Griffe extension

AltStyle によって変換されたページ (->オリジナル) /