Skip to content

Commit

Permalink
Merge branch 'patch-1' of github.com:vbuxbaum/jinja into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuxbaum committed Nov 17, 2023
2 parents 05be598 + 07b3e9d commit 25e1fb5
Show file tree
Hide file tree
Showing 22 changed files with 176 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836
- uses: dessant/lock-threads@be8aa5be94131386884a6da4189effda9b14aa21
with:
issue-inactive-days: 14
pr-inactive-days: 14
10 changes: 5 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
outputs:
hash: ${{ steps.hash.outputs.hash }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
with:
python-version: '3.x'
cache: 'pip'
Expand All @@ -33,7 +33,7 @@ jobs:
id-token: write
contents: write
# Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0
with:
base64-subjects: ${{ needs.build.outputs.hash }}
create-release:
Expand Down Expand Up @@ -61,12 +61,12 @@ jobs:
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
# Try uploading to Test PyPI first, in case something fails.
- uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
- uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: artifact/
- uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
- uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with:
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: artifact/
13 changes: 4 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,17 @@ jobs:
- {name: 'PyPy', python: 'pypy-3.10', os: ubuntu-latest, tox: pypy310}
- {name: Typing, python: '3.11', os: ubuntu-latest, tox: typing}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- name: cache mypy
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: ./.mypy_cache
key: mypy|${{ matrix.python }}|${{ hashFiles('setup.cfg') }}
key: mypy|${{ matrix.python }}|${{ hashFiles('pyproject.toml') }}
if: matrix.tox == 'typing'
- run: pip install tox
- run: tox run -e ${{ matrix.tox }}
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
.. currentmodule:: jinja2

Version 3.2.0
-------------

Unreleased

- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
:pr:`1793`
- Use ``flit_core`` instead of ``setuptools`` as build backend.


Version 3.1.3
-------------

Expand Down
6 changes: 0 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ First time setup
> env\Scripts\activate
- Upgrade pip and setuptools.

.. code-block:: text
$ python -m pip install --upgrade pip setuptools
- Install the development dependencies, then install Jinja in editable
mode.

Expand Down
10 changes: 0 additions & 10 deletions MANIFEST.in

This file was deleted.

81 changes: 81 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[project]
name = "Jinja2"
description = "A very fast and expressive template engine."
readme = "README.rst"
license = {file = "LICENSE.rst"}
maintainers = [{name = "Pallets", email = "contact@palletsprojects.com"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Text Processing :: Markup :: HTML",
]
requires-python = ">=3.7"
dependencies = ["MarkupSafe>=2.0"]
dynamic = ["version"]

[project.urls]
Donate = "https://palletsprojects.com/donate"
Documentation = "https://jinja.palletsprojects.com/"
Changes = "https://jinja.palletsprojects.com/changes/"
"Source Code" = "https://github.com/pallets/jinja/"
"Issue Tracker" = "https://github.com/pallets/jinja/issues/"
Chat = "https://discord.gg/pallets"

[project.optional-dependencies]
i18n = ["Babel>=2.7"]

[project.entry-points."babel.extractors"]

[build-system]
requires = ["flit_core<4"]
build-backend = "flit_core.buildapi"

[tool.flit.module]
name = "jinja2"

[tool.flit.sdist]
include = [
"docs/",
"examples/",
"requirements/",
"tests/",
"CHANGES.rst",
"tox.ini",
]
exclude = [
"docs/_build/",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = [
"error",
]

[tool.coverage.run]
branch = true
source = ["jinja2", "tests"]

[tool.coverage.paths]
source = ["src", "*/site-packages"]

[tool.mypy]
python_version = "3.7"
files = ["src/jinja2"]
show_error_codes = true
pretty = true
strict = true
local_partial_types = true
warn_unreachable = true

[[tool.mypy.overrides]]
module = [
"jinja2.defaults",
"markupsafe",
]
no_implicit_reexport = false
4 changes: 2 additions & 2 deletions scripts/generate_identifier_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def collapse_ranges(data):
Source: https://stackoverflow.com/a/4629241/400617
"""
for _, g in itertools.groupby(enumerate(data), lambda x: ord(x[1]) - x[0]):
b = list(g)
yield b[0][1], b[-1][1]
lb = list(g)
yield lb[0][1], lb[-1][1]


def build_pattern(ranges):
Expand Down
81 changes: 0 additions & 81 deletions setup.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/jinja2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
from .utils import pass_eval_context as pass_eval_context
from .utils import select_autoescape as select_autoescape

__version__ = "3.1.3.dev"
__version__ = "3.2.0.dev0"
2 changes: 1 addition & 1 deletion src/jinja2/async_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def wrapper(*args, **kwargs): # type: ignore
if need_eval_context:
wrapper = pass_eval_context(wrapper)

wrapper.jinja_async_variant = True
wrapper.jinja_async_variant = True # type: ignore[attr-defined]
return wrapper

return decorator
Expand Down
12 changes: 7 additions & 5 deletions src/jinja2/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_spontaneous_environment(cls: t.Type[_env_bound], *args: t.Any) -> _env_b

def create_cache(
size: int,
) -> t.Optional[t.MutableMapping[t.Tuple[weakref.ref, str], "Template"]]:
) -> t.Optional[t.MutableMapping[t.Tuple["weakref.ref[BaseLoader]", str], "Template"]]:
"""Return the cache class for the given size."""
if size == 0:
return None
Expand All @@ -91,8 +91,10 @@ def create_cache(


def copy_cache(
cache: t.Optional[t.MutableMapping],
) -> t.Optional[t.MutableMapping[t.Tuple[weakref.ref, str], "Template"]]:
cache: t.Optional[
t.MutableMapping[t.Tuple["weakref.ref[BaseLoader]", str], "Template"]
],
) -> t.Optional[t.MutableMapping[t.Tuple["weakref.ref[BaseLoader]", str], "Template"]]:
"""Create an empty copy of the given cache."""
if cache is None:
return None
Expand Down Expand Up @@ -814,7 +816,7 @@ def compile_expression(

def compile_templates(
self,
target: t.Union[str, os.PathLike],
target: t.Union[str, "os.PathLike[str]"],
extensions: t.Optional[t.Collection[str]] = None,
filter_func: t.Optional[t.Callable[[str], bool]] = None,
zip: t.Optional[str] = "deflated",
Expand Down Expand Up @@ -1588,7 +1590,7 @@ def __init__(self, gen: t.Iterator[str]) -> None:

def dump(
self,
fp: t.Union[str, t.IO],
fp: t.Union[str, t.IO[t.Any]],
encoding: t.Optional[str] = None,
errors: t.Optional[str] = "strict",
) -> None:
Expand Down

0 comments on commit 25e1fb5

Please sign in to comment.