Skip to content
Myr

add warning and alias for jinja2

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 1167525 · Browse files · 39 files+207 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

39 files+207 added−15 removed

  • tests:+3 added−3 removed
  • other:+204 added−12 removed

39 files+207 added−15 removed

added:jinja2-compat/src/jinja2/__init__.py+21 added
1def _export_jinja(name, ns):2 import warnings3 from importlib import import_module45 mod_name = "jinja" if not name else ("jinja." + name)6 warnings.warn(7 "'jinja2' has been renamed to 'jinja'. Import from %r instead." % mod_name,8 DeprecationWarning,9 stacklevel=3,10 )11 mod = import_module(mod_name)1213 for key, value in vars(mod).items():14 if not key.startswith("__") or key == "__version__":15 ns[key] = value1617 if name:18 ns.pop("_export_jinja")192021_export_jinja(None, globals())
added:jinja2-compat/src/jinja2/_compat.py+3 added
1from . import _export_jinja23_export_jinja("_compat", globals())
added:jinja2-compat/src/jinja2/_identifier.py+3 added
1from . import _export_jinja23_export_jinja("_identifier", globals())
added:jinja2-compat/src/jinja2/asyncfilters.py+3 added
1from . import _export_jinja23_export_jinja("asyncfilters", globals())
added:jinja2-compat/src/jinja2/asyncsupport.py+3 added
1from . import _export_jinja23_export_jinja("asyncsupport", globals())
added:jinja2-compat/src/jinja2/bccache.py+3 added
1from . import _export_jinja23_export_jinja("bccache", globals())
added:jinja2-compat/src/jinja2/compiler.py+3 added
1from . import _export_jinja23_export_jinja("compiler", globals())
added:jinja2-compat/src/jinja2/constants.py+3 added
1from . import _export_jinja23_export_jinja("constants", globals())
added:jinja2-compat/src/jinja2/debug.py+3 added
1from . import _export_jinja23_export_jinja("debug", globals())
added:jinja2-compat/src/jinja2/defaults.py+3 added
1from . import _export_jinja23_export_jinja("defaults", globals())
added:jinja2-compat/src/jinja2/environment.py+3 added
1from . import _export_jinja23_export_jinja("environment", globals())
added:jinja2-compat/src/jinja2/exceptions.py+3 added
1from . import _export_jinja23_export_jinja("exceptions", globals())
added:jinja2-compat/src/jinja2/ext.py+3 added
1from . import _export_jinja23_export_jinja("ext", globals())
added:jinja2-compat/src/jinja2/filters.py+3 added
1from . import _export_jinja23_export_jinja("filters", globals())
added:jinja2-compat/src/jinja2/idtracking.py+3 added
1from . import _export_jinja23_export_jinja("idtracking", globals())
added:jinja2-compat/src/jinja2/lexer.py+3 added
1from . import _export_jinja23_export_jinja("lexer", globals())
added:jinja2-compat/src/jinja2/loaders.py+3 added
1from . import _export_jinja23_export_jinja("loaders", globals())
added:jinja2-compat/src/jinja2/meta.py+3 added
1from . import _export_jinja23_export_jinja("meta", globals())
added:jinja2-compat/src/jinja2/nativetypes.py+3 added
1from . import _export_jinja23_export_jinja("nativetypes", globals())
added:jinja2-compat/src/jinja2/nodes.py+3 added
1from . import _export_jinja23_export_jinja("nodes", globals())
added:jinja2-compat/src/jinja2/optimizer.py+3 added
1from . import _export_jinja23_export_jinja("optimizer", globals())
added:jinja2-compat/src/jinja2/parser.py+3 added
1from . import _export_jinja23_export_jinja("parser", globals())
added:jinja2-compat/src/jinja2/runtime.py+3 added
1from . import _export_jinja23_export_jinja("runtime", globals())
added:jinja2-compat/src/jinja2/sandbox.py+3 added
1from . import _export_jinja23_export_jinja("sandbox", globals())
added:jinja2-compat/src/jinja2/tests.py+3 added
1from . import _export_jinja23_export_jinja("tests", globals())
added:jinja2-compat/src/jinja2/utils.py+3 added
1from . import _export_jinja23_export_jinja("utils", globals())
added:jinja2-compat/src/jinja2/visitor.py+3 added
1from . import _export_jinja23_export_jinja("visitor", globals())
added:jinja2-compat/LICENSE.rst+28 added
1Copyright 2007 Pallets23Redistribution and use in source and binary forms, with or without4modification, are permitted provided that the following conditions are5met:671. Redistributions of source code must retain the above copyright8 notice, this list of conditions and the following disclaimer.9102. Redistributions in binary form must reproduce the above copyright11 notice, this list of conditions and the following disclaimer in the12 documentation and/or other materials provided with the distribution.13143. Neither the name of the copyright holder nor the names of its15 contributors may be used to endorse or promote products derived from16 this software without specific prior written permission.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
added:jinja2-compat/MANIFEST.in+1 added
1global-exclude *.pyc
added:jinja2-compat/README.rst+9 added
1The Jinja2 package has been renamed to `Jinja`_. This package provides2compatibility while projects transition to the new name. Imports from3``jinja2`` will be redirected to ``jinja`` and a deprecation warning4will be emitted.56Projects are advised to require 'Jinja' instead of 'Jinja2' and replace7all imports of ``jinja2`` with ``jinja`` to continue receiving updates.89.. _Jinja: https://pypi.org/project/Jinja/
added:jinja2-compat/setup.cfg+5 added
1[metadata]2license_file = LICENSE.rst34[bdist_wheel]5universal = true
added:jinja2-compat/setup.py+53 added
1import io23from setuptools import find_packages4from setuptools import setup56with io.open("README.rst", "rt", encoding="utf8") as f:7 readme = f.read()89setup(10 name="Jinja2",11 version="2.11.0rc1",12 url="https://palletsprojects.com/p/jinja/",13 project_urls={14 "Documentation": "https://jinja.palletsprojects.com/",15 "Code": "https://github.com/pallets/jinja",16 "Issue tracker": "https://github.com/pallets/jinja/issues",17 },18 license="BSD-3-Clause",19 maintainer="Pallets",20 maintainer_email="contact@palletsprojects.com",21 description=(22 "A very fast and expressive template engine. Compatibility"23 " package for Jinja2 to Jinja rename."24 ),25 long_description=readme,26 classifiers=[27 "Development Status :: 5 - Production/Stable",28 "Environment :: Web Environment",29 "Intended Audience :: Developers",30 "License :: OSI Approved :: BSD License",31 "Operating System :: OS Independent",32 "Programming Language :: Python",33 "Programming Language :: Python :: 2",34 "Programming Language :: Python :: 2.7",35 "Programming Language :: Python :: 3",36 "Programming Language :: Python :: 3.5",37 "Programming Language :: Python :: 3.6",38 "Programming Language :: Python :: 3.7",39 "Programming Language :: Python :: 3.8",40 "Programming Language :: Python :: Implementation :: CPython",41 "Programming Language :: Python :: Implementation :: PyPy",42 "Topic :: Internet :: WWW/HTTP :: Dynamic Content",43 "Topic :: Software Development :: Libraries :: Python Modules",44 "Topic :: Text Processing :: Markup :: HTML",45 ],46 packages=find_packages("src"),47 package_dir={"": "src"},48 include_package_data=True,49 python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",50 install_requires=["Jinja<4.0"],51 extras_require={"i18n": ["Babel>=0.8"]},52 entry_points={"babel.extractors": ["jinja2 = jinja2.ext:babel_extract[i18n]"]},53)
modified:src/jinja/__init__.py+1 added-1 removed
38 unmodified lines
39from .utils import is_undefined40from .utils import Markup41from .utils import select_autoescape4243__version__ = "2.11.0.dev0"43__version__ = "2.11.0rc1"
modified:src/jinja/compiler.py+1 added-1 removed
710 unmodified lines
711 def visit_Template(self, node, frame=None):712 assert frame is None, "no root frame allowed"713 eval_ctx = EvalContext(self.environment, self.name)714715 from .runtime import __all__ as exported715 from .runtime import exported716717 self.writeline("from __future__ import %s" % ", ".join(code_features))718 self.writeline("from jinja.runtime import " + ", ".join(exported))719
1123 unmodified lines
modified:src/jinja/defaults.py-3 removed
40 unmodified lines
41 "json.dumps_function": None,42 "json.dumps_kwargs": {"sort_keys": True},43 "ext.i18n.trimmed": False,44}4546# export all constants47__all__ = tuple(x for x in locals().keys() if x.isupper())
modified:src/jinja/runtime.py+5 added-5 removed
2 unmodified lines
3import sys4from itertools import chain5from types import MethodType67from markupsafe import escape7from markupsafe import escape # noqa: F4018from markupsafe import Markup9from markupsafe import soft_unicode1011from ._compat import abc
4 unmodified lines
16from ._compat import PY217from ._compat import string_types18from ._compat import text_type19from ._compat import with_metaclass20from .exceptions import TemplateNotFound21from .exceptions import TemplateRuntimeError20from .exceptions import TemplateNotFound # noqa: F40121from .exceptions import TemplateRuntimeError # noqa: F40122from .exceptions import UndefinedError23from .nodes import EvalContext24from .utils import concat25from .utils import evalcontextfunction26from .utils import internalcode27from .utils import missing28from .utils import Namespace28from .utils import Namespace # noqa: F40129from .utils import object_type_repr3031# these variables are exported to the template runtime32__all__ = [32exported = [33 "LoopContext",34 "TemplateReference",35 "Macro",36 "Markup",
975 unmodified lines
modified:tests/test_bytecode_cache.py+3 added-3 removed
7 unmodified lines
8from jinja.exceptions import TemplateNotFound91011@pytest.fixture12def env(package_loader):13 bytecode_cache = FileSystemBytecodeCache()14 return Environment(loader=package_loader, bytecode_cache=bytecode_cache,)12def env(package_loader, tmp_path):13 bytecode_cache = FileSystemBytecodeCache(str(tmp_path))14 return Environment(loader=package_loader, bytecode_cache=bytecode_cache)151617@pytest.mark.byte_code_cache18class TestByteCodeCache(object):
61 unmodified lines
modified:MANIFEST.in+1 added
3 unmodified lines
4prune docs/_build5graft examples6graft ext7graft tests8global-exclude *.pyc
modified:setup.py+1 added-2 removed
18 unmodified lines
19 "Code": "https://github.com/pallets/jinja",20 "Issue tracker": "https://github.com/pallets/jinja/issues",21 },22 license="BSD-3-Clause",23 author="Armin Ronacher",24 author_email="armin.ronacher@active-4.com",23 maintainer="Pallets",24 maintainer_email="contact@palletsprojects.com",25 description="A very fast and expressive template engine.",26 long_description=readme,
9 unmodified lines
36 "Programming Language :: Python :: 3",37 "Programming Language :: Python :: 3.5",38 "Programming Language :: Python :: 3.6",39 "Programming Language :: Python :: 3.7",40 "Programming Language :: Python :: 3.8",41 "Programming Language :: Python :: Implementation :: CPython",42 "Programming Language :: Python :: Implementation :: PyPy",43 "Topic :: Internet :: WWW/HTTP :: Dynamic Content",44 "Topic :: Software Development :: Libraries :: Python Modules",
10 unmodified lines