You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a python extension in rust. I have no python sources in my local path at all. When I install the generated python extension module, it goes directly into my venv's site-packages directory. This is not ideal for autodoc-ing by local path only.
It seems like the config options are really only geared towards analyzing some local python source. I can't use autodoc2_object to load a module from my activated venv where the rust-generated python bindings are installed.
In a python REPL, I can import from my generated python bindings and see the doc comments from rust source is added to the python members' __doc__ attributes. 🎉
Example
use pyo3::prelude::*;/// Formats the sum of two numbers as string.#[pyfunction]fnsum_as_string(a:usize,b:usize) -> PyResult<String>{Ok((a + b).to_string())}/// A Python module implemented in Rust.#[pymodule]fnautodoc2_rust_src(m:&Bound<'_,PyModule>) -> PyResult<()>{
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;Ok(())}
Now after building/installing the wheel (not an editable install):
>>>importautodoc2_rust_srcasad2rs>>>ad2rs.__doc__'A Python module implemented in Rust.'>>>ad2rs.sum_as_string.__doc__'Formats the sum of two numbers as string.'>>>
PS - I'm looking at autodoc2 because rust docs are written in rather strict commonmark syntax. And there are build warnings I'd have to suppress if I use RST syntax in the rust doc comments.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing a python extension in rust. I have no python sources in my local path at all. When I install the generated python extension module, it goes directly into my venv's site-packages directory. This is not ideal for autodoc-ing by local path only.
It seems like the config options are really only geared towards analyzing some local python source. I can't use
autodoc2_object
to load a module from my activated venv where the rust-generated python bindings are installed.In a python REPL, I can import from my generated python bindings and see the doc comments from rust source is added to the python members'
__doc__
attributes. 🎉Example
Now after building/installing the wheel (not an editable install):
PS - I'm looking at autodoc2 because rust docs are written in rather strict commonmark syntax. And there are build warnings I'd have to suppress if I use RST syntax in the rust doc comments.
Beta Was this translation helpful? Give feedback.
All reactions