-
Notifications
You must be signed in to change notification settings - Fork 132
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
Setup sybil #1574
Setup sybil #1574
Conversation
Will be used to minimize boilerplate code in examples.
Apparently, hoomd.util was not documented. Make the docs for make_example_simulation appear in the output. This also documents previously undocumented methods in hoomd.util.
Classes from methods.py are imported into __init__.py. Sybil executes all code in a single .py file in the same namespace. This commit duplicates the setup code in __init__.py and methods.py. The code shown in __init__.py is shown to the user in the rendered HTML output. The code in methods.py is needed to prepare the namespace for the examples to run.
Process only methods.py for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the documentation. This is looks really good and I think it will be very useful, especially for newish users.
I have some suggestions, they might be too much in some cases and if you feel like it is too much feel free to discard proposed changes.
2023.06 includes sybil.
Test the skip parser with GPU only and MPI rank requirements.
Updated with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start and definitely going to aid users. I left some small comment to address.
These methods were not previously documented as public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
Add Sybil documentation example tests to
methods.py
andthermostats.py
.Motivation and context
Users wish to copy and paste example code from the documentation. Sybil tests those snippets to ensure that they work now and in the future.
These tests currently run both in serial and MPI. That may be helpful. However future examples we write might only work in MPI and/or only in serial (or only on the GPU or only on the CPU).
pytest.skip
works within these blocks, however Sybil generates each code block as a separate test. Users will see thepytest.skip
logic in tests that need to be skipped in some configurations. If we were to addpytest.skip
in a hidden code block, it would only skip that block and not the next. Theskip: next if
syntax may be a solution to this, I just found it and have not yet tried it: https://sybil.readthedocs.io/en/latest/rest.html#skipping-examplesIn my testing, Sybil only parses
.. code-block::
sphinx directives and not literalsExample::
. This format makes the raw docstring more verbose (for users ofhelp()
), but the HTML output is as expected:Note that the package-level example code the users sees in
module-md-methods.html
comes frommd/methods/__init__.py
, but the example code that Sybil runs in the namespace of all the MD methods is inmd/methods/methods.py
. This is because__init__.py
imports frommethods.py
to create a different canonical namespace for the methods while Sybil runs all examples in the context of a document (a single .py file).This pull request adds documentation for previously undocumented methods in
hoomd.util
. Should these be documented, or should they remain hidden?dict_map
dict_fold
dict_flatten
dict_filter
GPUNotAvailableError
How has this been tested?
Change log
Checklist:
sphinx-doc/credits.rst
) in the pull request source branch.