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
Provenance
- Commit
fc9c60b- Tree
6d7ae37- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
1167525
39 files changed+207 added−15 removed
added:jinja2-compat/src/jinja2/__init__.py+21 added
1+def _export_jinja(name, ns):2+ import warnings3+ from importlib import import_module4+5+ 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)12+13+ for key, value in vars(mod).items():14+ if not key.startswith("__") or key == "__version__":15+ ns[key] = value16+17+ if name:18+ ns.pop("_export_jinja")19+20+21+_export_jinja(None, globals())added:jinja2-compat/src/jinja2/_compat.py+3 added
1+from . import _export_jinja2+3+_export_jinja("_compat", globals())added:jinja2-compat/src/jinja2/_identifier.py+3 added
1+from . import _export_jinja2+3+_export_jinja("_identifier", globals())added:jinja2-compat/src/jinja2/asyncfilters.py+3 added
1+from . import _export_jinja2+3+_export_jinja("asyncfilters", globals())added:jinja2-compat/src/jinja2/asyncsupport.py+3 added
1+from . import _export_jinja2+3+_export_jinja("asyncsupport", globals())added:jinja2-compat/src/jinja2/bccache.py+3 added
1+from . import _export_jinja2+3+_export_jinja("bccache", globals())added:jinja2-compat/src/jinja2/compiler.py+3 added
1+from . import _export_jinja2+3+_export_jinja("compiler", globals())added:jinja2-compat/src/jinja2/constants.py+3 added
1+from . import _export_jinja2+3+_export_jinja("constants", globals())added:jinja2-compat/src/jinja2/debug.py+3 added
1+from . import _export_jinja2+3+_export_jinja("debug", globals())added:jinja2-compat/src/jinja2/defaults.py+3 added
1+from . import _export_jinja2+3+_export_jinja("defaults", globals())added:jinja2-compat/src/jinja2/environment.py+3 added
1+from . import _export_jinja2+3+_export_jinja("environment", globals())added:jinja2-compat/src/jinja2/exceptions.py+3 added
1+from . import _export_jinja2+3+_export_jinja("exceptions", globals())added:jinja2-compat/src/jinja2/ext.py+3 added
1+from . import _export_jinja2+3+_export_jinja("ext", globals())added:jinja2-compat/src/jinja2/filters.py+3 added
1+from . import _export_jinja2+3+_export_jinja("filters", globals())added:jinja2-compat/src/jinja2/idtracking.py+3 added
1+from . import _export_jinja2+3+_export_jinja("idtracking", globals())added:jinja2-compat/src/jinja2/lexer.py+3 added
1+from . import _export_jinja2+3+_export_jinja("lexer", globals())added:jinja2-compat/src/jinja2/loaders.py+3 added
1+from . import _export_jinja2+3+_export_jinja("loaders", globals())added:jinja2-compat/src/jinja2/meta.py+3 added
1+from . import _export_jinja2+3+_export_jinja("meta", globals())added:jinja2-compat/src/jinja2/nativetypes.py+3 added
1+from . import _export_jinja2+3+_export_jinja("nativetypes", globals())added:jinja2-compat/src/jinja2/nodes.py+3 added
1+from . import _export_jinja2+3+_export_jinja("nodes", globals())added:jinja2-compat/src/jinja2/optimizer.py+3 added
1+from . import _export_jinja2+3+_export_jinja("optimizer", globals())added:jinja2-compat/src/jinja2/parser.py+3 added
1+from . import _export_jinja2+3+_export_jinja("parser", globals())added:jinja2-compat/src/jinja2/runtime.py+3 added
1+from . import _export_jinja2+3+_export_jinja("runtime", globals())added:jinja2-compat/src/jinja2/sandbox.py+3 added
1+from . import _export_jinja2+3+_export_jinja("sandbox", globals())added:jinja2-compat/src/jinja2/tests.py+3 added
1+from . import _export_jinja2+3+_export_jinja("tests", globals())added:jinja2-compat/src/jinja2/utils.py+3 added
1+from . import _export_jinja2+3+_export_jinja("utils", globals())added:jinja2-compat/src/jinja2/visitor.py+3 added
1+from . import _export_jinja2+3+_export_jinja("visitor", globals())added:jinja2-compat/LICENSE.rst+28 added
1+Copyright 2007 Pallets2+3+Redistribution and use in source and binary forms, with or without4+modification, are permitted provided that the following conditions are5+met:6+7+1. Redistributions of source code must retain the above copyright8+ notice, this list of conditions and the following disclaimer.9+10+2. 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.13+14+3. 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.17+18+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A21+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED24+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR25+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF26+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING27+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS28+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.added:jinja2-compat/MANIFEST.in+1 added
1+global-exclude *.pycadded:jinja2-compat/README.rst+9 added
1+The Jinja2 package has been renamed to `Jinja`_. This package provides2+compatibility while projects transition to the new name. Imports from3+``jinja2`` will be redirected to ``jinja`` and a deprecation warning4+will be emitted.5+6+Projects are advised to require 'Jinja' instead of 'Jinja2' and replace7+all imports of ``jinja2`` with ``jinja`` to continue receiving updates.8+9+.. _Jinja: https://pypi.org/project/Jinja/added:jinja2-compat/setup.cfg+5 added
1+[metadata]2+license_file = LICENSE.rst3+4+[bdist_wheel]5+universal = trueadded:jinja2-compat/setup.py+53 added
1+import io2+3+from setuptools import find_packages4+from setuptools import setup5+6+with io.open("README.rst", "rt", encoding="utf8") as f:7+ readme = f.read()8+9+setup(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 lines39 from .utils import is_undefined40 from .utils import Markup41 from .utils import select_autoescape42 43-__version__ = "2.11.0.dev0"43+__version__ = "2.11.0rc1"modified:src/jinja/compiler.py+1 added-1 removed
710 unmodified lines711 def visit_Template(self, node, frame=None):712 assert frame is None, "no root frame allowed"713 eval_ctx = EvalContext(self.environment, self.name)714 715- from .runtime import __all__ as exported715+ from .runtime import exported716 717 self.writeline("from __future__ import %s" % ", ".join(code_features))718 self.writeline("from jinja.runtime import " + ", ".join(exported))719 1123 unmodified linesmodified:src/jinja/defaults.py-3 removed
40 unmodified lines41 "json.dumps_function": None,42 "json.dumps_kwargs": {"sort_keys": True},43 "ext.i18n.trimmed": False,44 }45-46-# 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 lines3 import sys4 from itertools import chain5 from types import MethodType6 7-from markupsafe import escape7+from markupsafe import escape # noqa: F4018 from markupsafe import Markup9 from markupsafe import soft_unicode10 11 from ._compat import abc4 unmodified lines16 from ._compat import PY217 from ._compat import string_types18 from ._compat import text_type19 from ._compat import with_metaclass20-from .exceptions import TemplateNotFound21-from .exceptions import TemplateRuntimeError20+from .exceptions import TemplateNotFound # noqa: F40121+from .exceptions import TemplateRuntimeError # noqa: F40122 from .exceptions import UndefinedError23 from .nodes import EvalContext24 from .utils import concat25 from .utils import evalcontextfunction26 from .utils import internalcode27 from .utils import missing28-from .utils import Namespace28+from .utils import Namespace # noqa: F40129 from .utils import object_type_repr30 31 # these variables are exported to the template runtime32-__all__ = [32+exported = [33 "LoopContext",34 "TemplateReference",35 "Macro",36 "Markup",975 unmodified linesmodified:tests/test_bytecode_cache.py+3 added-3 removed
7 unmodified lines8 from jinja.exceptions import TemplateNotFound9 10 11 @pytest.fixture12-def env(package_loader):13- bytecode_cache = FileSystemBytecodeCache()14- return Environment(loader=package_loader, bytecode_cache=bytecode_cache,)12+def env(package_loader, tmp_path):13+ bytecode_cache = FileSystemBytecodeCache(str(tmp_path))14+ return Environment(loader=package_loader, bytecode_cache=bytecode_cache)15 16 17 @pytest.mark.byte_code_cache18 class TestByteCodeCache(object):61 unmodified linesmodified:MANIFEST.in+1 added
3 unmodified lines4 prune docs/_build5 graft examples6 graft ext7 graft tests8+global-exclude *.pycmodified:setup.py+1 added-2 removed
18 unmodified lines19 "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 lines36 "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