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

Adding Sphinx docs to template #318

Closed
wants to merge 19 commits into from
Closed

Adding Sphinx docs to template #318

wants to merge 19 commits into from

Conversation

matt-graham
Copy link
Collaborator

@matt-graham matt-graham commented Mar 20, 2024

Would resolve #16

Adds Sphinx documentation to template using sphinx-autodoc2 to generate API documentation and using MyST parser to allow use of Markdown in docstrings (and documentation pages). Also sets up a few other extensions - sphinx.ext.intersphinx for automatic links to other documentation with by default only the Python standard library index included, and sphinx.ext.viewcode to add links to source code. This is set up to use the PyData Sphinx theme which @samcunliffe recommeded on another project. A tox environment docs is added to simplify building documentation.

This was mainly intended as a demonstration that it's possible to get Sphinx set up in a way which will easy for users to use and doesn't require much boilerplate for reference in discussion in #16. It's not clear yet if we would want to go with Sphinx rather than Mkdocs.

I also haven't yet added any default workflows to the template for building docs - ideally we'd want to make it easy to automatically deploy to GitHub pages but this would require some manual intervention from user to specify where GitHub pages site should be generated from. We could as an intermediate step just have a workflow for testing docs build, with a commented out step for subsequently doing deployment on pushes to main with instructions to user to do necessary configuration before uncommenting.

EDIT: Screenshot of what generated documentation website looks like

image

To dos

  • Add workflow for testing building documentation on pull-requests and pushes to main (for example https://github.com/UCL/neso-calibration/blob/main/.github/workflows/docs.yml)
  • Add instructions of how to set up automatic deployment to GitHub pages in main README or as option in cookiecutter similar to git init
  • Add instructions for how to build documentation to template README.md
  • Decide whether to include README.md content in docs

@matt-graham matt-graham marked this pull request as draft March 20, 2024 14:56
@matt-graham matt-graham mentioned this pull request Mar 20, 2024
@samcunliffe
Copy link
Member

Decide whether to include README.md content in docs

I do quite like this. Sphinx vs MkDocs aside. It's DRY.

@matt-graham matt-graham added the enhancement New feature or request label Mar 21, 2024
@matt-graham
Copy link
Collaborator Author

Closing in favour of #319 as consensus decision in #16 is to add MkDocs instead to template.

@paddyroddy paddyroddy deleted the mmg/sphinx-docs branch March 22, 2024 17:46
samcunliffe added a commit that referenced this pull request Mar 24, 2024
Fixes #187.
Relates to #16, #318, and #319. See discussion in #16.
Depends on #319.
matt-graham added a commit that referenced this pull request Mar 25, 2024
Would resolve #16 as an alternative to #318

Adds MkDocs documentation to template, aiming for a comparable set of
features to what is implemented in #318 - automatically built API
documentation with Markdown syntax, support for references to external
documentation inventories, dark / light mode toggle, GitHub repository
link in docs, workflow for automatically testing building docs.

Example screenshot of rendered index page


![image](https://github.com/UCL-ARC/python-tooling/assets/6746980/e2578ed2-acd6-4322-8281-e21c1c4b9434)

and of API reference page


![image](https://github.com/UCL-ARC/python-tooling/assets/6746980/2d088c96-82ea-4a00-bff8-6e8e7d6e2aec)

---------

Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
Co-authored-by: Sam Cunliffe <samcunliffe@users.noreply.github.com>
samcunliffe added a commit that referenced this pull request Mar 25, 2024
Following the discussion in #16, I've tried to summarise (and might have
quoted you directly 😄). Picky comments very gratefully received.

## Fixes
- #187

## Relates to
- #16
- #318
- #319

---------

Co-authored-by: Matt Graham <matthew.m.graham@gmail.com>
Co-authored-by: David Stansby <dstansby@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation
4 participants