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

Generate documentation from docstrings #403

Merged
merged 31 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2a3ccc3
Google-style docstring
sophie22 Jan 17, 2024
a896601
correct formatting for sphinx compatibility
sophie22 Jan 17, 2024
bf5cc49
add Google-style docstrings
sophie22 Jan 17, 2024
0e28382
add docstrings
sophie22 Jan 17, 2024
3599cee
remove CLI diagram as it doesn't render correctly on RTD
sophie22 Jan 17, 2024
82d938c
move relaxometry params to data folder
sophie22 Jan 17, 2024
12d0dcf
create rst files for RTD
sophie22 Jan 17, 2024
5485a4e
add instructions for updating auto-documentation
sophie22 Jan 17, 2024
411cab5
add new lines for better sphinx parsing
sophie22 Jan 17, 2024
6e149d2
correct the relative import path
sophie22 Jan 17, 2024
f4c9289
split task docs for ACR and MagNet
sophie22 Jan 22, 2024
5582d14
directly list hazenlib docs
sophie22 Jan 22, 2024
167214a
fix version import for publishing
sophie22 Jan 22, 2024
589d338
add Molly to contributors
sophie22 Jan 22, 2024
cedc229
Merge branch 'main' into 397-standardise-docstrings
sophie22 Jan 23, 2024
e31aa1d
Convert all docstrings in acr_geometric_accuracy to google style
mollybuckley Jan 25, 2024
d16ac0c
Update import path
sophie22 Jan 25, 2024
d2496af
update import paths
sophie22 Jan 25, 2024
c005cc5
Google style docstrings for acr_ghosting
mollybuckley Jan 25, 2024
8ee4860
Google-style docstrings for acr_slice_position
mollybuckley Jan 28, 2024
cd7ef6a
Google style docstrings for acr_slice_thickness
mollybuckley Jan 30, 2024
e431f9d
Google style docstrings for acr_geometric_accuracy
mollybuckley Jan 30, 2024
ead4dc9
Google style docstrings for acr_ghosting
mollybuckley Jan 30, 2024
35954da
google style docstrings for acr_slice_position
mollybuckley Jan 30, 2024
79c167d
google style docstrings for acr_slice_thickness
mollybuckley Jan 30, 2024
be56ad9
Google style docstrings for ACR_SNR
mollybuckley Feb 1, 2024
82c22b6
Google style docstrings for acr_uniformity
mollybuckley Feb 12, 2024
ba662fa
minor stylistic changes, some typo fixes
sophie22 Feb 15, 2024
6072a8c
blacks formatting, docstring styling
sophie22 Feb 15, 2024
5c88b0f
resolve some TODOs
sophie22 Feb 27, 2024
1fec22f
revert img value
sophie22 Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- [2) How to make and test code changes](#2-how-to-make-and-test-code-changes)
- [3) Developer Process for Contributing](#3-developer-process-for-contributing)
- [4) Release Process](#4-release-process)
- [5) Update Documentation](#5-update-documentation)


## 1) Introduction

Expand Down Expand Up @@ -148,4 +150,18 @@ For a new release: <br>
> - Updated cli-test.yml by @laurencejackson in #195
> - Release/0.5.2 by @tomaroberts in #196

## 5) Update Documentation

Create rst files describing the structure of the hazen Python Package
```
# in an active hazen virtual environment in the root of the project
# the command below specifies that sphinx should look for scripts in the hazenlib folder
# and output rst files into the docs/source folder
sphinx-apidoc -o docs/source hazenlib

# next, from within the docs/ folder
cd docs/
# create/update the html files for the documentation
make html -f Makefile
# opening the docs/source/index.html in a web browser allows a preview of the generated docs
```
75 changes: 41 additions & 34 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
#
import os
import sys
from hazenlib import __version__

sys.path.insert(0, os.path.abspath("../.."))
from hazenlib._version import __version__

Check failure on line 16 in docs/source/conf.py

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.9)

E402 module level import not at top of file

Check failure on line 16 in docs/source/conf.py

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.10)

E402 module level import not at top of file


# -- Project information -----------------------------------------------------

project = 'hazen'
copyright = '2022, Haris Shuaib'
author = 'Haris Shuaib'
project = "hazen"
copyright = "2022, Haris Shuaib"
author = "Haris Shuaib"

# The full version, including alpha/beta/rc tags
release = __version__
Expand All @@ -32,22 +31,30 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon', # NumPy and Google docstrings
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinxcontrib.bibtex'
]
napoleon_google_docstring = False
napoleon_use_param = False
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon", # NumPy and Google docstrings
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinxcontrib.bibtex",
]

napoleon_google_docstring = True
napoleon_use_param = True
napoleon_use_ivar = True
bibtex_bibfiles = ['references.bib']
napoleon_use_rtype = True
napoleon_use_keyword = True
napoleon_custom_sections = None
autodoc_member_order = "bysource"

bibtex_bibfiles = ["references.bib"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -60,25 +67,25 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"
html_theme_options = {
'analytics_id': '', # Provided by Google in your dashboard
'analytics_anonymize_ip': False,
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
'style_nav_header_background': '',
"analytics_id": "", # Provided by Google in your dashboard

Check failure on line 72 in docs/source/conf.py

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.9)

E262 inline comment should start with '# '

Check failure on line 72 in docs/source/conf.py

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 3.10)

E262 inline comment should start with '# '
"analytics_anonymize_ip": False,
"logo_only": False,
"display_version": True,
"prev_next_buttons_location": "bottom",
"style_external_links": False,
"vcs_pageview_mode": "",
"style_nav_header_background": "",
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
"collapse_navigation": True,
"sticky_navigation": True,
"navigation_depth": 4,
"includehidden": True,
"titles_only": False,
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
1 change: 1 addition & 0 deletions docs/source/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Contributors
* `Elizabeth Stamou <https://github.com/elizaGSTT>`_
* `Francesco Padormo <https://github.com/francescopadormo>`_
* `Sian Culley <https://github.com/superresolusian>`_
* `Molly Buckley <https://github.com/mollybuckley>`_
62 changes: 62 additions & 0 deletions docs/source/hazenlib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
hazenlib package
================

Core functions
-----------------

.. automodule:: hazenlib
:members:
:undoc-members:
:show-inheritance:

Task-specific functions
------------------------

.. toctree::
:maxdepth: 4

hazenlib.tasks.acr
hazenlib.tasks.magnet

Utility functions:
-------------------

hazenlib.ACRObject
-------------------

.. automodule:: hazenlib.ACRObject
:members:
:undoc-members:
:show-inheritance:

hazenlib.HazenTask
-------------------

.. automodule:: hazenlib.HazenTask
:members:
:undoc-members:
:show-inheritance:

hazenlib.exceptions
--------------------------

.. automodule:: hazenlib.exceptions
:members:
:undoc-members:
:show-inheritance:

hazenlib.logger
----------------------

.. automodule:: hazenlib.logger
:members:
:undoc-members:
:show-inheritance:

hazenlib.utils
---------------------

.. automodule:: hazenlib.utils
:members:
:undoc-members:
:show-inheritance:
58 changes: 58 additions & 0 deletions docs/source/hazenlib.tasks.acr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
hazenlib ACR tasks
===================

hazenlib.tasks.acr\_geometric\_accuracy task
----------------------------------------------

.. automodule:: hazenlib.tasks.acr_geometric_accuracy
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_ghosting task
-----------------------------------

.. automodule:: hazenlib.tasks.acr_ghosting
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_slice\_position task
------------------------------------------

.. automodule:: hazenlib.tasks.acr_slice_position
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_slice\_thickness task
-------------------------------------------

.. automodule:: hazenlib.tasks.acr_slice_thickness
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_snr task
------------------------------

.. automodule:: hazenlib.tasks.acr_snr
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_spatial\_resolution task
----------------------------------------------

.. automodule:: hazenlib.tasks.acr_spatial_resolution
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.acr\_uniformity task
-------------------------------------

.. automodule:: hazenlib.tasks.acr_uniformity
:members:
:undoc-members:
:show-inheritance:
66 changes: 66 additions & 0 deletions docs/source/hazenlib.tasks.magnet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
hazenlib MagNet tasks
=======================

hazenlib.tasks.ghosting task
------------------------------

.. automodule:: hazenlib.tasks.ghosting
:members:
:undoc-members:
:show-inheritance:

.. hazenlib.tasks.relaxometry task
.. ---------------------------------

.. .. automodule:: hazenlib.tasks.relaxometry
.. :members:
.. :undoc-members:
.. :show-inheritance:

hazenlib.tasks.slice\_position task
-------------------------------------

.. automodule:: hazenlib.tasks.slice_position
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.slice\_width task
----------------------------------

.. automodule:: hazenlib.tasks.slice_width
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.snr task
-------------------------

.. automodule:: hazenlib.tasks.snr
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.snr\_map task
------------------------------

.. automodule:: hazenlib.tasks.snr_map
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.spatial\_resolution task
-----------------------------------------

.. automodule:: hazenlib.tasks.spatial_resolution
:members:
:undoc-members:
:show-inheritance:

hazenlib.tasks.uniformity task
--------------------------------

.. automodule:: hazenlib.tasks.uniformity
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ We have also built an interactive web-based implementation of *hazen*, which is

gettingstarted
tasks
hazenlib
getinvolved
contributors

Expand Down
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
hazenlib
========

.. toctree::
:maxdepth: 4

hazenlib
Loading
Loading