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

Generate Google-style docstring for struct fields/getters #70

Open
op8867555 opened this issue Aug 26, 2024 · 1 comment
Open

Generate Google-style docstring for struct fields/getters #70

op8867555 opened this issue Aug 26, 2024 · 1 comment

Comments

@op8867555
Copy link
Contributor

op8867555 commented Aug 26, 2024

Hi,

I'm trying to generate docs (with mkdocstrings + Griffe) for some Rust structs like the one below:

/// Some Object O
#[gen_stub_pyclass]
#[pyclass(get_all)]
struct O {
   /// Some value
   value: u32,
}

#[gen_stub_pymethods]
#[pymethods]
impl O {
   /// Extra value
   #[getter]
   pub fn extra(&self) -> u32 {0}
}

This generates something like:

class O:
    r'''
    Some Object O
    '''
    value: int
    extra: int

It would be helpful if we collect the documentation from fields/getter methods and aggregate them into one single docstring:

r'''
Some Object O

Attributes:
    value: Some value
    extra: Extra value
'''

I'm not sure if this feature would be out of scope of this crate or not, if so, please free feel to close this issue.

@abrisco
Copy link

abrisco commented Aug 28, 2024

This would be fantastic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants