sphinx-jinja2-compat, current version 0.4.1, is a utility library designed to patch Jinja2 v3, restoring compatibility with earlier Sphinx versions. It also addresses issues to ensure some Sphinx versions function correctly on Python 3.10. This library primarily serves as a compatibility layer to bridge gaps between major versions of its dependencies, rather than providing new user-facing features. Releases are made on an as-needed basis to address specific compatibility challenges.
pip install sphinx-jinja2-compatNo compatibility data collected yet for this library.
Installation of `sphinx-jinja2-compat` is typically sufficient; it works by applying patches on import of relevant modules within Sphinx, rather than requiring explicit inclusion in `conf.py`'s `extensions` list. The primary effect is restoring compatibility for older Sphinx versions with Jinja2 v3 and ensuring Python 3.10 compatibility for certain Sphinx versions. The patches can be disabled by setting the environment variable `NO_SPHINX_JINJA2_COMPAT` to `1`.
No fix needed; this is its intended mode of operation. Do not attempt to import `sphinx_jinja2_compat` into your `conf.py` or Python code for direct functionality.
Test your Sphinx build thoroughly after installation. If issues arise, consider temporarily disabling the patches by setting the environment variable `NO_SPHINX_JINJA2_COMPAT=1` to isolate the problem. Adjust custom code to be compatible with the patched Jinja2 behavior if necessary.
To disable the patches, ensure `os.environ['NO_SPHINX_JINJA2_COMPAT'] = '1'` is set in your build environment or a script wrapper before Sphinx execution. To re-enable, remove or unset the variable.