-
Notifications
You must be signed in to change notification settings - Fork 44
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
Move docs to docstrings and generate documentation with sphinx-autodoc #367
Conversation
CC @WillAyd ^ |
doc/source/conf.py
Outdated
from typing import List | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src"))) |
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.
Is there a way to do this without having to change sys.path
? Also, I think it would be better if you used a path relative to this file instead of the current working directory of the the shell, so something like:
srcdir = pathlib.Path(__file__).resolve().parent.parent / "src"
# do whatever needs to be done with srcdir
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.
@WillAyd there's two standard ways to work with autodoc as per the official docs.
- Do an install of the package in your env and then run sphinx.
- Add the sources to the path and then run sphinx.
The latter just seemed less frictional to me as an outside contributor and hence I went ahead with it. I'm not sure if there's a CI workflow to publish the docs or if they're automatically generated. If it's the former and I can assume that the package will be installed in the environment before the docs are generated, I can remove the sys.path.insert
. Both workflows are perfectly standard however.
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'm not sure if there's a CI workflow to publish the docs or if they're automatically generated
This is all handled by readthedocs.com, which looks for changes to this repo and republishes the docs when pushes are made to main. If you sign up for an account there I'd be happy to add you to the project; its probably helpful for what you are trying to do
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.
Sounds good. "Priyansh121096" is my readthedocs username.
@Priyansh121096 this looks pretty good. Any improvements to the path handling can be done in a follow up, as you have time/interest. For now do you mind merging in or rebasing against main? That should fix the CI failures |
@WillAyd merged in the changes from main. |
Thanks @Priyansh121096 |
Closes #364
To test, checkout this PR locally, setup you dev env and do
cd doc/ && make clean && make html
and opendoc/build/html/api.html
in a browser.