jinja
jinja copied to clipboard
Render time only filter decorator
Added the @render_time_only
decorator for filters and tests. It marks filters to not be resolved at compile time even if the arguments are constants. This can be useful as described in #1752 for time or memory intensive filters and tests, filters with global counting variables and changing global states, or filters that cause external actions such as printing, file operations or server requests.
The feature is tested by a new pytest, documented in changelog and the API documentation, passes pytest and tox (with a small tweak because mypy doesn't register set attributes).
Relating to issue #1752, @davidism can you review this MR ? The checks are good, the changelog and documentation are also aligned. Thanks