From 891819101a4c16632bd753512ea87ef7ef5e3cb2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 13 Aug 2023 23:13:14 -0600 Subject: [PATCH 001/120] Revert "Use correct block, enable built-in slash keypress" --- python_docs_theme/layout.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index f830491..b4502ba 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -82,7 +82,12 @@

{{ _('Navigation') }}

{{ super() }} {%- endblock -%} -{%- block document %} +{%- block css -%} + + {{ super() }} +{%- endblock -%} + +{%- block body_tag %} {{ super() }} {%- if builder != 'htmlhelp' %}
From fc8a8bd0d389aaa8696f3dca6f4a3b118ee5e01f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 14 Aug 2023 08:35:45 +0300 Subject: [PATCH 002/120] Bump version to allow CI conflict resolution due to https://github.com/python/cpython/pull/107666 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b4179d1..4042fd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" # project metadata [project] name = "python-docs-theme" -version = "2023.7" +version = "2023.8" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" urls.Code = "https://github.com/python/python-docs-theme" From d766a12d3269ab3624178f07cc4493133345da12 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 20 Aug 2023 13:22:35 +0300 Subject: [PATCH 003/120] Add Python 3.12 classifier --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b4179d1..9461479 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] [[project.authors]] From 14201581d8fe396d270defa93599f133841b379c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 20 Aug 2023 04:27:19 -0600 Subject: [PATCH 004/120] Add Python 3.13 classifier Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 9461479..949cb25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] [[project.authors]] From 1ea6d1e6fe1c21b1fb1e16671dc6775cf0e018f2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 14 Aug 2023 08:35:45 +0300 Subject: [PATCH 005/120] Bump version to allow CI conflict resolution due to https://github.com/python/cpython/pull/107666 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 949cb25..9be4a24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" # project metadata [project] name = "python-docs-theme" -version = "2023.7" +version = "2023.8" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" urls.Code = "https://github.com/python/python-docs-theme" From 3f1b3b3b100c24c3f5e59e296ad046cdb0b0c082 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 20 Aug 2023 13:16:00 +0300 Subject: [PATCH 006/120] Build & maybe upload PyPI package via trusted publishing --- .github/workflows/pypi-package.yml | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/pypi-package.yml diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml new file mode 100644 index 0000000..e482641 --- /dev/null +++ b/.github/workflows/pypi-package.yml @@ -0,0 +1,67 @@ +--- +name: Build & maybe upload PyPI package + +on: + push: + branches: [main] + tags: ["*"] + pull_request: + branches: [main] + release: + types: + - published + workflow_dispatch: + +permissions: + contents: read + id-token: write + +jobs: + # Always build & lint package. + build-package: + name: Build & verify package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: hynek/build-and-inspect-python-package@v1 + + # Upload to Test PyPI on every commit on main. + release-test-pypi: + name: Publish in-dev package to test.pypi.org + if: github.repository_owner == 'python' && github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: build-package + + steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + + - name: Upload package to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + # Upload to real PyPI on GitHub Releases. + release-pypi: + name: Publish released package to pypi.org + environment: release-pypi + if: github.repository_owner == 'python' && github.event.action == 'published' + runs-on: ubuntu-latest + needs: build-package + + steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 1e4b09e2a64d911088816c6fde937f10dabbf1a6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 21 Aug 2023 08:29:20 +0300 Subject: [PATCH 007/120] Apply suggestions from code review Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- .github/workflows/pypi-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index e482641..6703e19 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -1,4 +1,3 @@ ---- name: Build & maybe upload PyPI package on: @@ -50,7 +49,7 @@ jobs: # Upload to real PyPI on GitHub Releases. release-pypi: - name: Publish released package to pypi.org + name: Publish to PyPI environment: release-pypi if: github.repository_owner == 'python' && github.event.action == 'published' runs-on: ubuntu-latest From a1740d85a91fd896c5f3e48fe48c7bdc42a81954 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 21 Aug 2023 08:51:56 +0300 Subject: [PATCH 008/120] Tighten permissions --- .github/workflows/pypi-package.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 6703e19..4b05fe6 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -13,7 +13,6 @@ on: permissions: contents: read - id-token: write jobs: # Always build & lint package. @@ -35,6 +34,9 @@ jobs: runs-on: ubuntu-latest needs: build-package + permissions: + id-token: write + steps: - name: Download packages built by build-and-inspect-python-package uses: actions/download-artifact@v3 @@ -55,6 +57,9 @@ jobs: runs-on: ubuntu-latest needs: build-package + permissions: + id-token: write + steps: - name: Download packages built by build-and-inspect-python-package uses: actions/download-artifact@v3 From 5c5e94d96fa3a328e7c004efe173b10489fbce1e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 21 Aug 2023 08:59:06 +0300 Subject: [PATCH 009/120] Don't fetch all history --- .github/workflows/pypi-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 4b05fe6..4f6fd2b 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -22,8 +22,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - uses: hynek/build-and-inspect-python-package@v1 From 6d82be0f1d0bb044105ccdf31b0b2a0871f2e8db Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 21 Aug 2023 17:39:34 +0300 Subject: [PATCH 010/120] Don't upload to TestPyPI --- .github/workflows/pypi-package.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 4f6fd2b..926dacd 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -2,10 +2,9 @@ name: Build & maybe upload PyPI package on: push: - branches: [main] + branches: tags: ["*"] pull_request: - branches: [main] release: types: - published @@ -25,28 +24,6 @@ jobs: - uses: hynek/build-and-inspect-python-package@v1 - # Upload to Test PyPI on every commit on main. - release-test-pypi: - name: Publish in-dev package to test.pypi.org - if: github.repository_owner == 'python' && github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: build-package - - permissions: - id-token: write - - steps: - - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v3 - with: - name: Packages - path: dist - - - name: Upload package to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - # Upload to real PyPI on GitHub Releases. release-pypi: name: Publish to PyPI From c39a9f14456cfe2caabe676ef0863913773da358 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 24 Aug 2023 21:20:16 +0300 Subject: [PATCH 011/120] Dark mode: Also give aside.topic a dark background --- python_docs_theme/static/pydoctheme_dark.css | 1 + 1 file changed, 1 insertion(+) diff --git a/python_docs_theme/static/pydoctheme_dark.css b/python_docs_theme/static/pydoctheme_dark.css index 49a29e3..46a2c7a 100644 --- a/python_docs_theme/static/pydoctheme_dark.css +++ b/python_docs_theme/static/pydoctheme_dark.css @@ -103,6 +103,7 @@ div.warning { background-color: rgba(255, 0, 0, 0.5); } +aside.topic, div.topic, div.note, nav.contents { From c72797c54576273c17144d5c7364498f6b828b1e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 25 Aug 2023 09:05:09 +0300 Subject: [PATCH 012/120] Prepare 2023.8 release --- CHANGELOG.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b275b76..cbf71ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,16 @@ Changelog ========= +`2023.8 `_ +---------------------------------------------------------------------------- + +- Add Python 3.12 and 3.13 classifiers (#147) + Contributed by Hugo van Kemenade +- Dark mode: Also give aside.topic a dark background (#150) + Contributed by Hugo van Kemenade +- Revert "Enable the slash keypress to focus the search field (#141)" (#146) + Contributed by Hugo van Kemenade + `2023.7 `_ ---------------------------------------------------------------------------- From a36aa936add2de3d763d561af52c834184a0ea9c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 25 Aug 2023 00:23:47 -0600 Subject: [PATCH 013/120] Fix whitespace Co-authored-by: Ezio Melotti --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cbf71ce..5f6181f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,7 @@ Changelog ---------------------------------------------------------------------------- - Add Python 3.12 and 3.13 classifiers (#147) - Contributed by Hugo van Kemenade + Contributed by Hugo van Kemenade - Dark mode: Also give aside.topic a dark background (#150) Contributed by Hugo van Kemenade - Revert "Enable the slash keypress to focus the search field (#141)" (#146) From 8afde74e973b22b06849ea3b46cccf2f7ee5359d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 25 Aug 2023 10:21:01 -0600 Subject: [PATCH 014/120] Improve wording Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5f6181f..ae95309 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,7 @@ Changelog Contributed by Hugo van Kemenade - Dark mode: Also give aside.topic a dark background (#150) Contributed by Hugo van Kemenade -- Revert "Enable the slash keypress to focus the search field (#141)" (#146) +- Restore the menu on mobile devices (inadvertently broken in 2023.7) (#146) Contributed by Hugo van Kemenade `2023.7 `_ From f498f5548bdd5f6ea5f7b9fbd4ce17742c4c3a65 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 25 Aug 2023 19:22:07 +0300 Subject: [PATCH 015/120] Fix whitespace --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ae95309..cbf57d4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,7 +22,7 @@ Changelog - Sphinx 6.2 fix: add ``nav.contents`` where ``div.topic`` is used (#138) Contributed by Hugo van Kemenade - Dark mode: fix contrast for C++ specific styling (#133) - Contributed by Hugo van Kemenade + Contributed by Hugo van Kemenade - Don't let long code literals extend beyond the right side of the screen (#139) Contributed by Hugo van Kemenade - Test with Python 3.12 (#140) From 719222f002b0642b3553a5515c1cf8bbf08903fb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 26 Aug 2023 11:49:22 +0300 Subject: [PATCH 016/120] Simplify action triggers --- .github/workflows/pypi-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 926dacd..c4913eb 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -2,8 +2,6 @@ name: Build & maybe upload PyPI package on: push: - branches: - tags: ["*"] pull_request: release: types: From f15aa6da50f62d10af02f6528deb0b703a95daf1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 26 Aug 2023 18:22:28 +0300 Subject: [PATCH 017/120] Comment when the release-pypi step is run --- .github/workflows/pypi-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index c4913eb..2b8f8aa 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -26,6 +26,7 @@ jobs: release-pypi: name: Publish to PyPI environment: release-pypi + # Only run for published releases. if: github.repository_owner == 'python' && github.event.action == 'published' runs-on: ubuntu-latest needs: build-package From 23f0b4296f141dd73789c4b8b3b757b6e03c254d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 15 Jun 2023 17:40:02 +0300 Subject: [PATCH 018/120] Focus search box when pressing slash --- python_docs_theme/layout.html | 3 ++- python_docs_theme/static/search-focus.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 python_docs_theme/static/search-focus.js diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index b4502ba..82b7ef4 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -48,7 +48,7 @@

{{ _('Navigation') }}

{%- if builder != "htmlhelp" %} @@ -76,6 +76,7 @@

{{ _('Navigation') }}

{%- if not embedded %} + {%- endif -%} {%- endif -%} diff --git a/python_docs_theme/static/search-focus.js b/python_docs_theme/static/search-focus.js new file mode 100644 index 0000000..d6f2826 --- /dev/null +++ b/python_docs_theme/static/search-focus.js @@ -0,0 +1,10 @@ +document.addEventListener('keydown', function(event) { + if (event.key === '/') { + // Prevent "/" from being entered in the search box + event.preventDefault(); + + // Set the focus on the search box + let searchBox = document.getElementById('search-box'); + searchBox.focus(); + } +}); From 3f27d34ed682e2fce8dcc56b97bcc9557fb54bbe Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 16 Jun 2023 00:52:35 +0300 Subject: [PATCH 019/120] Allow / to be entered into search box, don't focus if edit already focused --- python_docs_theme/static/search-focus.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/python_docs_theme/static/search-focus.js b/python_docs_theme/static/search-focus.js index d6f2826..aa5b42f 100644 --- a/python_docs_theme/static/search-focus.js +++ b/python_docs_theme/static/search-focus.js @@ -1,10 +1,21 @@ +function isInputFocused() { + const activeElement = document.activeElement; + return ( + activeElement.tagName === 'INPUT' || + activeElement.tagName === 'TEXTAREA' || + activeElement.isContentEditable + ); +} + document.addEventListener('keydown', function(event) { if (event.key === '/') { - // Prevent "/" from being entered in the search box - event.preventDefault(); + if (!isInputFocused()) { + // Prevent "/" from being entered in the search box + event.preventDefault(); - // Set the focus on the search box - let searchBox = document.getElementById('search-box'); - searchBox.focus(); + // Set the focus on the search box + const searchBox = document.getElementById('search-box'); + searchBox.focus(); + } } }); From d389288cca97c3f12718b09ceff5b453f5e71329 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Thu, 28 Sep 2023 09:43:15 -0700 Subject: [PATCH 020/120] Fix the markup on contributing.rst (#156) It's rst not markdown. Replaced the leading hash with underlines. --- CONTRIBUTING.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c184a9c..0b2fbd6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,4 +1,5 @@ -# How to release +How to release +-------------- - Update CHANGELOG.rst - bump version (YYYY.MM) in pyproject.toml @@ -13,7 +14,8 @@ - push the tag (``git push --tags``) -# Makefile usage +Makefile usage +-------------- This project includes a simple Makefile for syncing changes to the theme with the main CPython repository. Run ``make help`` for details on available rules. From dc194ed1a25258fa004a46cb465f34b768baf20b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 4 Oct 2023 17:40:52 +0300 Subject: [PATCH 021/120] Add changelog for 2023.9 --- CHANGELOG.rst | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cbf57d4..ed7ca86 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,12 @@ Changelog ========= +`2023.9 `_ +---------------------------------------------------------------------------- + +- Focus search box when pressing slash (#153) + Contributed by Hugo van Kemenade + `2023.8 `_ ---------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 9be4a24..149c548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" # project metadata [project] name = "python-docs-theme" -version = "2023.8" +version = "2023.9" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" urls.Code = "https://github.com/python/python-docs-theme" From d70dd100273e4992dd610786a2dc8219e2b99bcd Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 4 Oct 2023 18:30:59 +0300 Subject: [PATCH 022/120] Update release checklist --- CONTRIBUTING.rst | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0b2fbd6..b0b4fa8 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,18 +1,20 @@ How to release -------------- -- Update CHANGELOG.rst -- bump version (YYYY.MM) in pyproject.toml -- commit -- push to check one last time if the tests pass github side. -- tag it (YYYY.MM). -- build (``python -m build``) -- Test it (in :file:`cpython/Doc` run - ``./venv/bin/pip install ../../python-docs-theme/dist/python-docs-theme-2021.8.tar.gz`` - then build the doc using ``make html``). -- upload it: ``twine upload dist/*``. -- push the tag (``git push --tags``) - +- Update ``CHANGELOG.rst`` +- Bump version (YYYY.MM) in ``pyproject.toml`` +- Commit +- Push to check tests pass on + `GitHub Actions `__ +- Go to https://github.com/python/python-docs-theme/releases +- Click "Draft a new release" +- Click "Choose a tag" +- Type the next YYYY.MM version and + select "**Create new tag: YYYY.MM** on publish" +- Click "Generate release notes" and amend as required +- Click "Publish release" +- Check the tagged `GitHub Actions build `__ + has deployed to `PyPI `__ Makefile usage -------------- From f738dc01fb2ce5f40ce495925a4c1aa01a045579 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 4 Oct 2023 21:40:32 +0300 Subject: [PATCH 023/120] Clarify checklist --- CONTRIBUTING.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b0b4fa8..2533e96 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -9,8 +9,9 @@ How to release - Go to https://github.com/python/python-docs-theme/releases - Click "Draft a new release" - Click "Choose a tag" -- Type the next YYYY.MM version and +- Type the next YYYY.MM version (no leading zero) and select "**Create new tag: YYYY.MM** on publish" +- Leave the "Release title" blank (it will be autofilled) - Click "Generate release notes" and amend as required - Click "Publish release" - Check the tagged `GitHub Actions build `__ From 79febab4027f3992165b1c14a2583a530cb35876 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 11 Oct 2023 12:35:45 +0200 Subject: [PATCH 024/120] Lint on GitHub Actions via pre-commit --- .flake8 | 2 ++ .github/workflows/lint.yml | 20 ++++++++++++ .github/workflows/pypi-package.yml | 2 +- .github/workflows/tests.yml | 33 ++++++++++--------- .pre-commit-config.yaml | 50 +++++++++++++++++++++++++++++ README.rst | 2 +- code_of_conduct.rst | 1 - pyproject.toml | 51 ++++++++++++++---------------- python_docs_theme/__init__.py | 8 +++-- python_docs_theme/static/menu.js | 2 +- 10 files changed, 121 insertions(+), 50 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..2bcd70e --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 88 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8509763 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +name: Lint + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.x" + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 2b8f8aa..355a35f 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: hynek/build-and-inspect-python-package@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa5ed35..e657890 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,22 +1,25 @@ name: Tests -on: - push: - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 jobs: build_doc: name: Build CPython docs runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - branch: [origin/main, 3.12, 3.11, '3.10', 3.9, 3.8] + branch: ["origin/main", "3.12", "3.11", "3.10", "3.9", "3.8"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3 + allow-prereleases: true + cache: pip - name: Clone docsbuild scripts run: | git clone https://github.com/python/docsbuild-scripts/ @@ -26,15 +29,15 @@ jobs: python -m pip install -r docsbuild-scripts/requirements.txt - name: Build documentation run: > - python ./docsbuild-scripts/build_docs.py - --quick - --build-root ./build_root - --www-root ./www - --log-directory ./logs - --group $(id -g) - --skip-cache-invalidation - --theme $(pwd) - --language en + python ./docsbuild-scripts/build_docs.py + --quick + --build-root ./build_root + --www-root ./www + --log-directory ./logs + --group $(id -g) + --skip-cache-invalidation + --theme $(pwd) + --language en --branch ${{ matrix.branch }} - name: Upload uses: actions/upload-artifact@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..008784c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py38-plus] + + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.9.1 + hooks: + - id: black + + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + args: [--add-import=from __future__ import annotations] + + - repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + additional_dependencies: + [flake8-2020, flake8-implicit-str-concat, flake8-logging] + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: python-check-blanket-noqa + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-json + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.14 + hooks: + - id: validate-pyproject + +ci: + autoupdate_schedule: quarterly diff --git a/README.rst b/README.rst index 3f2e844..0a8db3f 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ projects if you so choose, but please keep in mind that in doing so you're also choosing to accept some of the responsibility for maintaining that collective trust. -To use the theme, install it into your docs build environment via ``pip`` +To use the theme, install it into your docs build environment via ``pip`` (preferably in a virtual environment). diff --git a/code_of_conduct.rst b/code_of_conduct.rst index 28de97c..4bc6630 100644 --- a/code_of_conduct.rst +++ b/code_of_conduct.rst @@ -11,4 +11,3 @@ which includes all infrastructure used in the development of Python itself In general this means everyone is expected to be open, considerate, and respectful of others no matter what their position is within the project. - diff --git a/pyproject.toml b/pyproject.toml index 149c548..014cb94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,43 +1,38 @@ [build-system] -requires = ["flit_core>=3.7"] build-backend = "flit_core.buildapi" +requires = [ + "flit_core>=3.7", +] -# project metadata [project] name = "python-docs-theme" version = "2023.9" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" -urls.Code = "https://github.com/python/python-docs-theme" -urls.Download = "https://pypi.org/project/python-docs-theme/" -urls.Homepage = "https://github.com/python/python-docs-theme/" -urls."Issue tracker" = "https://github.com/python/python-docs-theme/issues" license.file = "LICENSE" +authors = [{name = "PyPA", email = "distutils-sig@python.org"}] requires-python = ">=3.8" - -# Classifiers list: https://pypi.org/classifiers/ classifiers = [ - "Development Status :: 5 - Production/Stable", - "Framework :: Sphinx :: Theme", - "Intended Audience :: Developers", - "License :: OSI Approved :: Python Software Foundation License", - "Operating System :: OS Independent", - "Topic :: Documentation", - "Topic :: Software Development :: Documentation", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", + "Development Status :: 5 - Production/Stable", + "Framework :: Sphinx :: Theme", + "Intended Audience :: Developers", + "License :: OSI Approved :: Python Software Foundation License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", ] - -[[project.authors]] -name = "PyPA" -email = "distutils-sig@python.org" - +urls.Code = "https://github.com/python/python-docs-theme" +urls.Download = "https://pypi.org/project/python-docs-theme/" +urls.Homepage = "https://github.com/python/python-docs-theme/" +urls."Issue tracker" = "https://github.com/python/python-docs-theme/issues" [project.entry-points."sphinx.html_themes"] python_docs_theme = 'python_docs_theme' diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 0857b5f..7747675 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -1,8 +1,10 @@ +from __future__ import annotations + import hashlib import os from functools import lru_cache from pathlib import Path -from typing import Any, Dict, List +from typing import Any import sphinx.application from sphinx.builders.html import StandaloneHTMLBuilder @@ -19,7 +21,7 @@ def _asset_hash(path: str) -> str: return f"{path}?digest={digest}" -def _add_asset_hashes(static: List[str], add_digest_to: List[str]) -> None: +def _add_asset_hashes(static: list[str], add_digest_to: list[str]) -> None: for asset in add_digest_to: index = static.index(asset) static[index].filename = _asset_hash(asset) # type: ignore @@ -29,7 +31,7 @@ def _html_page_context( app: sphinx.application.Sphinx, pagename: str, templatename: str, - context: Dict[str, Any], + context: dict[str, Any], doctree: Any, ) -> None: if app.config.html_theme != "python_docs_theme": diff --git a/python_docs_theme/static/menu.js b/python_docs_theme/static/menu.js index e233585..c7ab03e 100644 --- a/python_docs_theme/static/menu.js +++ b/python_docs_theme/static/menu.js @@ -54,4 +54,4 @@ document.addEventListener("DOMContentLoaded", function () { closeMenu() } }) -}) \ No newline at end of file +}) From cc74a749c068441edb13ad2d4443570e4f5e5386 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 18 Oct 2023 21:58:41 +0300 Subject: [PATCH 025/120] Underline links for readability and a11y --- python_docs_theme/static/pydoctheme.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index ce032f1..664445e 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -29,6 +29,10 @@ pre { color: inherit; } +a { + text-decoration: underline; +} + body { margin-left: 1em; margin-right: 1em; From 071911ed9a375d993a780951d8c6957abf56f96e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 4 Nov 2023 20:35:12 +0200 Subject: [PATCH 026/120] Redunce underline thickness, move underline down, increase line height --- python_docs_theme/static/pydoctheme.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 664445e..cb8d2d9 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -30,7 +30,8 @@ pre { } a { - text-decoration: underline; + text-decoration: underline 1px; + text-underline-offset: 0.3em; } body { @@ -181,7 +182,7 @@ div.body { div.body p, div.body dd, div.body li, div.body blockquote { text-align: left; - line-height: 1.4; + line-height: 1.6; } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { margin: 0; From a5ca1f52f5b9ae6d18a80b91dac7e74d288171f6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 5 Nov 2023 23:03:52 +0200 Subject: [PATCH 027/120] Only underline actual links rather than placeholder links Co-authored-by: Pradyun Gedam --- python_docs_theme/static/pydoctheme.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index cb8d2d9..a69cd17 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -29,7 +29,7 @@ pre { color: inherit; } -a { +a[href] { text-decoration: underline 1px; text-underline-offset: 0.3em; } From 901c74796ba01192e264335b8559f0feeb9cc6eb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Dec 2023 12:41:10 +0200 Subject: [PATCH 028/120] Dark mode: fix contrast of footer highlight --- python_docs_theme/static/pydoctheme_dark.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python_docs_theme/static/pydoctheme_dark.css b/python_docs_theme/static/pydoctheme_dark.css index 46a2c7a..758d3de 100644 --- a/python_docs_theme/static/pydoctheme_dark.css +++ b/python_docs_theme/static/pydoctheme_dark.css @@ -60,6 +60,10 @@ span.highlighted { background-color: #616161; } +.footnote:target { + background-color: #2c3e50; +} + /* Below for most things in text */ dl.field-list > dt { From 45793b571499bb383e2da53737b5855b64736241 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 10 Jan 2024 10:00:21 +0200 Subject: [PATCH 029/120] Show logs on error (#164) --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e657890..9407ac7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,10 @@ jobs: --theme $(pwd) --language en --branch ${{ matrix.branch }} + - name: Show logs + if: failure() + run: | + cat ./logs/docsbuild.log - name: Upload uses: actions/upload-artifact@v3 with: From beb868fc38ae5d7b8ea511b4c75760fbb2ea6d12 Mon Sep 17 00:00:00 2001 From: Marko Budisic Date: Fri, 12 Jan 2024 12:44:50 -0500 Subject: [PATCH 030/120] Consistently reference `theme_root_icon` (#163) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Ezio Melotti Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- python_docs_theme/layout.html | 8 ++++---- python_docs_theme/theme.conf | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index 82b7ef4..81433e0 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -14,7 +14,7 @@

{{ _('Navigation') }}

{%- endfor %} {%- block rootrellink %} -
  • python logo
  • +
  • {{ theme_root_icon_alt_text }}
  • {{theme_root_name}}{{ reldelim1 }}
  • @@ -71,7 +71,7 @@

    {{ _('Navigation') }}

    {%- block extrahead -%} - + {%- if builder != "htmlhelp" %} {%- if not embedded %} @@ -100,7 +100,7 @@

    {{ _('Navigation') }}

    {%- if pagename != "search" and builder != "singlehtml" %} @@ -121,7 +121,7 @@

    {{ _('Navigation') }}

    {%- if logo %} {%- endif %} diff --git a/python_docs_theme/theme.conf b/python_docs_theme/theme.conf index 564c9c5..e6008d9 100644 --- a/python_docs_theme/theme.conf +++ b/python_docs_theme/theme.conf @@ -31,5 +31,6 @@ license_url = root_name = Python root_url = https://www.python.org/ root_icon = py.svg +root_icon_alt_text = Python logo root_include_title = True copyright_url = From 375517fec87a4c1283216c423771dd6c469dd9af Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:38:21 +0200 Subject: [PATCH 031/120] Add hosted_on variable for a link in the footer --- python_docs_theme/layout.html | 3 +++ python_docs_theme/theme.conf | 1 + 2 files changed, 4 insertions(+) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index 81433e0..c0d81dc 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -143,6 +143,9 @@

    {{ _('Navigation') }}

    {% trans %}Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.{% endtrans %}
    {% if theme_license_url %}{% trans license_file=theme_license_url %}See History and License for more information.{% endtrans %}
    {% endif %} + {% if theme_hosted_on %} + {% trans hosted_on=theme_hosted_on %}Hosted on {{ hosted_on }}.{% endtrans %}
    + {% endif %}
    {% include "footerdonate.html" %} diff --git a/python_docs_theme/theme.conf b/python_docs_theme/theme.conf index e6008d9..1fbcabc 100644 --- a/python_docs_theme/theme.conf +++ b/python_docs_theme/theme.conf @@ -26,6 +26,7 @@ headlinkcolor = #aaaaaa codebgcolor = #eeffcc codetextcolor = #333333 +hosted_on = issues_url = license_url = root_name = Python From 1dc112bc9a4861b4bfae6d25b34b3798c2363d2c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:08:30 +0200 Subject: [PATCH 032/120] Single line --- python_docs_theme/layout.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index c0d81dc..d387ef3 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -143,9 +143,7 @@

    {{ _('Navigation') }}

    {% trans %}Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.{% endtrans %}
    {% if theme_license_url %}{% trans license_file=theme_license_url %}See History and License for more information.{% endtrans %}
    {% endif %} - {% if theme_hosted_on %} - {% trans hosted_on=theme_hosted_on %}Hosted on {{ hosted_on }}.{% endtrans %}
    - {% endif %} + {% if theme_hosted_on %}{% trans hosted_on=theme_hosted_on %}Hosted on {{ hosted_on }}.{% endtrans %}
    {% endif %}
    {% include "footerdonate.html" %} From 62b314f2ee9b03997ca8bcd306e45c0818549f0c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:49:51 +0200 Subject: [PATCH 033/120] Reduce underline offset --- python_docs_theme/static/pydoctheme.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index a69cd17..962b63f 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -31,7 +31,7 @@ pre { a[href] { text-decoration: underline 1px; - text-underline-offset: 0.3em; + text-underline-offset: 0.2em; } body { From cf5b9e630dfee9f47cf0651e77292c3f65bf7b12 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 27 Jan 2024 18:46:37 +0200 Subject: [PATCH 034/120] Increase underline offset a bit more --- python_docs_theme/static/pydoctheme.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 962b63f..14464db 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -31,7 +31,7 @@ pre { a[href] { text-decoration: underline 1px; - text-underline-offset: 0.2em; + text-underline-offset: 0.25em; } body { From 4f8095d6e6267591ff585d25a38d5d92602eb306 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 27 Jan 2024 21:26:16 +0200 Subject: [PATCH 035/120] Prepare 2024.1 release --- CHANGELOG.rst | 12 ++++++++++++ pyproject.toml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ed7ca86..f44760d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,18 @@ Changelog ========= +`2024.1 `_ +---------------------------------------------------------------------------- + +- Underline links for readability and a11y (#160, #166) + Contributed by Hugo van Kemenade +- Add ``hosted_on`` variable for a link in the footer (#165) + Contributed by Hugo van Kemenade +- Consistently reference ``theme_root_icon`` (#163) + Contributed by Marko Budiselic +- Dark mode: fix contrast of footer highlight (#162) + Contributed by Hugo van Kemenade + `2023.9 `_ ---------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 014cb94..ce22aed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ [project] name = "python-docs-theme" -version = "2023.9" +version = "2024.1" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" license.file = "LICENSE" From 2c2072371ab944db5987a986094ddb0cdd8767fd Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:07:10 +0200 Subject: [PATCH 036/120] Do not underline navigation links --- python_docs_theme/static/pydoctheme.css | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 14464db..c5e44fc 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -33,6 +33,30 @@ a[href] { text-decoration: underline 1px; text-underline-offset: 0.25em; } +/* No underline for navigation */ +div.genindex-jumpbox a, +div.modindex-jumpbox a, +div#search-results a, +div.sphinxsidebar a, +div.toctree-wrapper a, +div[role=navigation] a, +table.contentstable a, +table.indextable a { + text-decoration: none; +} + +/* Except when hovered */ +div.genindex-jumpbox a:hover, +div.modindex-jumpbox a:hover, +div#search-results a:hover, +div.sphinxsidebar a:hover, +div.toctree-wrapper a:hover, +div[role=navigation] a:hover, +table.contentstable a:hover, +table.indextable a:hover { + text-decoration: underline; + text-underline-offset: auto; +} body { margin-left: 1em; @@ -284,6 +308,10 @@ div.footer { margin-right: 10px; } +div.footer a { + text-underline-offset: auto; +} + div.footer a:hover { color: #0095c4; } From 761de4d6feefa832cd3fdc57df3292464a1e9f29 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:28:26 +0200 Subject: [PATCH 037/120] Update pre-commit --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 008784c..d429bb3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,18 +6,18 @@ repos: args: [--py38-plus] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 + rev: 24.1.1 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: [--add-import=from __future__ import annotations] - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 additional_dependencies: @@ -42,7 +42,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.14 + rev: v0.16 hooks: - id: validate-pyproject From 3e0f891d026e36414049192084a127e827ed0900 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:28:48 +0200 Subject: [PATCH 038/120] Newlines for clarity --- .github/workflows/pypi-package.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 355a35f..bd704b5 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -27,7 +27,9 @@ jobs: name: Publish to PyPI environment: release-pypi # Only run for published releases. - if: github.repository_owner == 'python' && github.event.action == 'published' + if: | + github.repository_owner == 'python' + && github.event.action == 'published' runs-on: ubuntu-latest needs: build-package From ed0650e30ad25239334006343ef044384063b0a1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:29:21 +0200 Subject: [PATCH 039/120] Specify isort profile for compatibility with Black --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index ce22aed..6009f19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,9 @@ urls."Issue tracker" = "https://github.com/python/python-docs-theme/issues" [project.entry-points."sphinx.html_themes"] python_docs_theme = 'python_docs_theme' +[tool.isort] +profile = "black" + [tool.flit.module] name = "python_docs_theme" From 2b24269dfe4cad0f1ccafa2a6fd590a265622457 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:32:23 +0200 Subject: [PATCH 040/120] Add Dependabot to keep GitHub Actions up-to-date --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5c56314 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: monthly + groups: + actions: + patterns: + - "*" From 82c7468ec3fbd883c5ff7decec348728912cae65 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:44:46 +0200 Subject: [PATCH 041/120] Add handy pre-commit checks --- .pre-commit-config.yaml | 14 +++++++++++--- pyproject.toml | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d429bb3..70b4e19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,6 @@ repos: rev: 5.13.2 hooks: - id: isort - args: [--add-import=from __future__ import annotations] - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 @@ -32,19 +31,28 @@ repos: rev: v4.5.0 hooks: - id: check-case-conflict - - id: check-executables-have-shebangs - id: check-merge-conflict - - id: check-json - id: check-toml - id: check-yaml - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 1.7.0 + hooks: + - id: pyproject-fmt + args: [--max-supported-python=3.13] + - repo: https://github.com/abravalheri/validate-pyproject rev: v0.16 hooks: - id: validate-pyproject + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + ci: autoupdate_schedule: quarterly diff --git a/pyproject.toml b/pyproject.toml index 6009f19..272d26c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,6 @@ urls."Issue tracker" = "https://github.com/python/python-docs-theme/issues" [project.entry-points."sphinx.html_themes"] python_docs_theme = 'python_docs_theme' -[tool.isort] -profile = "black" - [tool.flit.module] name = "python_docs_theme" @@ -46,3 +43,7 @@ name = "python_docs_theme" include = [ "python_docs_theme/", ] + +[tool.isort] +add_imports = "from __future__ import annotations" +profile = "black" From 78fcd4b989aa5cb34190997fe1540d5852681076 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:03:26 +0200 Subject: [PATCH 042/120] Add link to PR of docs preview --- .github/workflows/documentation-links.yml | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/documentation-links.yml diff --git a/.github/workflows/documentation-links.yml b/.github/workflows/documentation-links.yml new file mode 100644 index 0000000..f05df37 --- /dev/null +++ b/.github/workflows/documentation-links.yml @@ -0,0 +1,27 @@ +name: Read the Docs PR preview +# Automatically edits a pull request's descriptions with a link +# to the documentation's preview on Read the Docs. + +on: + pull_request_target: + types: + - opened + paths: + - 'Doc/**' + - '.github/workflows/doc.yml' + +permissions: + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "python-docs-theme-previews" + single-version: "true" From 2f38e86cea78c9b31372d0c291119deae5044c6f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 3 Feb 2024 23:26:28 +0200 Subject: [PATCH 043/120] Only apply underline offset to code formatting for underline visibility --- python_docs_theme/static/pydoctheme.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 14464db..dff8ee8 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -31,7 +31,10 @@ pre { a[href] { text-decoration: underline 1px; + +a[href]:has(> code) { text-underline-offset: 0.25em; + color: red; } body { From 98b94c5e56aa86ef887730263993297ead57f7a9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 3 Feb 2024 23:32:33 +0200 Subject: [PATCH 044/120] Remove debugging --- python_docs_theme/static/pydoctheme.css | 1 - 1 file changed, 1 deletion(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index dff8ee8..d404934 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -34,7 +34,6 @@ a[href] { a[href]:has(> code) { text-underline-offset: 0.25em; - color: red; } body { From bd00c3da51f6a00697eefbedf8cf9cd465722561 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 3 Feb 2024 23:35:39 +0200 Subject: [PATCH 045/120] =?UTF-8?q?Don't=20underline=20the=20pilcrow=20(?= =?UTF-8?q?=C2=B6)=20navigation=20symbol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_docs_theme/static/pydoctheme.css | 1 + 1 file changed, 1 insertion(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index c5e44fc..54c1616 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -34,6 +34,7 @@ a[href] { text-underline-offset: 0.25em; } /* No underline for navigation */ +a.headerlink, div.genindex-jumpbox a, div.modindex-jumpbox a, div#search-results a, From 2dd4e77cbcf5d2f46f723a81c3938e2de22a08e2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 3 Feb 2024 23:46:30 +0200 Subject: [PATCH 046/120] Add missing bracket --- python_docs_theme/static/pydoctheme.css | 1 + 1 file changed, 1 insertion(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index d404934..263f3f6 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -31,6 +31,7 @@ pre { a[href] { text-decoration: underline 1px; +} a[href]:has(> code) { text-underline-offset: 0.25em; From 14335e475448e2ec561fe650cb3c48088c91c831 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Feb 2024 09:16:30 -0700 Subject: [PATCH 047/120] Update .github/dependabot.yml Co-authored-by: Ezio Melotti --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c56314..8452ef0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,8 @@ updates: directory: "/" schedule: interval: monthly + assignees: + - "ezio-melotti" groups: actions: patterns: From 2f3f86ec603341cce76616ed2f83c8a9ee0a4b4e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Feb 2024 19:20:50 +0200 Subject: [PATCH 048/120] Add comments --- python_docs_theme/static/pydoctheme.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 8112fa4..959a94e 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -29,10 +29,12 @@ pre { color: inherit; } +/* Add underlines to links */ a[href] { text-decoration: underline 1px; } +/* Increase the underline offset for code to avoid obscuring underscores */ a[href]:has(> code) { text-underline-offset: 0.25em; } From fbf2bf896c464dcb192735f8e5d1222d5dcdc1eb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Feb 2024 19:22:35 +0200 Subject: [PATCH 049/120] Whitespace between CSS blocks --- python_docs_theme/static/pydoctheme.css | 1 + 1 file changed, 1 insertion(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 959a94e..87a0629 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -38,6 +38,7 @@ a[href] { a[href]:has(> code) { text-underline-offset: 0.25em; } + /* No underline for navigation */ a.headerlink, div.genindex-jumpbox a, From cc1161b2bbc3d7f11e14c1eda31963cc904cbd30 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Feb 2024 12:56:06 -0700 Subject: [PATCH 050/120] README: Add link to preview build --- README.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0a8db3f..5055bad 100644 --- a/README.rst +++ b/README.rst @@ -21,4 +21,11 @@ To use this theme, add the following to ``conf.py``: - ``html_theme = 'python_docs_theme'`` -- ``html_sidebars``, defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars +- ``html_sidebars``, defaults taken from https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars + +Preview +------- + +See a demo of the CPython docs using this theme: + +- https://python-docs-theme-previews.readthedocs.io From b3d1ae14eb0c7223b3430d42c8a085aeece3f744 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:50:50 +0200 Subject: [PATCH 051/120] Prepare 2024.2 release --- CHANGELOG.rst | 17 ++++++++++++----- pyproject.toml | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f44760d..0b02c3f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,18 +1,25 @@ -========= Changelog ========= +`2024.2 `_ +---------------------------------------------------------------------------- + +- Do not underline navigation links (#169) + Contributed by Hugo van Kemenade +- Only apply underline offset to code formatting for underline visibility (#171) + Contributed by Hugo van Kemenade + `2024.1 `_ ---------------------------------------------------------------------------- - Underline links for readability and a11y (#160, #166) - Contributed by Hugo van Kemenade + Contributed by Hugo van Kemenade - Add ``hosted_on`` variable for a link in the footer (#165) - Contributed by Hugo van Kemenade + Contributed by Hugo van Kemenade - Consistently reference ``theme_root_icon`` (#163) - Contributed by Marko Budiselic + Contributed by Marko Budiselic - Dark mode: fix contrast of footer highlight (#162) - Contributed by Hugo van Kemenade + Contributed by Hugo van Kemenade `2023.9 `_ ---------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index ce22aed..dd228f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ [project] name = "python-docs-theme" -version = "2024.1" +version = "2024.2" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" license.file = "LICENSE" From 35e9780170330819243e43b3d88f9715a4e1801a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:39:58 +0000 Subject: [PATCH 052/120] Bump the actions group with 5 updates Bumps the actions group with 5 updates: | Package | From | To | | --- | --- | --- | | [actions/setup-python](https://github.com/actions/setup-python) | `4` | `5` | | [pre-commit/action](https://github.com/pre-commit/action) | `3.0.0` | `3.0.1` | | [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) | `1` | `2` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `3` | `4` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3` | `4` | Updates `actions/setup-python` from 4 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) Updates `pre-commit/action` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/pre-commit/action/releases) - [Commits](https://github.com/pre-commit/action/compare/v3.0.0...v3.0.1) Updates `hynek/build-and-inspect-python-package` from 1 to 2 - [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases) - [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md) - [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v1...v2) Updates `actions/download-artifact` from 3 to 4 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) Updates `actions/upload-artifact` from 3 to 4 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pre-commit/action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: hynek/build-and-inspect-python-package dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/lint.yml | 4 ++-- .github/workflows/pypi-package.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8509763..88c0c7c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index bd704b5..c7acc05 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: hynek/build-and-inspect-python-package@v1 + - uses: hynek/build-and-inspect-python-package@v2 # Upload to real PyPI on GitHub Releases. release-pypi: @@ -38,7 +38,7 @@ jobs: steps: - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: Packages path: dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9407ac7..df0dc48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: branch: ["origin/main", "3.12", "3.11", "3.10", "3.9", "3.8"] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3 allow-prereleases: true @@ -44,7 +44,7 @@ jobs: run: | cat ./logs/docsbuild.log - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: doc-html path: www/ From 40e175bb1fc9b1c8df915a4d129c6473e5551498 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:52:44 +0200 Subject: [PATCH 053/120] Include name in artifact name to work with actions/upload-artifact@v4 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df0dc48..2187fb1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,5 +46,5 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: doc-html + name: doc-html-${{ matrix.branch }} path: www/ From 21ff0a2a3d3beb3de0f9caeded87ea27a128c3df Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 6 Nov 2023 15:09:14 +0200 Subject: [PATCH 054/120] Use system font stack --- python_docs_theme/static/pydoctheme.css | 6 +++--- python_docs_theme/theme.conf | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 87a0629..36a6ed9 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -170,7 +170,7 @@ div.sphinxsidebar a:hover { form.inline-search input, div.sphinxsidebar input, div.related input { - font-family: 'Lucida Grande', Arial, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif; border: 1px solid #999999; font-size: smaller; border-radius: 3px; @@ -258,7 +258,7 @@ div.body a:hover { } tt, code, pre { - font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Liberation Mono", Menlo, Monaco, Consolas, monospace; + font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; font-size: 96.5%; } @@ -362,7 +362,7 @@ div.genindex-jumpbox a { top: 0; right: 0; text-size: 75%; - font-family: monospace; + font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; padding-left: 0.2em; padding-right: 0.2em; border-radius: 0 3px 0 0; diff --git a/python_docs_theme/theme.conf b/python_docs_theme/theme.conf index 1fbcabc..5edf397 100644 --- a/python_docs_theme/theme.conf +++ b/python_docs_theme/theme.conf @@ -5,8 +5,8 @@ pygments_style = default pygments_dark_style = monokai [options] -bodyfont = 'Lucida Grande', Arial, sans-serif -headfont = 'Lucida Grande', Arial, sans-serif +bodyfont = -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif +headfont = -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif footerbgcolor = white footertextcolor = #555555 relbarbgcolor = white From 6f35188e577d26e1a4e937e2dbc28c19eba36065 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 16 Mar 2024 11:49:00 +0200 Subject: [PATCH 055/120] Don't test theme on 3.8 and 3.9 branches --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2187fb1..1b58d3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - branch: ["origin/main", "3.12", "3.11", "3.10", "3.9", "3.8"] + branch: ["origin/main", "3.12", "3.11", "3.10"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 From 10918c3463dad7fab22d3ad6237166e7d53aa973 Mon Sep 17 00:00:00 2001 From: Kerim Kabirov Date: Sun, 17 Mar 2024 19:39:19 +0100 Subject: [PATCH 056/120] Remove incorrect CSS property --- python_docs_theme/static/pydoctheme.css | 1 - 1 file changed, 1 deletion(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 36a6ed9..39c4e33 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -361,7 +361,6 @@ div.genindex-jumpbox a { position: absolute; top: 0; right: 0; - text-size: 75%; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; padding-left: 0.2em; padding-right: 0.2em; From d9136c620f90fbbb990d50c4ac8ad122fb54b2c8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:27:07 +0200 Subject: [PATCH 057/120] Prepare 2024.3 release --- CHANGELOG.rst | 10 +++++++++- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0b02c3f..07f7d4c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +`2024.3 `_ +---------------------------------------------------------------------------- + +- Modernise font: use system font stack to improve text readability and webpage performance (#174) + Contributed by Hugo van Kemenade +- Remove incorrect CSS property (#178) + Contributed by Kerim Kabirov + `2024.2 `_ ---------------------------------------------------------------------------- @@ -40,7 +48,7 @@ Changelog `2023.7 `_ ---------------------------------------------------------------------------- -- Fix compatability with Sphinx 7.1 (#137) +- Fix compatibility with Sphinx 7.1 (#137) Contributed by Pradyun Gedam - Enable the slash keypress to focus the search field (#141) Contributed by Mike Fiedler diff --git a/pyproject.toml b/pyproject.toml index 8fd838f..fc5f551 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ [project] name = "python-docs-theme" -version = "2024.2" +version = "2024.3" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.rst" license.file = "LICENSE" From 95134919673c13112574ac50c1bc96ad1e6f2b33 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 22 Mar 2024 13:40:05 +0200 Subject: [PATCH 058/120] Exclude bots from generated release notes --- .github/release.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d1e098 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - pre-commit-ci From fe6a24363611175387dab379b6125d9190ffd7d4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:43:38 +0200 Subject: [PATCH 059/120] Only show 'Last updated on ...' when last_updated defined --- python_docs_theme/layout.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index d387ef3..a661961 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -149,7 +149,9 @@

    {{ _('Navigation') }}

    {% include "footerdonate.html" %}
    - {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} + {%- if last_updated %} + {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} + {%- endif %} {% if theme_issues_url %}{% trans %}Found a bug?{% endtrans %}{% endif %}
    From 5c6c0b4856b6c344591c6cb97a004e5db68f0b01 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:51:05 +0200 Subject: [PATCH 060/120] Add newlines to make if blocks clear --- python_docs_theme/layout.html | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index a661961..9762b06 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -136,14 +136,24 @@

    {{ _('Navigation') }}

    {% block footer %}
  • {%- endfor %} {%- block rootrellink %} -
  • {{ theme_root_icon_alt_text }}
  • +
  • {{ theme_root_icon_alt_text }}
  • {{theme_root_name}}{{ reldelim1 }}
  • @@ -48,8 +48,8 @@

    {{ _('Navigation') }}

    {%- if builder != "htmlhelp" %} {%- endif %} @@ -71,7 +71,7 @@

    {{ _('Navigation') }}

    {%- block extrahead -%} - + {%- if builder != "htmlhelp" %} {%- if not embedded %} @@ -93,14 +93,14 @@

    {{ _('Navigation') }}

    {%- if builder != 'htmlhelp' %}
    + aria-pressed="false" aria-expanded="false" role="button" aria-label="{{ _('Menu')}}">
    From 06987c260d882d92e9aa0513d04b8645c981ae39 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Thu, 10 Apr 2025 21:18:38 +0200 Subject: [PATCH 109/120] Use consistent line-height in code blocks for light & dark theme (#227) --- python_docs_theme/static/pydoctheme.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index da47d3e..40d9cb0 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -328,6 +328,10 @@ tt, code, pre { font-size: 96.5%; } +div.body pre { + line-height: 120%; +} + div.body tt, div.body code { border-radius: 3px; From b8b2d49bed1e933e2eaee24d8822ad0e6a946591 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 11 Apr 2025 15:24:17 +0100 Subject: [PATCH 110/120] Use the correct spelling of the ``--languages`` flag (#228) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 90e4b63..4054cbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: --group "$(id -g)" --skip-cache-invalidation --theme "$(pwd)" - --language en + --languages en --branch ${{ matrix.branch }} - name: Show logs if: failure() From 6ac5c06d13fa22e25f39ebf95642d00b64f7a895 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:33:26 +0300 Subject: [PATCH 111/120] Use --branches for docsbuild-scripts (#232) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4054cbf..875123c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: --skip-cache-invalidation --theme "$(pwd)" --languages en - --branch ${{ matrix.branch }} + --branches ${{ matrix.branch }} - name: Show logs if: failure() run: | From d528dbca5dcaf28f19aa1e2ced645320882f1203 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Fri, 18 Apr 2025 11:46:36 +0200 Subject: [PATCH 112/120] Add a copy button to code samples (#231) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- python_docs_theme/static/copybutton.js | 106 +++++++++---------- python_docs_theme/static/pydoctheme.css | 22 ++-- python_docs_theme/static/pydoctheme_dark.css | 13 +++ 3 files changed, 76 insertions(+), 65 deletions(-) diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index f176ff6..9df468e 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -1,65 +1,59 @@ -// ``function*`` denotes a generator in JavaScript, see -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* -function* getHideableCopyButtonElements(rootElement) { - // yield all elements with the "go" (Generic.Output), - // "gp" (Generic.Prompt), or "gt" (Generic.Traceback) CSS class - for (const el of rootElement.querySelectorAll('.go, .gp, .gt')) { - yield el - } - // tracebacks (.gt) contain bare text elements that need to be - // wrapped in a span to hide or show the element - for (let el of rootElement.querySelectorAll('.gt')) { - while ((el = el.nextSibling) && el.nodeType !== Node.DOCUMENT_NODE) { - // stop wrapping text nodes when we hit the next output or - // prompt element - if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) { - break - } - // if the node is a text node with content, wrap it in a - // span element so that we can control visibility - if (el.nodeType === Node.TEXT_NODE && el.textContent.trim()) { - const wrapper = document.createElement("span") - el.after(wrapper) - wrapper.appendChild(el) - el = wrapper - } - yield el +// Extract copyable text from the code block ignoring the +// prompts and output. +function getCopyableText(rootElement) { + rootElement = rootElement.cloneNode(true) + // tracebacks (.gt) contain bare text elements that + // need to be removed + const tracebacks = rootElement.querySelectorAll(".gt") + for (const el of tracebacks) { + while ( + el.nextSibling && + (el.nextSibling.nodeType !== Node.DOCUMENT_NODE || + !el.nextSibling.matches(".gp, .go")) + ) { + el.nextSibling.remove() } } + // Remove all elements with the "go" (Generic.Output), + // "gp" (Generic.Prompt), or "gt" (Generic.Traceback) CSS class + const elements = rootElement.querySelectorAll(".gp, .go, .gt") + for (const el of elements) { + el.remove() + } + return rootElement.innerText.trim() } - const loadCopyButton = () => { - /* Add a [>>>] button in the top-right corner of code samples to hide - * the >>> and ... prompts and the output and thus make the code - * copyable. */ - const hide_text = _("Hide the prompts and output") - const show_text = _("Show the prompts and output") - - const button = document.createElement("span") + const button = document.createElement("button") button.classList.add("copybutton") - button.innerText = ">>>" - button.title = hide_text - button.dataset.hidden = "false" - const buttonClick = event => { + button.type = "button" + button.innerText = _("Copy") + button.title = _("Copy to clipboard") + + const makeOnButtonClick = () => { + let timeout = null // define the behavior of the button when it's clicked - event.preventDefault() - const buttonEl = event.currentTarget - const codeEl = buttonEl.nextElementSibling - if (buttonEl.dataset.hidden === "false") { - // hide the code output - for (const el of getHideableCopyButtonElements(codeEl)) { - el.hidden = true + return async event => { + // check if the clipboard is available + if (!navigator.clipboard || !navigator.clipboard.writeText) { + return; } - buttonEl.title = show_text - buttonEl.dataset.hidden = "true" - } else { - // show the code output - for (const el of getHideableCopyButtonElements(codeEl)) { - el.hidden = false + + clearTimeout(timeout) + const buttonEl = event.currentTarget + const codeEl = buttonEl.nextElementSibling + + try { + await navigator.clipboard.writeText(getCopyableText(codeEl)) + } catch (e) { + console.error(e.message) + return } - buttonEl.title = hide_text - buttonEl.dataset.hidden = "false" + + buttonEl.innerText = _("Copied!") + timeout = setTimeout(() => { + buttonEl.innerText = _("Copy") + }, 1500) } } @@ -78,10 +72,8 @@ const loadCopyButton = () => { // if we find a console prompt (.gp), prepend the (deeply cloned) button const clonedButton = button.cloneNode(true) // the onclick attribute is not cloned, set it on the new element - clonedButton.onclick = buttonClick - if (el.querySelector(".gp") !== null) { - el.prepend(clonedButton) - } + clonedButton.onclick = makeOnButtonClick() + el.prepend(clonedButton) }) } diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 40d9cb0..6d50092 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -442,17 +442,23 @@ div.genindex-jumpbox a { top: 0; right: 0; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; - padding-left: 0.2em; - padding-right: 0.2em; + font-size: 80%; + padding-left: .5em; + padding-right: .5em; + height: 100%; + max-height: min(100%, 2.4em); border-radius: 0 3px 0 0; - color: #ac9; /* follows div.body pre */ - border-color: #ac9; /* follows div.body pre */ - border-style: solid; /* follows div.body pre */ - border-width: 1px; /* follows div.body pre */ + color: #000; + background-color: #fff; + border: 1px solid #ac9; /* follows div.body pre */ +} + +.copybutton:hover { + background-color: #eee; } -.copybutton[data-hidden='true'] { - text-decoration: line-through; +.copybutton:active { + background-color: #ddd; } @media (max-width: 1023px) { diff --git a/python_docs_theme/static/pydoctheme_dark.css b/python_docs_theme/static/pydoctheme_dark.css index 4509960..582e4dd 100644 --- a/python_docs_theme/static/pydoctheme_dark.css +++ b/python_docs_theme/static/pydoctheme_dark.css @@ -176,3 +176,16 @@ img.invert-in-dark-mode { --versionchanged: var(--middle-color); --deprecated: var(--bad-color); } + +.copybutton { + color: #ac9; /* follows div.body pre */ + background-color: #222222; /* follows body */ +} + +.copybutton:hover { + background-color: #434343; +} + +.copybutton:active { + background-color: #656565; +} From 5b795101f57a47ac8113bd08294f3b7e176f3ff9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Apr 2025 01:10:06 +0300 Subject: [PATCH 113/120] Drop support for Python 3.10 and 3.11 (#234) --- .github/workflows/tests.yml | 4 ++-- babel_runner.py | 11 +---------- pyproject.toml | 4 +--- requirements.txt | 2 -- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 875123c..5a8ec72 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - branch: ["origin/main", "3.13", "3.12", "3.11", "3.10"] + branch: ["origin/main", "3.13", "3.12"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -56,7 +56,7 @@ jobs: matrix: os: ["ubuntu-latest", "windows-latest"] # Test minimum supported and latest stable from 3.x series - python-version: ["3.10", "3"] + python-version: ["3.12", "3"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/babel_runner.py b/babel_runner.py index ee5af16..0785ae2 100755 --- a/babel_runner.py +++ b/babel_runner.py @@ -5,18 +5,9 @@ import argparse import ast import subprocess +import tomllib from pathlib import Path -try: - import tomllib -except ImportError: - try: - import tomli as tomllib - except ImportError as ie: - raise ImportError( - "tomli or tomllib is required to parse pyproject.toml" - ) from ie - PROJECT_DIR = Path(__file__).resolve().parent PYPROJECT_TOML = PROJECT_DIR / "pyproject.toml" INIT_PY = PROJECT_DIR / "python_docs_theme" / "__init__.py" diff --git a/pyproject.toml b/pyproject.toml index e03e2be..f312f8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" license.file = "LICENSE" authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] -requires-python = ">=3.10" +requires-python = ">=3.12" classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Theme", @@ -19,8 +19,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Documentation", diff --git a/requirements.txt b/requirements.txt index ad829d4..bb631b5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ # for babel_runner.py -setuptools Babel Jinja2 -tomli; python_version < "3.11" From d0b0a152185d8cfe7ec4af57316808fc9b39eb65 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 26 Apr 2025 12:42:29 +0300 Subject: [PATCH 114/120] Replace deprecated classifier with licence expression (PEP 639) (#237) --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f312f8b..11e66cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,14 +8,14 @@ requires = [ name = "python-docs-theme" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" -license.file = "LICENSE" +license = "PSF-2.0" +license-files = [ "LICENSE" ] authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] requires-python = ">=3.12" classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Theme", "Intended Audience :: Developers", - "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", From 7253ffc89738d2e96deacda61c84cbb66d7eb69b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:05:17 +0300 Subject: [PATCH 115/120] Add support for Python 3.14 (#236) --- .github/workflows/tests.yml | 5 +++-- .pre-commit-config.yaml | 1 - pyproject.toml | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5a8ec72..23e6c7e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,12 +12,12 @@ jobs: strategy: fail-fast: false matrix: - branch: ["origin/main", "3.13", "3.12"] + branch: ["3.14", "3.13", "3.12"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: 3 + python-version: ${{ matrix.branch }} allow-prereleases: true cache: pip - name: Clone docsbuild scripts @@ -39,6 +39,7 @@ jobs: --theme "$(pwd)" --languages en --branches ${{ matrix.branch }} + ${{ matrix.branch == '3.14' && '--select-output no-html' || '' }} - name: Show logs if: failure() run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f964364..9a7e83b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,6 @@ repos: rev: v2.5.0 hooks: - id: pyproject-fmt - args: [--max-supported-python=3.13] - repo: https://github.com/abravalheri/validate-pyproject rev: v0.23 diff --git a/pyproject.toml b/pyproject.toml index 11e66cb..a614351 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Documentation", "Topic :: Software Development :: Documentation", ] @@ -67,3 +68,6 @@ lint.ignore = [ "E241", # Multiple spaces after ',' ] lint.isort.required-imports = [ "from __future__ import annotations" ] + +[tool.pyproject-fmt] +max_supported_python = "3.14" From 4c59313d66516cc8614cad05dc0bf62d44828269 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:09:46 +0300 Subject: [PATCH 116/120] Prepare 2025.4 release (#238) --- CHANGELOG.rst | 11 +++++++++++ README.md | 2 +- python_docs_theme/__init__.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 74b09ca..e50c32b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,17 @@ Changelog ========= +`2025.4 `_ +--------------------------------------------------------------------------- + +* Require Sphinx 7.3 by @AA-Turner in https://github.com/python/python-docs-theme/pull/221 +* Add support for Python 3.14 by @hugovk https://github.com/python/python-docs-theme/pull/236 +* Drop support for Python 3.10 and 3.11 by @hugovk in https://github.com/python/python-docs-theme/pull/234 +* Add a copy button to code samples by @tomasr8 in https://github.com/python/python-docs-theme/pull/231 +* Add missing i18n for copy button titles by @tomasr8 in https://github.com/python/python-docs-theme/pull/225 +* Use consistent line-height for light & dark theme by @tomasr8 in https://github.com/python/python-docs-theme/pull/227 +* Remove self-closing tags by @hugovk in https://github.com/python/python-docs-theme/pull/226 + `2025.2 `_ --------------------------------------------------------------------------- diff --git a/README.md b/README.md index 133daa0..fedd7f7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Python Docs Sphinx Theme This is the theme for the Python documentation. -It requires Python 3.10 or newer and Sphinx 7.3 or newer. +It requires Python 3.12 or newer and Sphinx 7.3 or newer. Note that when adopting this theme, you're also borrowing an element of the trust and credibility established by the CPython core developers over the diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index c5b5fe7..e4d06be 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.2" +__version__ = "2025.4" THEME_PATH = Path(__file__).resolve().parent From 14e4606a2ffcb8bdde6f9b61cb27642ec5482555 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:18:52 +0300 Subject: [PATCH 117/120] Add licence metadata change to changelog (#239) --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e50c32b..ec2ef10 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ Changelog * Add missing i18n for copy button titles by @tomasr8 in https://github.com/python/python-docs-theme/pull/225 * Use consistent line-height for light & dark theme by @tomasr8 in https://github.com/python/python-docs-theme/pull/227 * Remove self-closing tags by @hugovk in https://github.com/python/python-docs-theme/pull/226 +* Replace deprecated classifier with licence expression (PEP 639) by @hugovk in https://github.com/python/python-docs-theme/pull/237 `2025.2 `_ --------------------------------------------------------------------------- From d0eaa5e0aadb43167d1f24c805bf58bbf4811042 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Wed, 30 Apr 2025 14:05:37 +0200 Subject: [PATCH 118/120] Fix copy button with multiple tracebacks (#240) --- python_docs_theme/static/copybutton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index 9df468e..de071f4 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -8,7 +8,7 @@ function getCopyableText(rootElement) { for (const el of tracebacks) { while ( el.nextSibling && - (el.nextSibling.nodeType !== Node.DOCUMENT_NODE || + (el.nextSibling.nodeType !== Node.ELEMENT_NODE || !el.nextSibling.matches(".gp, .go")) ) { el.nextSibling.remove() From 5d0782523024d488e8a1126852f26d118a82b4b3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:14:26 +0300 Subject: [PATCH 119/120] Prepare 2025.4.1 release (#241) --- CHANGELOG.rst | 5 +++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec2ef10..fb43a9f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +`2025.4.1 `_ +------------------------------------------------------------------------------- + +* Fix copy button with multiple tracebacks by @tomasr8 in https://github.com/python/python-docs-theme/pull/240 + `2025.4 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index e4d06be..75459e1 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.4" +__version__ = "2025.4.1" THEME_PATH = Path(__file__).resolve().parent From 42ade08824a02904332cea9b53886ddd2d4740c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Hern=C3=A1ndez?= Date: Fri, 23 May 2025 08:33:50 -0400 Subject: [PATCH 120/120] Make copy button appear when hovered (#243) --- python_docs_theme/static/pydoctheme.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 6d50092..4873116 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -451,6 +451,7 @@ div.genindex-jumpbox a { color: #000; background-color: #fff; border: 1px solid #ac9; /* follows div.body pre */ + display: none; } .copybutton:hover { @@ -461,6 +462,14 @@ div.genindex-jumpbox a { background-color: #ddd; } +.highlight:active .copybutton { + display: block; +} + +.highlight:hover .copybutton { + display: block; +} + @media (max-width: 1023px) { /* Body layout */ div.body {