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

Docstrings for PyMaterialXCore classes. #2051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

StefanHabel
Copy link
Contributor

Mostly copied from corresponding C++ header files, but using backticks to automatically link to relevant sections in the Python API documentation, e.g. Document to link to PyMaterialXCore.Document.html.

Using mod.attr("<name>").doc() = ... syntax so that this patch only adds new lines, rather than modifying existing lines.

Using :see: fields to link to the corresponding C++ API docs page.

The docstrings can be retrieved using help(), e.g.

$ python3 -c 'import PyMaterialXCore; help(PyMaterialXCore.NodeDef)'
Help on class NodeDef in module PyMaterialXCore:

class NodeDef(InterfaceElement)
 |  A node definition element within a `Document`.
 |
 |  A `NodeDef` provides the declaration of a node interface, which may then
 |  be instantiated as a `Node`.
 |
 |  :see: https://materialx.org/docs/api/class_node_def.html
 |
 |  Method resolution order:
 |      NodeDef
 |      InterfaceElement
 |      TypedElement
 |      Element
 |      pybind11_builtins.pybind11_object
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __init__(self, /, *args, **kwargs)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
[...]

Demo of generated HTML page available here:
https://stefanhabel.github.io/generated/PyMaterialXCore.html

Here's how the above docstring of the NodeDef class appears in the Python API documentation:
https://stefanhabel.github.io/generated/PyMaterialXCore.NodeDef.html

Before After
Screenshot 2024-10-06 at 13 11 00 Screenshot 2024-10-06 at 17 13 54

Split from #1567.

Update #342.

Mostly copied from corresponding C++ header files, but using backticks to
automatically link to relevant sections in the Python API documentation,
e.g. `Document` to link to `PyMaterialXCore.Document.html`.

Using `mod.attr("<name>").doc() = ...` syntax so that this patch only adds
new lines, rather than modifying existing lines.

Using `:see:` fields to link to the corresponding C++ API docs page.

Demo of generated HTML page available here:
https://stefanhabel.github.io/generated/PyMaterialXCore.html

Split from AcademySoftwareFoundation#1567.

Update AcademySoftwareFoundation#342.

Signed-off-by: Stefan Habel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants