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

Docs/overhaul #999

Merged
merged 63 commits into from
Dec 6, 2023
Merged

Docs/overhaul #999

merged 63 commits into from
Dec 6, 2023

Conversation

MischaPanch
Copy link
Collaborator

@MischaPanch MischaPanch commented Dec 4, 2023

Closes #916

This PR presents an overhaul of how the docs are built and presented

  1. Notebooks are no longer just links in some drive. They are checked in without their outputs, executed in CI, and thereby serve as integration tests as well as tutorials. They have been adjusted to work with the current master branch
  2. Execution of notebooks is cached, so it's very fast
  3. The api docs are generated automatically with a custom script. Previously this was only done for the highlevel module
  4. The build is happening with jupyter-book (which still uses sphinx in the backend). It is using the default jupyter book theme, which I think looks very nice and adds useful navigation to the right side of the screen
  5. Customized api docs rendering for better appearance
  6. The toc of the docs is built automatically with jupyter-book. The api docs generation script has been adjusted accordingly
  7. The viewcode and linkcode extensions add source code and links to it to the docs
  8. A bunch of docstrings have been adjusted to better reflect the configured rules
  9. Several typing issues improved to make mypy happy

It was quite a piece of work, I hope you like the result :)

@MischaPanch
Copy link
Collaborator Author

I now see that there are some typing issues, maybe some ignored rules were accidentally deleted from pyproject. Will look into it asap

@MischaPanch
Copy link
Collaborator Author

@opcode81 Have a look, if you want to. If you like this style, we could use a similar setup for sensai

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (8d3d1f1) 88.09% compared to head (5f4a02c) 88.06%.

❗ Current head 5f4a02c differs from pull request most recent head 4c24dc6. Consider uploading reports for the commit 4c24dc6 to get more accurate results

Files Patch % Lines
tianshou/utils/logging.py 72.72% 6 Missing ⚠️
tianshou/utils/string.py 96.55% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #999      +/-   ##
==========================================
- Coverage   88.09%   88.06%   -0.04%     
==========================================
  Files          96       96              
  Lines        7527     7531       +4     
==========================================
+ Hits         6631     6632       +1     
- Misses        896      899       +3     
Flag Coverage Δ
unittests 88.06% <89.06%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Trinkle23897
Copy link
Collaborator

Is there an online link for preview? Also I can give you current rtd permission if you want

@MischaPanch
Copy link
Collaborator Author

Is there an online link for preview? Also I can give you current rtd permission if you want

Working on having it run in rtd - it's a painful journey. Almost done, I think, then I'll post the link for preview.

My rtd profile name is MischaPanch, associtated to my GH account. Could you give me access to tianshou's official rtd project?

@MischaPanch
Copy link
Collaborator Author

Finally, the rtd build worked! Here

https://tianshou-fork.readthedocs.io/en/latest/

@MischaPanch
Copy link
Collaborator Author

I now see that the notebook outputs were not added, gonna fix that tomorrow

@Trinkle23897
Copy link
Collaborator

Trinkle23897 commented Dec 5, 2023

love it, just added you to official rtd maintainer. there's an email need to click for accepting invitation

@nuance1979
Copy link
Collaborator

Finally, the rtd build worked! Here

https://tianshou-fork.readthedocs.io/en/latest/

Looks great! However, the API docs do not show up. Is that expected?

@MischaPanch MischaPanch changed the title Draft: Docs/overhaul Docs/overhaul Dec 5, 2023
@MischaPanch
Copy link
Collaborator Author

@Trinkle23897

Completely done now, see https://tianshou-fork.readthedocs.io/en/latest/

Notebooks are executed and the api docs are also working fine. Had to dive deeper into rtd-docker-poetry stuff than I ever wanted to.

@opcode81 helped in improving the task running, making them platform independent

I force pushed and cleaned the history. I'd merge this without squashing after the checkmark, if that's ok.

@MischaPanch MischaPanch self-assigned this Dec 5, 2023
@MischaPanch
Copy link
Collaborator Author

Finally, the rtd build worked! Here
https://tianshou-fork.readthedocs.io/en/latest/

Looks great! However, the API docs do not show up. Is that expected?

They do now

@MischaPanch
Copy link
Collaborator Author

Note that the main page for the api docs is empty, since the toc is displayed to the left and I didn't want to duplicate the pages for modules as well as init files. But if you go to the page of one of the modules, you get

https://tianshou-fork.readthedocs.io/en/latest/03_api/data/batch.html

Note the link to the source code, which is also uploaded to the docs and rendered there

@MischaPanch
Copy link
Collaborator Author

MischaPanch commented Dec 5, 2023

I improved the API docs landing page now, will be built in about 20 mins. Added a subtitle and displayed links to direct children, like for all subpackages

Copy link
Collaborator

@nuance1979 nuance1979 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great work!

@MischaPanch MischaPanch merged commit 34f8999 into thu-ml:master Dec 6, 2023
4 of 5 checks passed
@carlocagnetta carlocagnetta deleted the docs/overhaul branch February 8, 2024 11:08
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.

Turn tutorials into notebooks that are then executed in CI
5 participants