Skip to content

Commit

Permalink
Adopt documentation theme from pyData (#141)
Browse files Browse the repository at this point in the history
* Replace `setup.py` script with `stylist.toml` configuration file.

* Turned out the `.toml` file wasn't being used.

* Discovered mistake in pull request workflow.

* Since `setup.py` has been removed we can't check it with `mypy`

* Added Conda Forge badge to ReadMe.

* Constrain fParser version.

* Remove reference to setup.py from documentation.

* Adopy pyData theme for documentation.

* Correct theme package name.

* Add centre footer.

* Downgrade theme to an available one.

* Updated Sphinx theme and fixed project for more recent PIP.

* Update Python version for Sphinx.
  • Loading branch information
MatthewHambley authored May 20, 2024
1 parent 900b9df commit b121ef8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.11

- name: Cache pip
uses: actions/cache@v2
Expand Down
11 changes: 11 additions & 0 deletions documentation/source/_templates/crown-copyright.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{# Crown copyright is presented differently to normal copyright. #}
{# This template uses details from conf.py #}
{% if show_copyright and copyright %}
<p class="copyright">
{% if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{path}}">Copyright</a> {{copyright}}.{% endtrans %}
{% else %}
{% trans copyright=copyright|e %}&copy; Crown Copyright {{copyright}}.{% endtrans %}
{% endif %}
</p>
{% endif %}
17 changes: 15 additions & 2 deletions documentation/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------

project = 'Stylist'
copyright = '2022, Crown Copyright'
copyright = '2024, Met Office. All rights reserved'
author = 'Stylist Developers'

# Headline version for archiving purposes.
Expand Down Expand Up @@ -82,7 +82,20 @@
# 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 = 'pydata_sphinx_theme'

html_theme_options = {
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/MetOffice/stylist",
"icon": "fa-brands fa-github"
}
],
"footer_start": ["crown-copyright"],
"footer_center": ["sphinx-version"],
"footer_end": ["theme-version"]
}

# 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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test = ['pytest', 'pytest-cov', 'mypy']
performance = ['pytest', 'pytest-benchmark', 'matplotlib']
docs = ['sphinx < 7.0.0',
'sphinx-autodoc-typehints',
'sphinx-rtd-theme>=1.2.2']
'pydata-sphinx-theme>=0.15.2']
release = ['setuptools', 'wheel', 'twine']

[project.scripts]
Expand Down

0 comments on commit b121ef8

Please sign in to comment.