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

Add Python documentation [Sphinx-Hatch] #32

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

RaulTrombin
Copy link
Member

@RaulTrombin RaulTrombin commented Jul 26, 2023

This PR add the sphinx source folder to autogenerate the documentation for Python module.
This current project uses the napoleon module, sphinx.ext.napoleon – Support for NumPy and Google style docstrings
It uses the upgrades made on cpy-binder 3.0, which now support comments.
This PR also create an action for page deployment.

To test it locally:
pip install -r docs/requirements.txt && maturin build && env pip install --force-reinstall target/wheels/*.whl && cd docs && make clean html

Deployments:
You can test it on a raspberry with navigator:
pip install br-navigator
https://pypi.org/project/br-navigator/
https://raultrombin.github.io/navigator-lib/
ps.: here I'm using the br-navigator name for a preview.

Previews:
image
image

@RaulTrombin RaulTrombin force-pushed the add_py_docs branch 3 times, most recently from 8c3e4c4 to 4f9ee70 Compare July 26, 2023 19:01
@RaulTrombin RaulTrombin changed the title Add py docs Add automatic Python documentation [Sphinx] Jul 26, 2023
@RaulTrombin RaulTrombin marked this pull request as ready for review July 26, 2023 19:03
@RaulTrombin RaulTrombin marked this pull request as draft July 27, 2023 13:15
@RaulTrombin RaulTrombin force-pushed the add_py_docs branch 5 times, most recently from 70c0dd6 to 0ba03af Compare July 28, 2023 01:10
@RaulTrombin RaulTrombin marked this pull request as ready for review July 28, 2023 01:27

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_logo = "https://upload.wikimedia.org/wikipedia/commons/1/12/Bluerobotics-logo.svg"
Copy link
Member

Choose a reason for hiding this comment

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

Can we use this https://github.com/sphinx-toolbox/sphinx-pyproject to move mostly this configuration to pyproject ?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can, no stronger feelings on this, we still need a conf.py, just the content is moved to pyproject.toml file.

maturin
sphinx
sphinx-rtd-theme
sphinxcontrib-napoleon
Copy link
Member

Choose a reason for hiding this comment

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

This could be moved to pyproject as well

Copy link
Member Author

Choose a reason for hiding this comment

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

yes it becames unnecessary if we use poetry to setup the enviroment. please check new commits.

docs/Makefile Outdated
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Copy link
Member

Choose a reason for hiding this comment

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

We could move it to [tool.poetry.scripts] as well

Copy link
Member Author

Choose a reason for hiding this comment

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

not have sucess on this yet.
but this is currently working like this:

 6709  poetry install
 6711  poetry shell 
 6713  maturin build && env pip install --force-reinstall target/wheels/*.whl && cd docs && make clean html

@RaulTrombin RaulTrombin marked this pull request as draft August 1, 2023 21:06
@RaulTrombin RaulTrombin mentioned this pull request Aug 2, 2023
@RaulTrombin RaulTrombin force-pushed the add_py_docs branch 4 times, most recently from 4a0be8c to 6877a5a Compare August 3, 2023 14:25
@RaulTrombin RaulTrombin changed the title Add automatic Python documentation [Sphinx] Add Python documentation [Sphinx-Hatch] Aug 3, 2023
@RaulTrombin RaulTrombin marked this pull request as ready for review August 3, 2023 15:13
@RaulTrombin
Copy link
Member Author

removed makefile and requirements.txt.

Now we have hatch

hatch run dev:build-doc

Copy link
Member

@patrickelectric patrickelectric left a comment

Choose a reason for hiding this comment

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

@RaulTrombin CI is failing, needs rebase

@RaulTrombin
Copy link
Member Author

@RaulTrombin CI is failing, needs rebase

rebased

@patrickelectric patrickelectric merged commit ddddab1 into bluerobotics:master Aug 3, 2023
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