From a9a0197e3c63cc8abc965369d252cca9e866be6d Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 10 Sep 2024 18:23:08 +0300 Subject: [PATCH 1/4] Improve documentation for initializing the i18n extension Refs discussion at https://stackoverflow.com/a/78970088 --- docs/extensions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/extensions.rst b/docs/extensions.rst index 45ead3b71..9b15e813e 100644 --- a/docs/extensions.rst +++ b/docs/extensions.rst @@ -39,6 +39,10 @@ After enabling, an application has to provide functions for ``gettext``, globally or when rendering. A ``_()`` function is added as an alias to the ``gettext`` function. +A convenient way to provide these functions is to call one of the below +methods depending on the translation system in use. If you do not require +actual translation, use ``Environment.install_null_translations`` to +install no-op functions. Environment Methods ~~~~~~~~~~~~~~~~~~~ From 1e383959f7bae1b0dbf84ef47128a4ef55bcb1a7 Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 24 Oct 2024 14:13:23 -0700 Subject: [PATCH 2/4] update dev dependencies --- .github/workflows/publish.yaml | 10 ++++---- .github/workflows/tests.yaml | 10 ++++---- .pre-commit-config.yaml | 4 +-- requirements/build.txt | 6 ++--- requirements/dev.txt | 47 ++++++++++++++++++---------------- requirements/docs.txt | 21 ++++++++------- requirements/tests.txt | 8 +++--- requirements/tests37.txt | 2 +- requirements/typing.txt | 4 +-- 9 files changed, 59 insertions(+), 53 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7acd92e5b..727518c69 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,8 +9,8 @@ jobs: outputs: hash: ${{ steps.hash.outputs.hash }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.x' cache: pip @@ -23,7 +23,7 @@ jobs: - name: generate hash id: hash run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT - - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: path: ./dist provenance: @@ -64,10 +64,10 @@ jobs: id-token: write steps: - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - - uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 + - uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3 with: repository-url: https://test.pypi.org/legacy/ packages-dir: artifact/ - - uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 + - uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3 with: packages-dir: artifact/ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index afba0d753..68736fb24 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -32,8 +32,8 @@ jobs: - {python: '3.7'} - {name: PyPy, python: 'pypy-3.10', tox: pypy310} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ matrix.python }} allow-prereleases: true @@ -44,14 +44,14 @@ jobs: typing: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.x' cache: pip cache-dependency-path: requirements*/*.txt - name: cache mypy - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: path: ./.mypy_cache key: mypy|${{ hashFiles('pyproject.toml') }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bee1ca4b..74b54e8f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,12 @@ ci: autoupdate_schedule: monthly repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.2 + rev: v0.7.1 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-merge-conflict - id: debug-statements diff --git a/requirements/build.txt b/requirements/build.txt index 4b289ca7f..1b13b0552 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,12 +1,12 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile build.in # -build==1.2.1 +build==1.2.2.post1 # via -r build.in packaging==24.1 # via build -pyproject-hooks==1.1.0 +pyproject-hooks==1.2.0 # via build diff --git a/requirements/dev.txt b/requirements/dev.txt index 51aecad83..ba73d911c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile dev.in @@ -12,17 +12,17 @@ attrs==24.2.0 # trio babel==2.16.0 # via sphinx -build==1.2.1 +build==1.2.2.post1 # via pip-tools cachetools==5.5.0 # via tox -certifi==2024.7.4 +certifi==2024.8.30 # via requests cfgv==3.4.0 # via pre-commit chardet==5.2.0 # via tox -charset-normalizer==3.3.2 +charset-normalizer==3.4.0 # via requests click==8.1.7 # via @@ -30,17 +30,17 @@ click==8.1.7 # pip-tools colorama==0.4.6 # via tox -distlib==0.3.8 +distlib==0.3.9 # via virtualenv docutils==0.21.2 # via sphinx -filelock==3.15.4 +filelock==3.16.1 # via # tox # virtualenv -identify==2.6.0 +identify==2.6.1 # via pre-commit -idna==3.8 +idna==3.10 # via # requests # trio @@ -50,9 +50,9 @@ iniconfig==2.0.0 # via pytest jinja2==3.1.4 # via sphinx -markupsafe==2.1.5 +markupsafe==3.0.2 # via jinja2 -mypy==1.11.1 +mypy==1.13.0 # via -r typing.in mypy-extensions==1.0.0 # via mypy @@ -68,13 +68,13 @@ packaging==24.1 # pytest # sphinx # tox -pallets-sphinx-themes==2.1.3 +pallets-sphinx-themes==2.3.0 # via -r docs.in pip-compile-multi==2.6.4 # via -r dev.in pip-tools==7.4.1 # via pip-compile-multi -platformdirs==4.2.2 +platformdirs==4.3.6 # via # tox # virtualenv @@ -82,17 +82,17 @@ pluggy==1.5.0 # via # pytest # tox -pre-commit==3.8.0 +pre-commit==4.0.1 # via -r dev.in pygments==2.18.0 # via sphinx -pyproject-api==1.7.1 +pyproject-api==1.8.0 # via tox -pyproject-hooks==1.1.0 +pyproject-hooks==1.2.0 # via # build # pip-tools -pytest==8.3.2 +pytest==8.3.3 # via -r tests.in pyyaml==6.0.2 # via pre-commit @@ -104,14 +104,17 @@ snowballstemmer==2.2.0 # via sphinx sortedcontainers==2.4.0 # via trio -sphinx==8.0.2 +sphinx==8.1.3 # via # -r docs.in # pallets-sphinx-themes # sphinx-issues + # sphinx-notfound-page # sphinxcontrib-log-cabinet -sphinx-issues==4.1.0 +sphinx-issues==5.0.0 # via -r docs.in +sphinx-notfound-page==1.0.4 + # via pallets-sphinx-themes sphinxcontrib-applehelp==2.0.0 # via sphinx sphinxcontrib-devhelp==2.0.0 @@ -128,15 +131,15 @@ sphinxcontrib-serializinghtml==2.0.0 # via sphinx toposort==1.10 # via pip-compile-multi -tox==4.18.0 +tox==4.23.2 # via -r dev.in -trio==0.26.2 +trio==0.27.0 # via -r tests.in typing-extensions==4.12.2 # via mypy -urllib3==2.2.2 +urllib3==2.2.3 # via requests -virtualenv==20.26.3 +virtualenv==20.27.0 # via # pre-commit # tox diff --git a/requirements/docs.txt b/requirements/docs.txt index 04e39ac5f..453a7cb5d 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile docs.in @@ -8,25 +8,25 @@ alabaster==1.0.0 # via sphinx babel==2.16.0 # via sphinx -certifi==2024.7.4 +certifi==2024.8.30 # via requests -charset-normalizer==3.3.2 +charset-normalizer==3.4.0 # via requests docutils==0.21.2 # via sphinx -idna==3.8 +idna==3.10 # via requests imagesize==1.4.1 # via sphinx jinja2==3.1.4 # via sphinx -markupsafe==2.1.5 +markupsafe==3.0.2 # via jinja2 packaging==24.1 # via # pallets-sphinx-themes # sphinx -pallets-sphinx-themes==2.1.3 +pallets-sphinx-themes==2.3.0 # via -r docs.in pygments==2.18.0 # via sphinx @@ -34,14 +34,17 @@ requests==2.32.3 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==8.0.2 +sphinx==8.1.3 # via # -r docs.in # pallets-sphinx-themes # sphinx-issues + # sphinx-notfound-page # sphinxcontrib-log-cabinet -sphinx-issues==4.1.0 +sphinx-issues==5.0.0 # via -r docs.in +sphinx-notfound-page==1.0.4 + # via pallets-sphinx-themes sphinxcontrib-applehelp==2.0.0 # via sphinx sphinxcontrib-devhelp==2.0.0 @@ -56,5 +59,5 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -urllib3==2.2.2 +urllib3==2.2.3 # via requests diff --git a/requirements/tests.txt b/requirements/tests.txt index 03ecbc4f8..e019ba988 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile tests.in @@ -8,7 +8,7 @@ attrs==24.2.0 # via # outcome # trio -idna==3.8 +idna==3.10 # via trio iniconfig==2.0.0 # via pytest @@ -18,11 +18,11 @@ packaging==24.1 # via pytest pluggy==1.5.0 # via pytest -pytest==8.3.2 +pytest==8.3.3 # via -r tests.in sniffio==1.3.1 # via trio sortedcontainers==2.4.0 # via trio -trio==0.26.2 +trio==0.27.0 # via -r tests.in diff --git a/requirements/tests37.txt b/requirements/tests37.txt index 8efd75ed3..e8e3492fe 100644 --- a/requirements/tests37.txt +++ b/requirements/tests37.txt @@ -12,7 +12,7 @@ exceptiongroup==1.2.2 # via # pytest # trio -idna==3.8 +idna==3.10 # via trio importlib-metadata==6.7.0 # via diff --git a/requirements/typing.txt b/requirements/typing.txt index 93354adf5..1cf3727a5 100644 --- a/requirements/typing.txt +++ b/requirements/typing.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile typing.in # -mypy==1.11.1 +mypy==1.13.0 # via -r typing.in mypy-extensions==1.0.0 # via mypy From d3d0910d8a05b3f97a3bcfe881a2d99f15f69ced Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 24 Oct 2024 14:13:40 -0700 Subject: [PATCH 3/4] update test workflow trigger --- .github/workflows/tests.yaml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 68736fb24..515a7a5e4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,18 +1,10 @@ name: Tests on: push: - branches: - - main - - '*.x' - paths-ignore: - - 'docs/**' - - '*.md' - - '*.rst' + branches: [main, stable] + paths-ignore: ['docs/**', '*.md', '*.rst'] pull_request: - paths-ignore: - - 'docs/**' - - '*.md' - - '*.rst' + paths-ignore: [ 'docs/**', '*.md', '*.rst' ] jobs: tests: name: ${{ matrix.name || matrix.python }} From ada0a9a6fc265128b46949b5144d2eaa55e6df2c Mon Sep 17 00:00:00 2001 From: David Lord Date: Thu, 24 Oct 2024 14:16:05 -0700 Subject: [PATCH 4/4] update test workflow trigger --- .github/workflows/pre-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 683c85bef..adddea75d 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -2,7 +2,7 @@ name: pre-commit on: pull_request: push: - branches: [main, '*.x'] + branches: [main, stable] jobs: main: runs-on: ubuntu-latest