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 22 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/cancel-workflow-action@0.12.0
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 }}
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
67 changes: 67 additions & 0 deletions ci/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/setup-python@v5.0.0
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/gh-action-pypi-publish@v1.8.11
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
4 changes: 2 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title: ""
logo: images/dummy_logo_dark.svg
author: the Project Pythia Community
copyright: "2022"
copyright: "2024"
email: kpaul@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
22 changes: 11 additions & 11 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 @@ -91,7 +91,7 @@ To add logo images to the *logo bar* in the footer, use the ``footer_logos`` opt
``html_theme_options``. 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

Expand All @@ -102,7 +102,7 @@ the image in HTML.
}
}

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

.. code-block:: yaml

Expand All @@ -125,7 +125,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 @@ -164,7 +164,7 @@ the keys in the ``navbar_links`` option above).
],
}

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

.. code-block:: yaml

Expand Down Expand Up @@ -227,7 +227,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 +237,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 +275,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 +285,7 @@ tell the theme to use the ``page-banner.html`` template.
}
}

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

.. code-block:: yaml

Expand Down
14 changes: 8 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

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

author = "the Project Pythia Community"
copyright = "2022"
author = "The Project Pythia Community"
copyright = "2024"

# -- General configuration ---------------------------------------------------

Expand All @@ -32,15 +32,18 @@
"sphinx_click.ext",
"sphinx_comments",
"sphinx_copybutton",
"sphinx_design",
"sphinx_external_toc",
"sphinx_inline_tabs",
"sphinx_panels",
"sphinx_tabs.tabs",
"sphinx_thebe",
"sphinx_togglebutton",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinxcontrib.bibtex",
"sphinxcontrib.youtube",
"sphinxext.opengraph",
]

Expand All @@ -52,7 +55,7 @@
external_toc_path = "_toc.yml"

intersphinx_mapping = {
"python": ("https://docs.python.org/3.8", None),
"python": ("https://docs.python.org/3.11", None),
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
}

Expand Down Expand Up @@ -115,15 +118,14 @@
"index": [],
"standalone": [],
"reference/blog/*": [
"sidebar-logo.html",
"navbar-logo.html",
"search-field.html",
"postcard.html",
"recentposts.html",
"tagcloud.html",
"categories.html",
"archives.html",
"sbt-sidebar-nav.html",
"sbt-sidebar-footer.html",
],
}

Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools-scm>=7",
]

[tool.setuptools_scm]
fallback_version = "9999"
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ jupyter-book
matplotlib
pandas
sphinx-click
sphinx-design
sphinx-panels
sphinx-inline-tabs
sphinx-tabs
sphinxcontrib-youtube
sphinxext-opengraph
Loading
Loading