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

Add support for doc comments #800

Open
lod opened this issue Jun 20, 2024 · 2 comments · May be fixed by #804
Open

Add support for doc comments #800

lod opened this issue Jun 20, 2024 · 2 comments · May be fixed by #804

Comments

@lod
Copy link

lod commented Jun 20, 2024

Sphinx supports doc comments in the form of #:.

This is also part of the expected and documented syntax for the google and numpy formats, supported in the sphinx implementation but not here.

The format isn't formalised in a PEP, but it is fairly widely used and should be supported. If a decision is made not to support it I believe that should be formally documented, especially in relation to the google and numpy format support.

@tristanlatr
Copy link
Contributor

tristanlatr commented Jun 20, 2024

Hello @lod and thanks for your interest in pydoctor.

This feature would be great to have I agree! And the fact we do have this kind of docs in our demo makes it embarrassing not to support it. The main issue is that we don’t have the comments/tokens information in the model at the moment, we only work with the abstract syntax tree from the standard library.

I believe this could be implemented as a token aware ast transformer that would create legit Constant nodes (inline docstrings) based on doc comments. This way we don’t have to touch the astbuider code or only to add the preprocessing step.

@tristanlatr
Copy link
Contributor

What happens if both syntax are used ? I'de suggest that we leave a warning and the inline docstring is used.

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

Successfully merging a pull request may close this issue.

2 participants