diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c5e5f709a..0cd6f4a21 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -21,6 +21,7 @@ jobs: fail-fast: false matrix: include: + - {python: '3.13'} - {python: '3.12'} - {name: Windows, python: '3.12', os: windows-latest} - {name: Mac, python: '3.12', os: macos-latest} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd86089b8..5b7ebb878 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: autoupdate_schedule: monthly repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.4.4 hooks: - id: ruff - id: ruff-format diff --git a/requirements/build.txt b/requirements/build.txt index 98175b856..52fd1f69a 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,15 +1,12 @@ -# SHA1:80754af91bfb6d1073585b046fe0a474ce868509 # -# This file is autogenerated by pip-compile-multi -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# pip-compile-multi +# pip-compile build.in # -build==0.10.0 - # via -r requirements/build.in -packaging==23.1 +build==1.2.1 + # via -r build.in +packaging==24.0 # via build -pyproject-hooks==1.0.0 - # via build -tomli==2.0.1 +pyproject-hooks==1.1.0 # via build diff --git a/requirements/dev.txt b/requirements/dev.txt index 79fb7c0ba..076912b0b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,62 +1,146 @@ -# SHA1:54b5b77ec8c7a0064ffa93b2fd16cb0130ba177c # -# This file is autogenerated by pip-compile-multi -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# pip-compile-multi +# pip-compile dev.in # --r docs.txt --r tests.txt --r typing.txt -build==0.10.0 +alabaster==0.7.16 + # via sphinx +attrs==23.2.0 + # via + # outcome + # trio +babel==2.15.0 + # via sphinx +build==1.2.1 # via pip-tools -cachetools==5.3.1 +cachetools==5.3.3 # via tox -cfgv==3.3.1 +certifi==2024.2.2 + # via requests +cfgv==3.4.0 # via pre-commit -chardet==5.1.0 +chardet==5.2.0 # via tox -click==8.1.3 +charset-normalizer==3.3.2 + # via requests +click==8.1.7 # via # pip-compile-multi # pip-tools colorama==0.4.6 # via tox -distlib==0.3.6 +distlib==0.3.8 # via virtualenv -filelock==3.12.2 +docutils==0.21.2 + # via sphinx +filelock==3.14.0 # via # tox # virtualenv -identify==2.5.24 +identify==2.5.36 # via pre-commit +idna==3.7 + # via + # requests + # trio +imagesize==1.4.1 + # via sphinx +iniconfig==2.0.0 + # via pytest +jinja2==3.1.4 + # via sphinx +markupsafe==2.1.5 + # via jinja2 +mypy==1.10.0 + # via -r typing.in +mypy-extensions==1.0.0 + # via mypy nodeenv==1.8.0 # via pre-commit +outcome==1.3.0.post0 + # via trio +packaging==24.0 + # via + # build + # pallets-sphinx-themes + # pyproject-api + # pytest + # sphinx + # tox +pallets-sphinx-themes==2.1.3 + # via -r docs.in pip-compile-multi==2.6.3 - # via -r requirements/dev.in -pip-tools==6.13.0 + # via -r dev.in +pip-tools==7.4.1 # via pip-compile-multi -platformdirs==3.8.0 +platformdirs==4.2.1 # via # tox # virtualenv -pre-commit==3.3.3 - # via -r requirements/dev.in -pyproject-api==1.5.2 +pluggy==1.5.0 + # via + # pytest + # tox +pre-commit==3.7.1 + # via -r dev.in +pygments==2.18.0 + # via sphinx +pyproject-api==1.6.1 # via tox -pyproject-hooks==1.0.0 - # via build +pyproject-hooks==1.1.0 + # via + # build + # pip-tools +pytest==8.2.0 + # via -r tests.in pyyaml==6.0.1 # via pre-commit +requests==2.31.0 + # via sphinx +sniffio==1.3.1 + # via trio +snowballstemmer==2.2.0 + # via sphinx +sortedcontainers==2.4.0 + # via trio +sphinx==7.3.7 + # via + # -r docs.in + # pallets-sphinx-themes + # sphinx-issues + # sphinxcontrib-log-cabinet +sphinx-issues==4.1.0 + # via -r docs.in +sphinxcontrib-applehelp==1.0.8 + # via sphinx +sphinxcontrib-devhelp==1.0.6 + # via sphinx +sphinxcontrib-htmlhelp==2.0.5 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-log-cabinet==1.0.1 + # via -r docs.in +sphinxcontrib-qthelp==1.0.7 + # via sphinx +sphinxcontrib-serializinghtml==1.1.10 + # via sphinx toposort==1.10 # via pip-compile-multi -tox==4.6.3 - # via -r requirements/dev.in -virtualenv==20.23.1 +tox==4.15.0 + # via -r dev.in +trio==0.25.0 + # via -r tests.in +typing-extensions==4.11.0 + # via mypy +urllib3==2.2.1 + # via requests +virtualenv==20.26.1 # via # pre-commit # tox -wheel==0.40.0 +wheel==0.43.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/docs.txt b/requirements/docs.txt index 27488ade0..2cbd73fa8 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,61 +1,60 @@ -# SHA1:45c590f97fe95b8bdc755eef796e91adf5fbe4ea # -# This file is autogenerated by pip-compile-multi -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# pip-compile-multi +# pip-compile docs.in # -alabaster==0.7.13 +alabaster==0.7.16 # via sphinx -babel==2.12.1 +babel==2.15.0 # via sphinx -certifi==2023.5.7 +certifi==2024.2.2 # via requests -charset-normalizer==3.1.0 +charset-normalizer==3.3.2 # via requests -docutils==0.20.1 +docutils==0.21.2 # via sphinx -idna==3.6 +idna==3.7 # via requests imagesize==1.4.1 # via sphinx -jinja2==3.1.2 +jinja2==3.1.4 # via sphinx -markupsafe==2.1.3 +markupsafe==2.1.5 # via jinja2 -packaging==23.1 +packaging==24.0 # via # pallets-sphinx-themes # sphinx -pallets-sphinx-themes==2.1.1 - # via -r requirements/docs.in -pygments==2.15.1 +pallets-sphinx-themes==2.1.3 + # via -r docs.in +pygments==2.18.0 # via sphinx requests==2.31.0 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==7.0.1 +sphinx==7.3.7 # via - # -r requirements/docs.in + # -r docs.in # pallets-sphinx-themes # sphinx-issues # sphinxcontrib-log-cabinet -sphinx-issues==3.0.1 - # via -r requirements/docs.in -sphinxcontrib-applehelp==1.0.4 +sphinx-issues==4.1.0 + # via -r docs.in +sphinxcontrib-applehelp==1.0.8 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.6 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.5 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-log-cabinet==1.0.1 - # via -r requirements/docs.in -sphinxcontrib-qthelp==1.0.3 + # via -r docs.in +sphinxcontrib-qthelp==1.0.7 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.10 # via sphinx -urllib3==2.0.3 +urllib3==2.2.1 # via requests diff --git a/requirements/tests.in b/requirements/tests.in index 423e485cc..5669c6ecd 100644 --- a/requirements/tests.in +++ b/requirements/tests.in @@ -1,2 +1,2 @@ pytest -trio<=0.22.2 # for Python3.7 support +trio diff --git a/requirements/tests.txt b/requirements/tests.txt index bb8f55df1..de18d477d 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,35 +1,28 @@ -# SHA1:b8d151f902b43c4435188a9d3494fb8d4af07168 # -# This file is autogenerated by pip-compile-multi -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# pip-compile-multi +# pip-compile tests.in # attrs==23.2.0 # via # outcome # trio -exceptiongroup==1.1.1 - # via - # pytest - # trio -idna==3.6 +idna==3.7 # via trio iniconfig==2.0.0 # via pytest outcome==1.3.0.post0 # via trio -packaging==23.1 +packaging==24.0 # via pytest -pluggy==1.2.0 +pluggy==1.5.0 # via pytest -pytest==7.4.0 - # via -r requirements/tests.in +pytest==8.2.0 + # via -r tests.in sniffio==1.3.1 # via trio sortedcontainers==2.4.0 # via trio -tomli==2.0.1 - # via pytest -trio==0.22.2 - # via -r requirements/tests.in +trio==0.25.0 + # via -r tests.in diff --git a/requirements/tests37.in b/requirements/tests37.in new file mode 100644 index 000000000..9c2bed180 --- /dev/null +++ b/requirements/tests37.in @@ -0,0 +1,2 @@ +pytest +trio==0.22.2 diff --git a/requirements/tests37.txt b/requirements/tests37.txt new file mode 100644 index 000000000..578789e7a --- /dev/null +++ b/requirements/tests37.txt @@ -0,0 +1,43 @@ +# +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: +# +# pip-compile tests37.in +# +attrs==23.2.0 + # via + # outcome + # trio +exceptiongroup==1.2.1 + # via + # pytest + # trio +idna==3.7 + # via trio +importlib-metadata==6.7.0 + # via + # attrs + # pluggy + # pytest +iniconfig==2.0.0 + # via pytest +outcome==1.3.0.post0 + # via trio +packaging==24.0 + # via pytest +pluggy==1.2.0 + # via pytest +pytest==7.4.4 + # via -r tests37.in +sniffio==1.3.1 + # via trio +sortedcontainers==2.4.0 + # via trio +tomli==2.0.1 + # via pytest +trio==0.22.2 + # via -r tests37.in +typing-extensions==4.7.1 + # via importlib-metadata +zipp==3.15.0 + # via importlib-metadata diff --git a/requirements/typing.txt b/requirements/typing.txt index e06fb524e..c08a53767 100644 --- a/requirements/typing.txt +++ b/requirements/typing.txt @@ -1,15 +1,12 @@ -# SHA1:7983aaa01d64547827c20395d77e248c41b2572f # -# This file is autogenerated by pip-compile-multi -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# pip-compile-multi +# pip-compile typing.in # -mypy==1.4.1 - # via -r requirements/typing.in +mypy==1.10.0 + # via -r typing.in mypy-extensions==1.0.0 # via mypy -tomli==2.0.1 - # via mypy -typing-extensions==4.6.3 +typing-extensions==4.11.0 # via mypy diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py index e18a14004..91720c5f9 100644 --- a/src/jinja2/compiler.py +++ b/src/jinja2/compiler.py @@ -55,7 +55,7 @@ def new_func( return f(self, node, frame, **kwargs) - return update_wrapper(t.cast(F, new_func), f) + return update_wrapper(new_func, f) # type: ignore[return-value] def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: diff --git a/tests/test_loader.py b/tests/test_loader.py index 77d686ef5..3e64f6237 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -2,7 +2,6 @@ import importlib.machinery import importlib.util import os -import platform import shutil import sys import tempfile @@ -364,8 +363,8 @@ def test_package_zip_source(package_zip_loader, template, expect): @pytest.mark.xfail( - platform.python_implementation() == "PyPy", - reason="PyPy's zipimporter doesn't have a '_files' attribute.", + sys.implementation.name == "pypy" or sys.version_info > (3, 13), + reason="zipimporter doesn't have a '_files' attribute", raises=TypeError, ) def test_package_zip_list(package_zip_loader): diff --git a/tox.ini b/tox.ini index 6582e2812..b9e972b93 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{12,11,10,9,8,7} + py3{13,12,11,10,9,8,7} pypy310 style typing @@ -15,6 +15,9 @@ use_frozen_constraints = true deps = -r requirements/tests.txt commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs} +[testenv:py37,py3.7] +deps = -r requirements/tests37.txt + [testenv:style] deps = pre-commit skip_install = true @@ -28,16 +31,28 @@ commands = mypy deps = -r requirements/docs.txt commands = sphinx-build -E -W -b dirhtml docs docs/_build/dirhtml +[testenv:update-pre_commit] +labels = update +deps = pre-commit +skip_install = true +commands = pre-commit autoupdate -j4 + [testenv:update-requirements] -deps = - pip-tools - pre-commit +labels = update +deps = pip-tools skip_install = true change_dir = requirements commands = - pre-commit autoupdate -j4 - pip-compile -U build.in - pip-compile -U docs.in - pip-compile -U tests.in - pip-compile -U typing.in - pip-compile -U dev.in + pip-compile build.in -q {posargs:-U} + pip-compile docs.in -q {posargs:-U} + pip-compile tests.in -q {posargs:-U} + pip-compile typing.in -q {posargs:-U} + pip-compile dev.in -q {posargs:-U} + +[testenv:update-requirements37] +base_python = 3.7 +labels = update +deps = pip-tools +skip_install = true +change_dir = requirements +commands = pip-compile tests37.in -q {posargs:-U}