-
Notifications
You must be signed in to change notification settings - Fork 2
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 documentation #16
Comments
I've tried out a couple of similar workflows to yours @paddyroddy for building and deploying docs for two different projects based on the template https://github.com/UCL/dxh/blob/main/.github/workflows/docs.yml but both using Sphinx here rather than pdoc. Maybe some variant of this with a choice in template setup of doc system to use could work. Using tox to build docs worked quite well in making it easy to build both locally and in GitHub workflow. |
* Bump ARM Darwin build * Start adding linting
I don't mind what we do, but I think it would be good to make it really straightforward for users who are likely to not go down the docs route |
DecisionWe will move to
|
FWIW I'm 👎 on making sphinx amber - in my opinion it's more complicated than mkdocs, but there are advantages such as:
So I think worth keeping both mkdocs and sphinx as green, but explaining briefly the different use cases for them? |
MkDocs also has a wide range of plugins: https://github.com/mkdocs/catalog |
I don't think we should regularly "double-green" tools that 100% overlap functionality. Especially not when we're going to include one in the template. So I would demote one of the two to amber (we don't discourage it!) and have the simplest(?) most beginnerfriendly-est(?) be the recommended one which is also in the template. From memory, the arguments in favour of mkdocs were:
And in favour of sphinx:
Specifically against sphinx:
I now can't find it, but did we have an amber tool elsewhere with a disclaimer like: if you want to do X you will find this tool better. |
I think the first (need to use plugins / extensions) equally applies to Mkdocs as for example there is no built-in support for generating API documentation which I would say is something we would pretty much always want by default (and while With regards to the latter - there is decent Markdown support in Sphinx, see for example this guide and I think also the 'Mkdocs is simpler' is partly subjective - I've set up a lot of projects with Sphinx docs and after getting over the initial learning curve it was pretty easy to work with for basic use cases of generating API documentation plus a few top-level documentation pages. I think it gets more complex when you start to use lots of plug-ins, but that's opt-in. Overall I don't have a strong preference between Sphinx and Mkdocs, I think both are great tools and would be happy with recommending either. |
Any ARC projects using MkDocs? I can think of 3 using Sphinx. |
This is enough of a reason against, seeing as we are aiming at beginners... |
I'm sure @p-j-smith is doing some too? There are probably others I'm forgetting. I think what annoys most about |
For the purposes of illustrating that setting up Sphinx doesn't require much boilerplate (no Makefiles present 😛) and would be simple for a user to set up (no additional steps compared to current use of |
I think I rather softly vote for MkDocs → 🟢 and Sphinx → 🟠 . Having used the latter quite a lot, I wouldn't say it's particularly "I don't care about configuration, please just set it up for me" -friendly. Which, we should remember, is our audience. We can write some caveats into our recommended tooling website. That said, I'd also be fine with Matt's PR #318. |
👍 , my bad for not reading our own definitions of red/amber/green
What features are you thinking of that ship with mkdocs by default, but need a plugin in Sphinx?
While beginner-freindliness is important I think is not the only consideration. For example I think using tools that are common in other open source Python projects (to avoid having to relearn when hopping across projects), and using tools that are commonly used across ARC are also important considerations. I think Matt's PR shows that sphinx doesn't have to have a lot of boilerplate? So I'd medium-hard vote for MkDocs → 🟠 and Sphinx → 🟢. |
It has:
Other than your familiarity with it, and the fact that you both don't think any open source projects use |
FWIW I'm heavily in favour of MkDocs → 🟢 and Sphinx → 🟠 based on how we define the traffic system and comments above. However, I do think it should be documented that many projects do and will continue to use |
I do also fear that #318 being worked one will mean it gets merged. For a fair comparison, an |
Can you link to a project that uses mkdocs so we can make a comparison with how complicated the setup/config is?
Please can we keep discussion civil! In my experience most scientific Python projects do use sphinx - I'm happy to be be shown otherwise though. I do agree that mkdocs has some nice advantages over sphinx - but I still think sphinx has some nice advantages over mkdocs. In my (quick, biased) opinion sphinx advantages outweigh mkdocs advantages, but I think the best way forward here would be to collaboratively come up with a table of advantages for each one, then we can come to a more considered consensus, and perhaps involve a wider set of folks in the decision? |
The problem with the ones I've used are ARC projects that are private, so you won't have access :( |
Also FYI I was being civil... |
Intersphinx is an important candidate for the sphinx pros list. Anyone used mkdocstrings cross-references? |
Being able to doing things like access the dynamically created version as recommeded by
Now removed thanks to @dstansby's comment.
There is no reStructured Text required in the example in #318 - everything is configured to use Markdown.
The reason for abstracting behind I also wouldn't say
is particularly complex and
as
Definitely no expectation that because I've worked on this we go with Sphinx, as I've said already here and on the PR. |
Just to close the loop (sorry for the noise)
I was thinking mostly of autodoc but might have misremembered and cede to Matt's comment. |
I've used
syntax before. But that was in the |
FYI from SRR I have this GitHub Action (which checks that all files are mentioned in the ---
name: MkDocs
# yamllint disable-line rule:truthy
on:
push:
branches:
- main
- release
- renovate/**
pull_request:
types:
- opened
- ready_for_review
- reopened
- synchronize
concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
jobs:
documentation:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout source
# yamllint disable-line rule:line-length
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up python
# yamllint disable-line rule:line-length
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: 3.x
cache: pip
cache-dependency-path: requirements.txt
- name: Install dependencies
run: python -m pip install --requirement requirements.txt
- name: Run MkDocs
run: mkdocs build --strict and This is the config file, using various features. The ---
copyright: Copyright © 2023 - 2024 ARC
edit_uri: edit/main/docs
repo_name: UCL-MIRSG/UCLH-MPBE-SRR-XNAT
repo_url: https://github.com/UCL-MIRSG/UCLH-MPBE-SRR-XNAT
site_author: UCL ARC
site_name: UCLH MPBE SRR XNAT
extra:
generator: false
icon:
edit: material/pencil
repo: fontawesome/brands/github
view: material/eye
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: "!!python/name:pymdownx.superfences.fence_code_format"
nav:
- Home: index.md
- Background:
- background/index.md
- Existing Pipeline:
- background/existing_pipeline/index.md
- SRR Processing Flowchart: >-
background/existing_pipeline/SRR_pipeline_overview.md
- Development:
- development/index.md
- Ansible: development/ansible.md
- Docker: development/docker.md
- Quality Management System Documentation:
- qms/index.md
- Software Development Plan:
- qms/software_development_plan/index.md
- System Overview: qms/software_development_plan/system_overview.md
- Software Development Overview: >-
qms/software_development_plan/software_dev_overview.md
- Software Requirement Analysis:
- qms/software_requirement_analysis/index.md
- Overview of Product Use: >-
qms/software_requirement_analysis/overview_of_product_use.md
- User Requirements Process: >-
qms/software_requirement_analysis/user_requirements_process.md
- Verification and Validation: >-
qms/software_requirement_analysis/verification_and_validation.md
- Appendices: qms/software_requirement_analysis/appendices.md
- Software Architecture Design:
- qms/software_architecture_design/index.md
- Software Architecture Document: >-
qms/software_architecture_design/software_architecture_overview.md
- Software Detailed Design:
- qms/software_detailed_design/index.md
- Software Unit and Integration Testing:
- qms/software_unit_and_integration_testing/index.md
- qms/software_unit_and_integration_testing/srr_testing.md
- qms/software_unit_and_integration_testing/unit_test_protocols.md
- Software System Testing and Validation:
- qms/software_system_testing_and_validation/index.md
- Software Risk Management:
- qms/software_risk_management/index.md
- Software Change Control and Problem Resolution Processes:
- qms/software_change_and_problem_processes/index.md
- Software Release Process:
- qms/software_release_process/index.md
- Post Market Surveillance and Software Maintenance:
- qms/software_maintenance/index.md
plugins:
- include-markdown
- search
theme:
features:
- announce.dismiss
- content.action.edit
- content.action.view
- content.code.copy
- header.autohide
- navigation.expand
- navigation.footer
- navigation.indexes
- navigation.tabs
- navigation.top
- navigation.tracking
- search.highlight
- search.suggest
- toc.follow
name: material
palette:
# palette toggle for dark mode
- scheme: slate
toggle:
icon: material/brightness-4
name: Switch to light mode
# palette toggle for light mode
- scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
validation:
absolute_links: warn
omitted_files: warn
unrecognized_links: warn These are the only files. The rest are markdown files in a |
Now added an equivalent PR #319 adding MkDocs support to template Overall I would say similar level of complexity for the user. In both cases if they wanted add a new page they would create a Markdown file in MkDocs supports Google, NumPy and Sphinx style docstrings - I've currently used the Google style. The intersphinx equivalent seems to work well. |
My summary of points for and against Sphinx / MkDoc, partly based on my attempts of adding each to template For Sphinx
Against Sphinx
For MkDocs
Against MkDocs
I personally did not find MkDocs any easier to set up than Sphinx - I am slightly more familiar with Sphinx, but in both cases my main pain point was having to hunt out things across both main documentation and plug-in / extension specific documentation, and for both the resulting structure is similar - a configuration file ( The lack of support for NumPy / Google docstrings and low bus-factor in |
For automatically generating API docs in sphinx I've used https://numpydoc.readthedocs.io/en/latest/index.html + https://github.com/astropy/sphinx-automodapi with NumPy style docstrings. I'm now coming round to the list of MkDocs features outweighing the wide usage of sphinx, so I think makes sense for it to go 🟢 and the MkDocs PR to be merged given that now seems to be the consensus 👍 I think worth having a discussion about which docstring style to recommend/use, but that's definitely for another issue 😄 |
As we do seem to have coalesced on MkDocs → 🟢 I've closed #318 and marked #319 as ready for review - thanks @paddyroddy for having already given it a once over. |
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>
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>
A really lazy way: paddyroddy/python-template#9 (+ paddyroddy/python-template#10 + paddyroddy/python-template#11) as I'm an idiot) which allows you to just use
github-pages
deploying from agh-pages
branch with these settingsA better example that I just did looks like: https://astro-informatics.github.io/sleplet/
The text was updated successfully, but these errors were encountered: