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

Improve docstrings for abstract hardware objects #1116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@

extensions.append("sphinx.ext.napoleon")

napoleon_custom_sections = [
("Emits", "params_style"),
]

napoleon_numpy_docstring = False


Expand All @@ -99,7 +103,11 @@

extensions.append("myst_parser")

myst_enable_extensions = ("fieldlist",)
myst_enable_extensions = (
"attrs_block",
"colon_fence",
"fieldlist",
)


# -- Options for sphinxcontrib.mermaid
Expand Down
21 changes: 21 additions & 0 deletions docs/source/dev/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,27 @@ extension is enabled to handle docstrings within the Python code
and it is configured for
[Google-style docstrings](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings).

#### Custom sections for docstrings

A
[custom section](https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#confval-napoleon_custom_sections)
title for docstrings is available to document *hardware objects*:

* `Emits` for signals emitted by *hardware objects*

It can be used like in this example:

```python
class Thing(HardwareObject):
"""Some thing.
Emits:
isReady (bool):
Emitted when the readiness state changes.
"""
```


### Diagrams

The
Expand Down
Loading