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

Document one class per html page and list all inherited members. #1952

Merged
merged 30 commits into from
Nov 26, 2024

Conversation

joaander
Copy link
Member

@joaander joaander commented Nov 26, 2024

Description

pre-commit now runs the script generate-toctree.py which imports hoomd and walks the namespace (which is now defined by __all__ variables in each module). It generates one .rst file per module and class. The module files are always generated. Class files are only generated if they do not exist yet - allowing customization of the class files. Developers should add new classes to __all__ and then they will automatically appear in the documentation after running pre-commit.

Inspired by rustdoc, each class page now explicitly lists all of its inherited members. This brief list repeats only the first line of the documentation for each member and provides a "Read more..." link back to the original. To implement this, he top level public-facing classes now define _doc_inherited. Subclasses include this string in __doc__ and append to it if they define members that are later inherited.

Motivation and context

Prior to this change, the documentation for long modules (such as md.pair) was difficult to navigate. Users have also expressed confusion over the class hierarchy and found it difficult to navigate up the tree and determine what methods are available. The new system is also more automated than the previous and reduces the amount of developer effort to add new classes.

Resolves #1905
Resolves #1914

How has this been tested?

Checklist:

  • I have reviewed the Contributor Guidelines.
  • I agree with the terms of the HOOMD-blue Contributor Agreement.
  • My name is on the list of contributors (sphinx-doc/credits.rst) in the pull request source branch.
  • I have summarized these changes in CHANGELOG.rst following the established format.

To do this, we need to be able to import hoomd from the source directory.
I prefer not to add additional dependencies (Mock), so we include
manually prepared mock files to make the import possible.
Return a non-zero exit value so that pre-commit will fail.
@joaander joaander added validate Execute long running validation tests on pull requests release Build and unit test all support compiler/python configurations labels Nov 26, 2024
@joaander joaander merged commit 21d1328 into trunk-major Nov 26, 2024
66 checks passed
@joaander joaander deleted the refactor-docs branch November 26, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Build and unit test all support compiler/python configurations validate Execute long running validation tests on pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant