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 4 commits into
base: main
Choose a base branch
from

Conversation

StefanHabel
Copy link
Contributor

@StefanHabel StefanHabel commented Oct 7, 2024

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 corresponding C++ API docs pages.

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.

@StefanHabel StefanHabel force-pushed the #342-PyMaterialXCore-class-docstrings branch from 1100bf0 to 8df85a2 Compare October 8, 2024 03:24
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 <19556655+StefanHabel@users.noreply.github.com>
… docstrings.

Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
@StefanHabel StefanHabel force-pushed the #342-PyMaterialXCore-class-docstrings branch from 8df85a2 to 056a7ef Compare October 13, 2024 19:23
StefanHabel added a commit to StefanHabel/MaterialX that referenced this pull request Oct 13, 2024
Similar to AcademySoftwareFoundation#2051 and AcademySoftwareFoundation#2061.

Split from AcademySoftwareFoundation#1567.

Update AcademySoftwareFoundation#342.

Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
StefanHabel added a commit to StefanHabel/MaterialX that referenced this pull request Oct 13, 2024
StefanHabel added a commit to StefanHabel/MaterialX that referenced this pull request Oct 13, 2024
StefanHabel added a commit to StefanHabel/MaterialX that referenced this pull request Oct 14, 2024
Similar to AcademySoftwareFoundation#2051, AcademySoftwareFoundation#2061, AcademySoftwareFoundation#2063, AcademySoftwareFoundation#2064, and AcademySoftwareFoundation#2065.

Also fixing a couple of typos in Metal header files.

Split from AcademySoftwareFoundation#1567.

Update AcademySoftwareFoundation#342.

Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants