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

Theme update #58

Merged
merged 33 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
814301c
Update Python to 3.11, Sphinx to 5.0, sphinx_book_theme to 1.0.0
erogluorhan Jan 18, 2024
2c661e2
Updated RTD Python to 3.11
erogluorhan Jan 18, 2024
66ebce0
Update sphinx-book-theme to 1.0.0. (1.1.0 is not yet supported by lat…
erogluorhan Jan 18, 2024
4046c93
Update Copyright year in docs/_config.yml and docs/conf.py
erogluorhan Jan 18, 2024
fe07c7c
Add sphinx-design and change 'tabbed' directives to 'tab-set-code'
erogluorhan Jan 18, 2024
4b164a0
Fix the depreations, layout changes since book-theme 0.1.10
erogluorhan Jan 26, 2024
050ceb9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 26, 2024
be8c865
Remove sphinx-book-theme upper version pinning
erogluorhan Jan 26, 2024
cffb2aa
Merge branch 'theme-update' of github.com:ProjectPythia/sphinx-pythia…
erogluorhan Jan 26, 2024
003b14c
Fix RTD
erogluorhan Jan 26, 2024
ff7377d
Fix sphinx-tabs
erogluorhan Jan 26, 2024
abc529b
Fix RTD by removing conda
erogluorhan Jan 27, 2024
81e5f35
Add ci fodler and docs.yml
erogluorhan Jan 27, 2024
510ea1c
Fix docs
erogluorhan Jan 27, 2024
400c9af
Add environment.yml fil
erogluorhan Jan 27, 2024
70e7d8a
Fix publish
erogluorhan Jan 27, 2024
e30967c
Remove environment and update ci.yml a bit
erogluorhan Jan 27, 2024
190c200
Change conda list to pip list
erogluorhan Jan 27, 2024
eaff689
Remove sphinx inline tabs per review suggestion
erogluorhan Jan 30, 2024
a89e2d4
Separate pypi publishing from ci.yaml
erogluorhan Jan 30, 2024
b06f514
Migrate PyPI publishing to build invocations
erogluorhan Jan 30, 2024
94b1403
Update MANIFEST.in
erogluorhan Jan 30, 2024
b60dea0
Theme update - Update all the layout sections/components and css feat…
erogluorhan Feb 17, 2024
ae0cc04
Fix navbar colors
erogluorhan Feb 21, 2024
fab3fd8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2024
28544bf
Fix navbar colors
erogluorhan Feb 21, 2024
5eb07cd
Fix navbar colors
erogluorhan Feb 21, 2024
29af999
Update layout and theme.scss to fix issues on foundations pages
erogluorhan Mar 14, 2024
9283653
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 14, 2024
792875d
Move pypi.yaml to under github/workflows
erogluorhan Mar 19, 2024
9d898e6
Correct an email to projectpythia's
erogluorhan Mar 19, 2024
fd5ebd8
Change pst-color-text-muted to fix too light navbar links
erogluorhan Mar 23, 2024
c76471f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 23, 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
69 changes: 27 additions & 42 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,48 @@ on:
tags:
- '*'
pull_request:
workflow_dispatch:

jobs:

jupyterbook:
name: Build Jupyter Book
name: Build Jupyter Book and Sphinx Docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cancel previous runs
uses: styfle/[email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks a lot; wasn't aware of this key. Just went over its docs and found it a bit more complicated than what is currently here (e.g. defining groups, specifying if concurrency for PR numbers, etc.), though please feel free to push the change if you'd like that better (and maybe find it more useful than the one here).

If I were to implement it, should it look something like this:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I didn't see this outstanding question. Yes, the concurrency group just needs to be non-unique for the same PR e.g.

group: 'docs-${{ github.head_ref || github.run_id }}'

This ensures that if the run doesn't have a head_ref (non-PRs), then it falls back to a unique identifier.

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries! FYI: The theme update is working now, and its proper functioning (with a few non-vital issues) has been confirmed through tests by a few team members. It is a bit time sensitive before our upcoming community event; hence, I'd like to get it merged and go forward to be used by our portal.

I've created a new issue though to address this suggestion.

Thanks very much for all your help and review!

with:
access_token: ${{ github.token }}

- name: checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
python -m pip install . --no-deps

- name: pip list
run: |
pip list

- name: Download references from Sphinx Book Theme
run: python docs/getreferences.py docs/references
- name: Build Jupyter Book
run: jupyter-book build docs
run: |
python docs/getreferences.py docs/references

sphinx:
name: Build Sphinx Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
- name: Build Jupyter Book
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
jupyter-book build docs

- name: Build Sphinx documentation
run: sphinx-build -b html docs docs/_build/html

publish:
name: Publish to PyPI
needs: [jupyterbook, sphinx]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install build dependecies
run: pip install setuptools setuptools-scm wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Upload to PyPI

on:
release:
types:
- published

jobs:
test-build:
if: github.repository == 'ProjectPythia/sphinx-pythia-theme'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Build tarball and wheels
run: |
git clean -xdf
git restore -SW .
python -m build

- name: Test the built artifacts
run: |
python -m twine check --strict dist/*
pwd
if [ -f dist/sphinx-pythia-theme-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist

publish:
needs: test-build
if: github.event_name == 'release'
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/sphinx-pythia-theme
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: releases
path: dist

- name: Publish package to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
17 changes: 10 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
# Required
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"
jobs:
post_create_environment:
- python -m pip install --no-cache-dir .

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally set the version of Python and requirements required to build your docs
python:
version: '3.8'
install:
- requirements: requirements.txt
- method: pip
path: .
conda:
environment: ci/docs.yml
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exclude .readthedocs.yaml
exclude .web-compile-config.yml
exclude requirements.txt
recursive-exclude ci *.yml
recursive-exclude ci *.yaml

include LICENSE
include MANIFEST.in
Expand Down
8 changes: 8 additions & 0 deletions ci/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: sphinx-pythia-theme-docs
channels:
- conda-forge
dependencies:
- python<3.12
- pip
- pip:
- -r ../requirements.txt
6 changes: 3 additions & 3 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
title: ""
logo: images/dummy_logo_dark.svg
author: the Project Pythia Community
copyright: "2022"
email: kpaul@ucar.edu
copyright: "2024"
email: projectpythia@ucar.edu
description: >- # this means to ignore newlines
This is an example book built with Jupyter Books.

Expand Down Expand Up @@ -104,7 +104,7 @@ sphinx:
extra_extensions:
- ablog
- sphinx_click.ext
- sphinx_inline_tabs
- sphinx.ext.autodoc
- sphinx.ext.intersphinx
- sphinxcontrib.bibtex
- sphinxcontrib.youtube
43 changes: 25 additions & 18 deletions docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Where the Sphinx Book Theme places your ``html_logo`` at the top of the left sid
Theme places the logo on the left of the top navigation bar. The PyData Sphinx Theme allows the user
to set the link attached to the logo with the ``logo_link`` option in your Sphinx ``html_theme_options``
dictionary. You can learn how to customize your logo on the
`PyData Sphinx Theme documentation <https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#configure-project-logo>`_.
`PyData Sphinx Theme documentation <https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/branding.html#customize-logo-link>`_.

The links on the navigation bar can be set with the ``html_theme_options`` ``navbar_links`` option.
This is a list of dictionaries containing a ``name`` key, ``url`` key, and an ``external`` key. The
Expand All @@ -31,7 +31,7 @@ Additionally, the
(``external_links``) option from the PyData Sphinx Theme still works, and these links
will be displayed after any links specified by the ``navbar_links`` option.

.. tabbed:: Sphinx
.. tab-set-code:: Sphinx
agoose77 marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: python

Expand All @@ -46,7 +46,7 @@ will be displayed after any links specified by the ``navbar_links`` option.
]
}

.. tabbed:: Jupyter Book
.. tab-set-code:: Jupyter Book

.. code-block:: yaml

Expand Down Expand Up @@ -75,34 +75,40 @@ Footer Bar
----------

In addition to the top navigation bar at the top of each page, the full-width footer
bar from the PyData Sphinx Theme has been readded to the bottom of every page. By default, the
footer bar only contains copyright and additional information about the Sphinx version (if configured).
bar from the PyData Sphinx Theme has been re-added to the bottom of every page.

.. note::
While PyData Sphinx Theme has ``footer_start``, ``footer_center``, and ``footer_end`` to set,
our theme supports only ``footer_start``, and allows to add below structures into it.

By default, the footer bar only contains copyright and additional information about the Sphinx version (if configured).
Three additional sections can be added to the footer: a *logo bar*, a *bottom navigation menu*, and
an *extras* section.

Footer Logo Bar
^^^^^^^^^^^^^^^

The *logo bar* section can be used to add logo images for various partner or collaboration
institutions, products, or other entities involved with site itself. These are spread out
institutions, products, or other entities involved with site itself. These are spread out
evenly across the footer in a light-gray full-width box.

To add logo images to the *logo bar* in the footer, use the ``footer_logos`` option of the
``html_theme_options``. The name given to each logo is used as the alternate name of
the image in HTML.
``html_theme_options`` and then add it to ``footer_start``. The name given to each logo is
used as the alternate name of the image in HTML.

.. tabbed:: Sphinx
.. tab-set-code:: Sphinx

.. code-block:: python

html_theme_options = {
'footer_logos': {
'name1': 'images/logo1.svg',
'name2': 'images/logo2.svg',
}
},
"footer_start": ["footer-logos"]
}

.. tabbed:: Jupyter Book
.. tab-set-code:: Jupyter Book

.. code-block:: yaml

Expand All @@ -125,7 +131,7 @@ key containing any CSS classes to add to the HTML column division, and an ``item
list of dictionaries containing ``name``, ``url``, and ``external`` keys (with the same meaning as
the keys in the ``navbar_links`` option above).

.. tabbed:: Sphinx
.. tab-set-code:: Sphinx

.. code-block:: python

Expand Down Expand Up @@ -162,9 +168,10 @@ the keys in the ``navbar_links`` option above).
],
},
],
"footer_start": ["footer-menu"]
}

.. tabbed:: Jupyter Book
.. tab-set-code:: Jupyter Book

.. code-block:: yaml

Expand Down Expand Up @@ -195,7 +202,7 @@ Extra Footer
The *extra* section of the footer is displayed immediately below the *info* section, and
it can be set with the
`extra footer <https://sphinx-book-theme.readthedocs.io/en/latest/customize/index.html?highlight=extra_footer#theme-options>`_
(``extra_footer``) Sphinx Book Theme option.
(``extra_footer``) Sphinx Book Theme option and then added to the ``footer_start``.

Special Page layouts
--------------------
Expand Down Expand Up @@ -227,7 +234,7 @@ Each *banner* section can be given its own background color or even background i
To customize your own banners, all you need to do is add a ``banner`` directive to your
section.

.. tabbed:: reStructuredText
.. tab-set-code:: reStructuredText

.. code-block:: rst

Expand All @@ -237,7 +244,7 @@ section.
caption: Photo by Jeff Stapleton from Pexels
class: dark-banner

.. tabbed:: Myst Markdown
.. tab-set-code:: Myst Markdown

.. code-block:: markdown

Expand Down Expand Up @@ -275,7 +282,7 @@ you need to declare which pages (by document name) will have the *banner* layout
this, you need to declare the ``page_layouts`` option in the ``html_theme_options`` and
tell the theme to use the ``page-banner.html`` template.

.. tabbed:: Sphinx
.. tab-set-code:: Sphinx

.. code-block:: python

Expand All @@ -285,7 +292,7 @@ tell the theme to use the ``page-banner.html`` template.
}
}

.. tabbed:: Jupyter Book
.. tab-set-code:: Jupyter Book

.. code-block:: yaml

Expand Down
Loading
Loading