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/131] 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 f8304917..b4502ba4 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/131] 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 b4179d1f..4042fd5b 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/131] Add Python 3.12 classifier --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b4179d1f..9461479a 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/131] 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 9461479a..949cb254 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/131] 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 949cb254..9be4a241 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/131] 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 00000000..e4826415 --- /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/131] 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 e4826415..6703e195 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/131] 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 6703e195..4b05fe60 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/131] 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 4b05fe60..4f6fd2b0 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/131] 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 4f6fd2b0..926dacde 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/131] 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 49a29e3d..46a2c7aa 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/131] Prepare 2023.8 release --- CHANGELOG.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b275b762..cbf71ce7 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/131] 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 cbf71ce7..5f6181fb 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/131] 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 5f6181fb..ae953096 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/131] Fix whitespace --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ae953096..cbf57d4d 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/131] 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 926dacde..c4913eb8 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/131] 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 c4913eb8..2b8f8aa9 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/131] 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 b4502ba4..82b7ef4c 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 00000000..d6f28266 --- /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/131] 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 d6f28266..aa5b42fd 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/131] 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 c184a9c3..0b2fbd6d 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/131] 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 cbf57d4d..ed7ca865 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 9be4a241..149c548f 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/131] Update release checklist --- CONTRIBUTING.rst | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0b2fbd6d..b0b4fa8a 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/131] Clarify checklist --- CONTRIBUTING.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b0b4fa8a..2533e96a 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/131] 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 00000000..2bcd70e3 --- /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 00000000..85097631 --- /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 2b8f8aa9..355a35fd 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 fa5ed351..e6578909 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 00000000..008784c6 --- /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 3f2e8443..0a8db3fb 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 28de97ce..4bc6630f 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 149c548f..014cb945 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 0857b5fb..77476754 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 e2335857..c7ab03ea 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/131] 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 ce032f12..664445e8 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/131] 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 664445e8..cb8d2d97 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/131] 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 cb8d2d97..a69cd17a 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/131] 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 46a2c7aa..758d3de6 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/131] 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 e6578909..9407ac7e 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/131] 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 82b7ef4c..81433e04 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 564c9c50..e6008d93 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/131] 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 81433e04..c0d81dcd 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 e6008d93..1fbcabc1 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/131] 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 c0d81dcd..d387ef38 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/131] 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 a69cd17a..962b63ff 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/131] 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 962b63ff..14464db4 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/131] 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 ed7ca865..f44760d2 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 014cb945..ce22aed0 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/131] 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 14464db4..c5e44fc6 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/131] 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 008784c6..d429bb3b 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/131] 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 355a35fd..bd704b5f 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/131] Specify isort profile for compatibility with Black --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index ce22aed0..6009f198 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/131] 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 00000000..5c563144 --- /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/131] 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 d429bb3b..70b4e19a 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 6009f198..272d26ce 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/131] 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 00000000..f05df37b --- /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/131] 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 14464db4..dff8ee8a 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/131] 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 dff8ee8a..d4049346 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/131] =?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 c5e44fc6..54c16162 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/131] 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 d4049346..263f3f68 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/131] 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 5c563144..8452ef07 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/131] 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 8112fa4b..959a94e4 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/131] 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 959a94e4..87a06293 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/131] 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 0a8db3fb..5055bad1 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/131] 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 f44760d2..0b02c3f6 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 ce22aed0..dd228f4a 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/131] 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 85097631..88c0c7cb 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 bd704b5f..c7acc055 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 9407ac7e..df0dc488 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/131] 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 df0dc488..2187fb1b 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/131] 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 87a06293..36a6ed90 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 1fbcabc1..5edf397a 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/131] 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 2187fb1b..1b58d3ed 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/131] 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 36a6ed90..39c4e333 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/131] 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 0b02c3f6..07f7d4c7 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 8fd838f3..fc5f5513 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/131] 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 00000000..9d1e0987 --- /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/131] 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 d387ef38..a661961a 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/131] 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 a661961a..9762b06c 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/131] 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 da47d3e7..40d9cb02 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/131] 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 90e4b632..4054cbf2 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/131] 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 4054cbf2..875123c3 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/131] 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 f176ff6b..9df468ee 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 40d9cb02..6d50092f 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 45099605..582e4ddb 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/131] 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 875123c3..5a8ec726 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 ee5af161..0785ae2f 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 e03e2be2..f312f8be 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 ad829d49..bb631b59 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/131] 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 f312f8be..11e66cb8 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/131] 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 5a8ec726..23e6c7e6 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 f9643647..9a7e83b3 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 11e66cb8..a614351d 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/131] 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 74b09cad..e50c32bd 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 133daa0f..fedd7f76 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 c5b5fe79..e4d06bed 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/131] Add licence metadata change to changelog (#239) --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e50c32bd..ec2ef10a 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/131] 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 9df468ee..de071f48 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/131] 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 ec2ef10a..fb43a9f1 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 e4d06bed..75459e1a 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/131] 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 6d50092f..48731163 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 { From 8e361585ca0aeb491353252af2a8fd91c4c55316 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 27 May 2025 16:29:51 +0300 Subject: [PATCH 121/131] Prepare 2025.5 release (#244) --- 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 fb43a9f1..07b2735e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +`2025.5 `_ +--------------------------------------------------------------------------- + +* Make the copy button only appear when hovered over or clicked on by @kevteg in https://github.com/python/python-docs-theme/pull/243 + `2025.4.1 `_ ------------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 75459e1a..2336dc1e 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.1" +__version__ = "2025.5" THEME_PATH = Path(__file__).resolve().parent From 7c4e6c2fdc0c2dba0609016d38137a797e39fa53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:40:33 +0300 Subject: [PATCH 122/131] Bump the actions group with 2 updates (#252) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .github/workflows/pypi-package.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88c0c7cb..795f7b0d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: "3.x" diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 744d49bd..e679e746 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: hynek/build-and-inspect-python-package@v2 @@ -41,7 +41,7 @@ jobs: steps: - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: Packages path: dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 23e6c7e6..83a33884 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: matrix: branch: ["3.14", "3.13", "3.12"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.branch }} @@ -59,7 +59,7 @@ jobs: # Test minimum supported and latest stable from 3.x series python-version: ["3.12", "3"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From 4f43aded34b3509c13b2f203cd5ff1496a7eeaab Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Sun, 7 Sep 2025 18:10:55 +0100 Subject: [PATCH 123/131] Enable theme translation (#246) Co-authored-by: Maciej Olko --- .github/workflows/pypi-package.yml | 7 + .github/workflows/tests.yml | 9 +- babel_runner.py | 33 +++-- python_docs_theme/__init__.py | 11 ++ .../pl/LC_MESSAGES/python-docs-theme.po | 127 ++++++++++++++++++ 5 files changed, 170 insertions(+), 17 deletions(-) create mode 100644 python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index e679e746..bec94a2b 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -22,6 +22,13 @@ jobs: steps: - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 + + - name: Compile translations + run: | + pip install --upgrade pip + pip install -r requirements.txt + python babel_runner.py compile - uses: hynek/build-and-inspect-python-package@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83a33884..60257eef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,7 +71,7 @@ jobs: pip install -r requirements.txt - name: Remove locale file for testing shell: bash - run: rm -rf locales/pt_BR/ + run: rm -rf python_docs_theme/locale/pt_BR/ - run: python babel_runner.py extract - run: python babel_runner.py init -l pt_BR - run: python babel_runner.py update @@ -80,10 +80,7 @@ jobs: - run: python babel_runner.py compile -l pt_BR - name: Print .pot file shell: bash - run: cat locales/messages.pot + run: cat python_docs_theme/locale/python-docs-theme.pot - name: Print .po file shell: bash - run: cat locales/pt_BR/LC_MESSAGES/messages.po - - name: list files in locales dir - shell: bash - run: ls -R locales/ + run: cat python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po diff --git a/babel_runner.py b/babel_runner.py index 0785ae2f..677f6da2 100755 --- a/babel_runner.py +++ b/babel_runner.py @@ -1,5 +1,5 @@ -#!/usr/bin/venv python3 """Script for handling translations with Babel""" + from __future__ import annotations import argparse @@ -8,18 +8,18 @@ import tomllib from pathlib import Path -PROJECT_DIR = Path(__file__).resolve().parent -PYPROJECT_TOML = PROJECT_DIR / "pyproject.toml" -INIT_PY = PROJECT_DIR / "python_docs_theme" / "__init__.py" - # Global variables used by pybabel below (paths relative to PROJECT_DIR) -DOMAIN = "messages" +DOMAIN = "python-docs-theme" COPYRIGHT_HOLDER = "Python Software Foundation" -LOCALES_DIR = "locales" -POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot") SOURCE_DIR = "python_docs_theme" MAPPING_FILE = ".babel.cfg" +PROJECT_DIR = Path(__file__).resolve().parent +PYPROJECT_TOML = Path(PROJECT_DIR, "pyproject.toml") +INIT_PY = PROJECT_DIR / SOURCE_DIR / "__init__.py" +LOCALES_DIR = Path(f"{SOURCE_DIR}", "locale") +POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot") + def get_project_info() -> dict: """Retrieve project's info to populate the message catalog template""" @@ -75,13 +75,24 @@ def init_locale(locale: str) -> None: if pofile.exists(): print(f"There is already a message catalog for locale {locale}, skipping.") return - cmd = ["pybabel", "init", "-i", POT_FILE, "-d", LOCALES_DIR, "-l", locale] + cmd = [ + "pybabel", + "init", + "-i", + POT_FILE, + "-d", + LOCALES_DIR, + "-D", + DOMAIN, + "-l", + locale, + ] subprocess.run(cmd, cwd=PROJECT_DIR, check=True) def update_catalogs(locale: str) -> None: """Update translations from existing message catalogs""" - cmd = ["pybabel", "update", "-i", POT_FILE, "-d", LOCALES_DIR] + cmd = ["pybabel", "update", "-i", POT_FILE, "-d", LOCALES_DIR, "-D", DOMAIN] if locale: cmd.extend(["-l", locale]) subprocess.run(cmd, cwd=PROJECT_DIR, check=True) @@ -89,7 +100,7 @@ def update_catalogs(locale: str) -> None: def compile_catalogs(locale: str) -> None: """Compile existing message catalogs""" - cmd = ["pybabel", "compile", "-d", LOCALES_DIR] + cmd = ["pybabel", "compile", "-d", LOCALES_DIR, "-D", DOMAIN] if locale: cmd.extend(["-l", locale]) subprocess.run(cmd, cwd=PROJECT_DIR, check=True) diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 2336dc1e..6b80ad0a 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -2,6 +2,8 @@ from pathlib import Path +from sphinx.locale import get_translation + TYPE_CHECKING = False if TYPE_CHECKING: from sphinx.application import Sphinx @@ -10,12 +12,21 @@ __version__ = "2025.5" THEME_PATH = Path(__file__).resolve().parent +LOCALE_DIR = THEME_PATH / "locale" +MESSAGE_CATALOG_NAME = "python-docs-theme" def setup(app: Sphinx) -> ExtensionMetadata: app.require_sphinx("7.3") app.add_html_theme("python_docs_theme", str(THEME_PATH)) + app.add_message_catalog(MESSAGE_CATALOG_NAME, LOCALE_DIR) + + def add_translation_to_context(app, pagename, templatename, context, doctree): + _ = get_translation(MESSAGE_CATALOG_NAME) + context["_"] = context["gettext"] = context["ngettext"] = _ + + app.connect("html-page-context", add_translation_to_context) return { "version": __version__, diff --git a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..cb74d912 --- /dev/null +++ b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,127 @@ +# Polish (Poland) translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Stan Ulbrych, 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-08-07 19:09+0200\n" +"PO-Revision-Date: 2025-08-07 15:11+0200\n" +"Last-Translator: Stan Ulbrych \n" +"Language: pl\n" +"Language-Team: pl \n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " +"(n%100<10 || n%100>=20) ? 1 : 2);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation jest organizacją non-profit." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Prosimy o wsparcie." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Nawigacja" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Szybkie wyszukiwanie" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Szukaj" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Motyw" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "jasny" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "ciemny" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menu" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Prawa autorskie" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Ta strona jest objęta licencją Python Software " +"Foundation w wersji 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte " +"licencją Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Zobacz Historię i licencję aby uzyskać " +"więcej informacji." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hostowane na %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Ostatnia aktualizacja %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Znalazłeś(-aś) błąd?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Stworzone za pomocą Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopiuj" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Skopiuj do schowka" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Skopiowano!" From 663d34655eabb6379355b6b442485a8ee4e218cc Mon Sep 17 00:00:00 2001 From: Daniel Nylander Date: Sun, 7 Sep 2025 19:44:50 +0200 Subject: [PATCH 124/131] Adding Swedish translation (#250) --- .../locales/sv_SE/LC_MESSAGES/messages.po | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po diff --git a/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po b/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po new file mode 100644 index 00000000..7bf73ef1 --- /dev/null +++ b/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po @@ -0,0 +1,128 @@ +# Swedish translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Daniel Nylander, 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/" +"issues\n" +"POT-Creation-Date: 2025-08-07 19:09+0200\n" +"PO-Revision-Date: 2025-08-29 07:03+0200\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: sv\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.7\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation är ett icke-vinstdrivande företag." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Donera." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigering" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Snabbsök" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Start" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Ljus" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Mörk" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Meny" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Upphovsrätt" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Denna sida är licensierad enligt Python Software Foundation License " +"version 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Exempel, recept och annan kod i dokumentationen är dessutom " +"licensierade under Zero Clause BSD-licensen." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Se Historik och licens för mer " +"information." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hosting %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Senast uppdaterad %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Har du hittat ett fel?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Skapad med hjälp av Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopiera" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Kopiera till urklipp" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopierad!" From 2518cd7d7bac6c2b888914984c886e0b5f06e056 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Sun, 7 Sep 2025 19:18:58 +0100 Subject: [PATCH 125/131] Pull translations from Transifex (#253) --- .../pt_BR/LC_MESSAGES/python-docs-theme.po | 131 ++++++++++++++++++ .../sv/LC_MESSAGES/python-docs-theme.po} | 0 .../zh_CN/LC_MESSAGES/python-docs-theme.po | 123 ++++++++++++++++ .../zh_TW/LC_MESSAGES/python-docs-theme.po | 123 ++++++++++++++++ 4 files changed, 377 insertions(+) create mode 100644 python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po rename python_docs_theme/{locales/sv_SE/LC_MESSAGES/messages.po => locale/sv/LC_MESSAGES/python-docs-theme.po} (100%) create mode 100644 python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..2ce0936d --- /dev/null +++ b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,131 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Alexsey Batista da Silva, 2025 +# Rafael Fontenelle , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Rafael Fontenelle , 2025\n" +"Language-Team: Portuguese (Brazil) (https://app.transifex.com/python-doc/teams/5390/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "A Python Software Foundation é uma corporação sem fins lucrativos." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Por favor, faça sua doação." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navegação" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Pesquisa rápida" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ir" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Automático" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Claro" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Escuro" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menu" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Direitos autorais" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Esta página está licenciada sob a Licença da Python Software Foundation " +"Versão 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Exemplos, receitas e outros códigos na documentação são licenciados " +"adicionalmente sob a licença BSD Zero Clause." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Consulte Histórico e licença para obter " +"mais informações." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hospedado em %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Última atualização em %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Encontrou um erro?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Criado usando o Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Copiar" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Copiar para a área de transferência" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Copiado!" diff --git a/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po b/python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.po similarity index 100% rename from python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po rename to python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..8fb52a40 --- /dev/null +++ b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,123 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# 汇民 王 , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: 汇民 王 , 2025\n" +"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python 软件基金会是一家非营利性公司。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "请进行捐赠。" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "导航" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "快速搜索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "转到" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "主题" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自动" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "明亮" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "黑暗" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "菜单" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "版权" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "本页面采用 Python 软件基金会许可证第 2 版授权。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "文档中的示例、代码片段及其他代码内容额外采用零条款 BSD 许可证授权。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "更多信息请参阅《 历史与许可 》。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "托管在%(hosted_on)s 上。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最后更新于%(last_updated)s 。" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "发现了错误?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"使用Sphinx %(sphinx_version)s 创建。" + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "复制" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "复制到剪贴板" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "已复制!" diff --git a/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..719074c6 --- /dev/null +++ b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,123 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# W. H. Wang , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: W. H. Wang , 2025\n" +"Language-Team: Chinese (Taiwan) (https://app.transifex.com/python-doc/teams/5390/zh_TW/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python 軟體基金會是一家非營利法人。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "敬請捐贈。" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "導航" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "快速搜索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Go" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "主題" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自動" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "淺色模式" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "深色模式" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "選單" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "版權所有" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "此頁面採用 Python 軟體基金會授權條款第 2 版。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "文件中的範例、應用技巧與其他程式碼額外採用了 Zero Clause BSD 授權條款。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "更多訊息請見歷史與授權條款。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "託管於 %(hosted_on)s。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最後更新於 %(last_updated)s。" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "發現 bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"以 Sphinx%(sphinx_version)s建立。 " + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "複製" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "複製到剪貼板" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "已複製!" From 24457674506a7ad3ceab5cb65b2e89b42a035dc0 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Mon, 8 Sep 2025 10:39:48 +0300 Subject: [PATCH 126/131] Add Greek translation (#256) --- .../el/LC_MESSAGES/python-docs-theme.po | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..c7127f55 --- /dev/null +++ b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,126 @@ +# Greek translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Lysandros Nikolaou , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-08 10:23+0300\n" +"PO-Revision-Date: 2025-09-08 10:23+0300\n" +"Last-Translator: Lysandros Nikolaou \n" +"Language: el\n" +"Language-Team: PyGreece \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Το Python Software Foundation είναι ένας μη κερδοσκοπικός οργανισμός." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Παρακαλώ κάντε μια δωρεά." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Πλοήγηση" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Γρήγορη αναζήτηση" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Πήγαινε" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Θέμα" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Αυτόματα" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Ανοιχτό" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Σκούρο" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Μενού" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Πνευματικά δικαιώματα" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Η σελίδα αυτή διατίθεται υπό την άδεια χρήσης του Python Software " +"Foundation, 2η έκδοση." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Παραδείγματα, οδηγοί και λοιπά κομμάτια κώδικα στην τεκμηρίωση διατίθενται " +"επιπλέον υπό την άδεια χρήσης Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Δες την Ιστορία και Άδεια χρήσης για " +"περισσότερες πληροφορίες." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Φιλοξενείται στο %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Τελευταία ενημέρωση στις %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Βρήκες ένα bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Δημιουργήθηκε με την χρήση του Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Αντιγραφή" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Αντιγραφή στο πρόχειρο" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Αντιγράφηκε!" From 803833f38cd1b1b6b8b853f2c1df6790d09b42c0 Mon Sep 17 00:00:00 2001 From: Panagiotis Skias Date: Mon, 8 Sep 2025 11:13:01 +0300 Subject: [PATCH 127/131] Minor fixes for Greek translation (#257) --- python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po index c7127f55..5ade8b82 100644 --- a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po @@ -37,7 +37,7 @@ msgstr "Γρήγορη αναζήτηση" #: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 msgid "Go" -msgstr "Πήγαινε" +msgstr "Μετάβαση" #: python_docs_theme/layout.html:60 msgid "Theme" @@ -49,7 +49,7 @@ msgstr "Αυτόματα" #: python_docs_theme/layout.html:63 msgid "Light" -msgstr "Ανοιχτό" +msgstr "Φωτεινό" #: python_docs_theme/layout.html:64 msgid "Dark" From 44303e12a75c6d5e1319774a258f1d05b4c2518b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:54:18 +0300 Subject: [PATCH 128/131] Prepare 2025.9 release (#254) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- CHANGELOG.rst | 8 ++++++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 07b2735e..696bb883 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +`2025.9 `_ +--------------------------------------------------------------------------- + +* Enable theme translation and add Polish by @StanFromIreland in https://github.com/python/python-docs-theme/pull/246 +* Add Greek translation by @lysnikolaou and @skpanagiotis in https://github.com/python/python-docs-theme/pull/256 and https://github.com/python/python-docs-theme/pull/257 +* Add Swedish translation by @yeager in https://github.com/python/python-docs-theme/pull/250 +* Pull Brazilian Portuguese, Simplified Chinese, Traditional Chinese, Japanese, Turkish and Spanish translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 and https://github.com/python/python-docs-theme/pull/259 + `2025.5 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 6b80ad0a..cc11f5e9 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -9,7 +9,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.5" +__version__ = "2025.9" THEME_PATH = Path(__file__).resolve().parent LOCALE_DIR = THEME_PATH / "locale" From a955b8c4e69e843d4b079e950e08122901aa4a10 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:15:06 +0100 Subject: [PATCH 129/131] Adds, Spanish, Turkish and Japanese from Transifex (#259) --- .../es/LC_MESSAGES/python-docs-theme.po | 128 +++++++++++++++++ .../ja/LC_MESSAGES/python-docs-theme.po | 124 +++++++++++++++++ .../pl/LC_MESSAGES/python-docs-theme.po | 35 ++--- .../tr/LC_MESSAGES/python-docs-theme.po | 130 ++++++++++++++++++ 4 files changed, 400 insertions(+), 17 deletions(-) create mode 100644 python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..34fc30ef --- /dev/null +++ b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,128 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Cristián Maureira-Fredes, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Cristián Maureira-Fredes, 2025\n" +"Language-Team: Spanish (https://app.transifex.com/python-doc/teams/5390/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: es\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "La Python Software Foundation es una corporación sin fines de lucro." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Por favor dona." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navegación" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Búsqueda rápida" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ir" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Claro" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Oscuro" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menú" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Derechos de autor" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "Ésta página tiene la licencia Python Software Foundation Versión 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Ejemplos, guías, y otro código en la documentación están bajo la licencia " +"adicional Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Ver Historia y Licencia para más " +"información." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hospedado en %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Última actualización en %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Encontraste un bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Creado usando Sphinx%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Copiar" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Copiar al portapapeles" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "¡Copiado!" diff --git a/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..dfea8575 --- /dev/null +++ b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,124 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Inada Naoki , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Inada Naoki , 2025\n" +"Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/ja/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: ja\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Pythonソフトウェア財団は非営利法人です。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "寄付をするには" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigation" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "検索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Go" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "テーマ" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自動" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "ライト" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "ダーク" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "メニュー" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Copyright" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "このページはPython Software Foundation License Version 2でライセンスされています。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "ドキュメント内のサンプル、レシピ等のコードは、Zero Clause BSDライセンスの下で追加的にライセンスされています。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "詳しくは歴史とライセンスを参照してください。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "%(hosted_on)sにてホストされています。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最終更新日: %(last_updated)s" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "バグを報告する" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Sphinx%(sphinx_version)sを使って構築されています。" + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "コピー" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "クリップボードにコピーする" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "コピーされました。" diff --git a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po index cb74d912..461c4c95 100644 --- a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po @@ -1,24 +1,27 @@ -# Polish (Poland) translations for python-docs-theme. +# Translations template for python-docs-theme. # Copyright (C) 2025 Python Software Foundation # This file is distributed under the same license as the python-docs-theme # project. -# Stan Ulbrych, 2025. +# FIRST AUTHOR , 2025. # +# Translators: +# Stan Ulbrych, 2025 +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" "Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" -"POT-Creation-Date: 2025-08-07 19:09+0200\n" -"PO-Revision-Date: 2025-08-07 15:11+0200\n" -"Last-Translator: Stan Ulbrych \n" -"Language: pl\n" -"Language-Team: pl \n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " -"(n%100<10 || n%100>=20) ? 1 : 2);\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Stan Ulbrych, 2025\n" +"Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.16.0\n" +"Language: pl\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" #: python_docs_theme/footerdonate.html:1 msgid "The Python Software Foundation is a non-profit corporation." @@ -66,19 +69,17 @@ msgstr "Prawa autorskie" #: python_docs_theme/layout.html:147 msgid "" -"This page is licensed under the Python Software Foundation License " -"Version 2." -msgstr "" -"Ta strona jest objęta licencją Python Software " -"Foundation w wersji 2." +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "Ta strona jest objęta licencją Python Software Foundation w wersji 2." #: python_docs_theme/layout.html:149 msgid "" "Examples, recipes, and other code in the documentation are additionally " "licensed under the Zero Clause BSD License." msgstr "" -"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte " -"licencją Zero Clause BSD." +"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte licencją " +"Zero Clause BSD." #: python_docs_theme/layout.html:152 #, python-format diff --git a/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..90afb861 --- /dev/null +++ b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,130 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Ege Akman, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Ege Akman, 2025\n" +"Language-Team: Turkish (https://app.transifex.com/python-doc/teams/5390/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation kâr amacı gütmeyen bir kuruluştur." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Lütfen bağış yapın." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigasyon" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Hızlı arama" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ara" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Otomatik" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Açık" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Koyu" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menü" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Telif Hakkı" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Bu sayfa, Python Software Foundation License Version 2 kapsamında " +"lisanslanmıştır." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Dokümantasyondaki örnekler, tarifler ve diğer kodlar ek olarak Zero Clause " +"BSD License kapsamında lisanslanmıştır." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Daha fazla bilgi için Geçmiş ve Lisans " +"bölümüne bakın. " + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "%(hosted_on)s üzerinde barındırılmaktadır." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "En son %(last_updated)s tarihinde güncellendi." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Bir bug mı buldunuz?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Sphinx %(sphinx_version)s ile " +"oluşturuldu. " + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopyala" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Panoya kopyala" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopyalandı!" From 413eb45152b1277f3f5725706271a55db1624226 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 8 Sep 2025 22:28:15 +0300 Subject: [PATCH 130/131] Prepare 2025.9.1 release (#261) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- CHANGELOG.rst | 7 ++++++- python_docs_theme/__init__.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 696bb883..c411e71f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,18 @@ Changelog ========= +`2025.9.1 `_ +------------------------------------------------------------------------------- + +* Add Japanese, Turkish and Spanish translations from Transifex in https://github.com/python/python-docs-theme/pull/259 + `2025.9 `_ --------------------------------------------------------------------------- * Enable theme translation and add Polish by @StanFromIreland in https://github.com/python/python-docs-theme/pull/246 * Add Greek translation by @lysnikolaou and @skpanagiotis in https://github.com/python/python-docs-theme/pull/256 and https://github.com/python/python-docs-theme/pull/257 * Add Swedish translation by @yeager in https://github.com/python/python-docs-theme/pull/250 -* Pull Brazilian Portuguese, Simplified Chinese, Traditional Chinese, Japanese, Turkish and Spanish translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 and https://github.com/python/python-docs-theme/pull/259 +* Add Brazilian Portuguese, Simplified Chinese and Traditional Chinese translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 `2025.5 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index cc11f5e9..d9281fff 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -9,7 +9,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.9" +__version__ = "2025.9.1" THEME_PATH = Path(__file__).resolve().parent LOCALE_DIR = THEME_PATH / "locale" From d2ceb99b1a34a83ca56d90b49f970fca8efce2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Tue, 9 Sep 2025 18:59:29 +0200 Subject: [PATCH 131/131] Add German translation (#262) --- .../de/LC_MESSAGES/python-docs-theme.po | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..49dddf78 --- /dev/null +++ b/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,132 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Cristián Maureira-Fredes, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-09 10:20+0200\n" +"Last-Translator: Cristián Maureira-Fredes, 2025\n" +"Language-Team: \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? " +"1 : 2;\n" +"Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.6\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Die Python Software Foundation ist eine gemeinnützige Organisation." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Spenden Sie bitte." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigation" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Schnellsuche" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Los" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Thema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Hell" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Dunkel" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menü" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Copyright" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Diese Seite ist unter der Python Software Foundation License Version 2 " +"lizenziert." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Beispiele, Rezepte und anderer Code in der Dokumentation sind zusätzlich " +"unter der Zero Clause BSD-Lizenz lizenziert." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Weitere Informationen finden Sie unter Verlauf und Lizenz." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Gehostet auf %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Zuletzt aktualisiert am %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Fehler gefunden?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Erstellt mit Sphinx%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopieren" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "In die Zwischenablage kopieren" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopiert!"