pypi / minijinja
minijinja
What changed in minijinja 1 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
97 breaking3 security1 deprecations50 new APIs and options5 performance17 behavior and defaults5 tooling48 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initminijinja 3151 changes
Breaking changes 75
Booleans now compare, sort, and hash like 0 and 1 in Rust and Go.
Go filters including batch, slice, length, first, last, abs, items, split, and attr now fail on invalid values or arguments instead of silently accepting them, matching Rust.
Handling of none and undefined values now matches Jinja2 in Rust and Go.
Fuel now limits memory use and work inside filters and operators as well as instruction count, so templates consume more fuel and budgets might need adjusting.
Go maps can now be compared and sorted, and equality no longer rounds integers to floats.
Go behavior for in on strings, iterable addition, chain results, groupby groups, namespaces, unsigned 64-bit integers, and float literals now matches Rust.
Equal items now retain the first item rather than the last, matching Jinja2 in Rust and Go.
When multiple items are equal, max now returns the first rather than the last, matching Jinja2 in Rust and Go.
split(none, n) no longer returns trailing whitespace as an extra item.
In Go, operators and the string, safe, sum, and indent filters no longer accept undefined values under strict undefined behavior.
For maps created by templates, Value.Raw now returns a *value.Map.
An expression containing
}}followed by more input now returns a syntax error instead of panicking.Go float rendering now follows Rust-style shortest exact decimal formatting, with exponent notation only for specified magnitudes inside lists and maps; NaN and infinity spellings also change.
The format filter's
%snow formats floats like Python'sstr()in Rust and Go;0,+and space flags are ignored for floats and strings with%s.Go filters including sort, unique, select, reject, map, groupby, join, and urlencode, plus the iterable test, now treat none as an empty sequence like Rust.
Go's odd, even, and divisibleby tests now handle booleans and float divisors like Rust.
In pycompat, floats formatted without an explicit precision now retain Python-style
str()output instead of being cut to six significant digits.Go JSON output preserves floats as floats, uses exponent notation for large and small magnitudes, and renders infinity as null; JSON auto-escaping follows the same behavior.
Go's trim filter now converts non-string values to strings and strips Unicode whitespace by default, like Rust.
Go's upper, lower, capitalize, title, and replace filters now convert non-string values and replace arguments to strings before processing.
In Go, a none argument to the float filter now counts as not given, matching Rust.
In Go, a none argument to the int filter now counts as not given, matching Rust.
In Go, integer exponentiation is exact up to 128 bits and fails beyond that; float bases stay floats and booleans count as integers.
In Go, join now fails on unknown keyword arguments instead of ignoring them.
In Rust, whitespace-only entries in an attribute list no longer sort by an empty attribute.
When sorting by several attributes in Rust and Go, each key part is compared case-insensitively unless case_sensitive is set.
In pycompat, find returns character offsets rather than byte offsets, matching Python.
In pycompat, string predicates now return false for an empty string, matching Python.
In pycompat, rfind returns character offsets rather than byte offsets, matching Python.
In Go, sum now fails on unknown keyword arguments instead of ignoring them.
In Go, the first positional argument is now the attribute rather than the start value, so a start value must be passed as start=.
A number immediately after a dot is read as an item index, so chained lookups such as
foo.1.0work asfoo[1][0].Integers are rounded when precision is negative, matching Jinja2; for example,
15|round(-1)produces20.Go now produces code points for
\xand octal escapes above\x7f, supports\b,\f, and surrogate pairs, and rejects lone surrogates.Exceptions raised by a loader are no longer treated as missing templates or ignored by
ignore missingand include template lists.Names starting with an underscore are private and no longer exported from imported templates or returned by State::exports / State.Exports, though lookup can still retrieve them.
In Go, the filter now rejects undefined values with strict undefined behavior like in Rust.
In Go, the filter now rejects undefined values with strict undefined behavior like in Rust.
The filter compares strings case-insensitively by default and accepts the case_sensitive and attribute arguments for Jinja2 compatibility in Rust and Go.
In Go, whitespace control, lstrip_blocks and end of line statements now handle all Unicode whitespace rather than only ASCII whitespace.
AutoEscape::Custom now holds Cow<'static, str>, allowing custom auto escape formats to be determined at runtime; AutoEscape is no longer Copy.
Automatic reloading of individual templates is built in and enabled by default; loaders can return TemplateSource with an up-to-date check.
The custom_syntax feature was removed; custom delimiters, line statements and line comments are now always available.
The dist/bundler package path is gone.
The dist/node package path is gone.
The dist/web package path is gone.
Division by zero now produces an error.
The loader is now generic over its returned source, which may be a String or TemplateSource; some closures need an explicit return type.
The CLI no longer supports Fig completions.
Floor division now follows Jinja2 semantics.
The format filter moved to the formatting module and was renamed from format_filter.
Rendering APIs, context! and args! now consume values and convert exclusively through Into<Value>.
The json feature no longer depends on serde or serde_json; JSON output uses a built-in serializer and invalid values now fail serialization.
Building the Python bindings now requires maturin 1.9.4 or later.
The npm package is now an ES module with a single wasm build and exports map; Node.js loads wasm synchronously while browsers and other listed runtimes use top-level await.
The modulo operator now follows Jinja2 semantics.
The Python bindings now require Python 3.10 or later.
Templates accessing Python data typically render 3 to 10 times faster; renders no longer release the GIL, and free-threaded Python renders scale with the number of threads.
Typed render-local extensions can persist through includes, blocks and macros.
The round filter now uses round-half-even semantics and fixes decimal rounding edge cases.
The sequence test now classifies undefined values as sequences.
Serde is now optional and disabled by default; enable the feature to use Serde conversion, which is requested explicitly with value::Serde.
Mutable State is now the canonical path for callbacks and nested macro calls; state mutation and dynamic calls require &mut State.
This method was removed in favor of typed render-local extensions.
Custom date/time formats now use strftime-style syntax instead of time format descriptions.
trim_blocks, lstrip_blocks and keep_trailing_newline settings moved from Environment into SyntaxConfig.
This deprecated Rust API was removed in MiniJinja 3.
This deprecated Rust API was removed in MiniJinja 3.
This deprecated Rust API was removed in MiniJinja 3.
JavaScript errors are now raised as TemplateError with kind, detail, templateName, line, range and templateSource properties.
The title filter now starts words after whitespace or selected punctuation, matching Jinja2; for example, don't renders as Don't.
Construct a Value from pairs; collecting pairs directly into Value now creates a sequence of tuples rather than a map.
This API was removed; use the new explicit Serde conversion mechanism when Serde support is enabled.
Wrap values with value::Serde to request Serde conversion; it also replaces ViaDeserialize for deserializing function arguments.
Variadic functions that intentionally capture keyword arguments can use ValueOrKwargs; Value function arguments no longer accept implicit keyword-argument values.
Security 1
Combining strings with
~and+no longer double-escapes safe strings or leaves unsafe strings unescaped when auto escaping is enabled.
New APIs and options 28
The Rust replace filter accepts a count argument for Jinja2 compatibility.
Rust custom filters and functions can charge fuel through this new state method.
Go custom filters and functions can charge fuel through this new state method.
Rust can map rendered output back to the template source with this new rendering method.
Go can map rendered output back to the template source with this new rendering method.
Go introduces value.Map for maps that preserve key types and insertion order.
The join separator can also be passed using the d argument.
The sum filter adds attribute and start arguments for Jinja2 compatibility in Rust and Go; arguments can be positional or keyword.
The filter accepts
methodvaluescommon(default),ceil, orfloor;precisionandmethodcan both be passed as keyword arguments.The filter accepts a default argument for Jinja2 compatibility in Rust and Go; a supplied default is returned for values that cannot be converted and for none.
The filter accepts default and base arguments for Jinja2 compatibility in Rust and Go; a supplied default is returned for values that cannot be converted and for none.
The JavaScript bindings add addFunction and other APIs for functions, filters, tests, auto escaping, finalization and template introspection.
Use this method to disable built-in automatic template reloading.
Set a seed source for random functions on platforms without a source of randomness.
An optional JavaScript date/time module provides datetimeformat, dateformat, timeformat and now() using native runtime time zone support.
This entry point allows initializing the JavaScript module manually.
The JavaScript bindings add the pycompat property.
The JavaScript bindings enable the rand contrib feature, providing random, randrange and lipsum seeded from Math.random.
The JavaScript bindings add removeFilter to remove a filter.
The JavaScript bindings add removeTest to remove a test.
The context argument is now optional for renderStr, renderTemplate, renderNamedStr and evalExpr.
SafeString marks strings that should not be auto escaped; callbacks can receive and return them to bypass auto escaping.
JavaScript callbacks wrapped with passState receive a State object to look up variables, inspect template and auto escape state, and apply filters and tests.
The JavaScript bindings add a syntax property for custom delimiters and line statements.
Use to_builder to modify an existing SyntaxConfig.
Tuple literals and public tuple value types are supported; tuples preserve their type through serialization and sequence operations and render like Python tuples.
In debug mode, undefined values remember where they were created, and related errors report the expression that produced them and its origin when elsewhere.
Use ValueIter::checked to report errors when iterators yield invalid values, matching the new consistent iteration behavior.
Performance 3
String concatenation performance improved.
String slicing performance improved.
The title filter's performance improved, and its final sigma, titlecase, and special case mappings are fixed.
Behavior and default changes 12
Compile-time constant folding no longer creates strings or sequences larger than 1KB.
minijinja-contrib datetime filters fall back to jiff's bundled time zone database when a name is missing from the system database.
The Go float filter now supports integers outside the 64-bit range.
The Go int filter now supports integers outside the 64-bit range.
Go arithmetic and comparisons now support integers outside the 64-bit range.
The Go round filter now supports integers outside the 64-bit range.
Go tojson now supports integers outside the 64-bit range.
Value.AsMap returns a copy with map keys converted to strings.
Go iterables now support slicing and membership checks and behave like lists when printed, compared, serialized, or pretty-printed;
inalso supports custom sequence, iterable, and map objects.Go filters now treat undefined as an empty sequence in lenient mode; strict and semi-strict undefined behavior still fails except for join and groupby. None is also handled as empty by batch, selectattr, and rejectattr.
In Rust, sum can concatenate lists when given a list as its start value.
Templates reload through a shared reference, so the environment no longer needs to be recreated or guarded by a lock.
Tooling 1
The Python package is published with free-threaded Linux, macOS, and Windows wheels for CPython 3.14t and CPython 3.15+.
Fixes and other changes 31
The even test is fixed for big integers and floats with an integer value.
Fixed integer arithmetic at the specified 128-bit boundaries and divisibleby with a zero divisor in Rust and Go.
Handling of none and undefined values now matches Jinja2; last also works on maps.
Loop calls now behave correctly in included templates, blocks, and macros.
The odd test is fixed for big integers and floats with an integer value.
Handling of none and undefined values now matches Jinja2, and maps and other reversible iterables are reversed correctly.
Negative-step slicing no longer panics on empty values and returns correct items for the affected bounds.
Repeating strings or sequences a negative number of times now produces an empty result, and repeating safe strings preserves their safety.
Calling super at the top level of an included template no longer panics.
Errors while writing an interpolated value now point to the whole expression.
Final sigma, titlecase, and special case mappings are fixed in the case-conversion filters.
Sequence filters, slicing, and concatenation cap preallocation, preventing panics or aborts on huge size hints or counts.
In Go, booleans can be used as integers in arithmetic and for repeating strings and sequences, matching Rust and Jinja2.
Integer addition in Go is exact above 2**53, and results that do not fit 64 bits become big integers.
Integer subtraction in Go is exact above 2**53, and results that do not fit 64 bits become big integers.
Integer multiplication in Go is exact above 2**53, and results that do not fit 64 bits become big integers.
Rust now accepts negative integer exponents, while zero to a negative power fails in Rust and Go like division by zero.
In Go, a non-string join separator is converted to a string instead of being dropped.
In Go, a none argument to the round filter now counts as not given, matching Rust.
In Go, the sort filter now honors comma-separated attribute lists and sorts by each listed attribute in order.
In pycompat, counting an empty string no longer loops forever and now matches Python, returning 4 for 'abc'.count('').
In pycompat, uncased characters no longer cause false results; the predicate follows Python behavior.
Modules imported with
{% import %}are now iterable in Go.With
blankfalse, the filter no longer indents blank lines in CRLF text or leaves trailing whitespace.Exceptions not reported by one render no longer leak into later renders and replace an unrelated error.
break_long_wordsis now independent ofbreak_on_hyphens; long words are broken unlessbreak_long_wordsis false.The Go filter now uses keyword arguments, passed as a trailing mapping, to fill %(name)s specs like in Rust.
The Python package is now published as Pyodide wheels for Pyodide 0.29 and 314, so it can be installed with micropip.
Syntax errors about unexpected characters now show the character rather than its first byte.
pass_state now works on methods invoked from templates.
Corrected the spelling of the JavaScript undefined behavior value from semi_strct to semi_strict.
minijinja 251 changes
Breaking changes 7
String repetition is limited to 100 MB in Rust and Go to prevent excessive memory allocations.
None and boolean values now render as None, True, and False for Jinja2 compatibility in Rust and Go.
In strict undefined mode, explicitly passing an undefined fallback argument now errors instead of being treated like a missing argument.
Comparison operators, string concatenation, and undefined needles in the in operator now behave more like Jinja2 in strict undefined mode.
String-coercing filter and function arguments now fail for nested Rest<String> and Vec<String> conversions under strict and semi-strict undefined handling.
The non-Rust
keysfilter was removed from the Go port for parity.The non-Rust
valuesfilter was removed from the Go port for parity.
Security 2
Safety handling now preserves safe strings and escapes unsafe fragments in Rust and Go.
Ownership and pointer-safety issues that could leak
mj_valuevalues on error paths were fixed.
Deprecations 1
Deprecated in favor of the new
render_captured/render_captured_to/CapturedAPI.
New APIs and options 15
The
wordwrapfilter is now available in the Python bindings.Added StringInput for custom Rust filters and functions that transform strings while preserving safety provenance.
Rust and Go support Jinja-style required blocks, including scoped required parsing compatibility and validation that required blocks contain only whitespace or comments.
The filter accepts the width, first, and blank keyword arguments for Jinja2 compatibility in Rust and Go.
Added on
Capturedto consume the captured value and return the output string.High-priority APIs were added for callback-based functions, filters, and tests; globals; loaders; path joining; auto-escape configuration; and fuel limits.
Added on
Template; returns aCapturedvalue holding the rendered output and template state.Adds the 'c' character format type for format filters and str.format-style formatting.
A Go language port is now available.
The pycompat
map.get()method accepts an optional default argument.Added a format filter for pycompat.
Added setLoader to the JavaScript bindings.
Added setPathJoinCallback to the JavaScript bindings.
The sort filter now supports sorting by multiple keys.
Added the str.format method for pycompat.
Performance 2
Improved performance of iteration over map items.
Performance improved across template parsing, compilation, and rendering.
Behavior and default changes 4
Rust and Go support chained comparisons such as
a < b < c, matching Jinja/Python semantics.Filter and test names may be dotted, including forms such as
foo . bar . baz, for Jinja compatibility.Rust and Go support dotted integer lookup such as
foo.0for Jinja compatibility.Added support for free threading Python.
Tooling 4
Adds a prebuilt minijinja-cli release target for Windows ARM64.
Adds a prebuilt minijinja-cli release target for ARMv7 Linux.
Python release artifacts now include musllinux wheel builds, giving developers a wheel option for musl-based environments.
Added the PEP 561 typing marker for Python bindings, enabling typing support.
Fixes and other changes 16
Conditional expressions in keyword argument values now work compatibly with Jinja2 in Rust and Go.
Sorting keys in
context!is fixed when thepreserve_orderfeature is enabled.Fixed Unicode identifiers in templates rendered through the Python bindings.
Loop-local assignments no longer leak into subsequent iterations in Rust and Go.
Python-compatible dict methods are no longer shadowed by same-named map keys.
The filter now returns a sequence, enabling negative indexing and slicing in Rust and Go.
Fixed a panic when comparing numbers that have no common lossless representation, such as a float against an integer that cannot be represented exactly as f64.
Fixed a stack overflow caused by repeated sequence concatenation.
Fixed integer lookup in the middle of attribute chains, such as
foo.0.bar, for Jinja compatibility.Compilation succeeds with
multi_templatedisabled by gating block-only APIs behind the feature.Unknown string escapes such as
\sare preserved for Jinja compatibility in Rust and Go.The
escapefilter now honors custom formatters.Undefined behavior handling in the Go port now aligns with Rust.
Fixed the missing undefined mapping in Python bindings.
Stability guarantees for the
|sortfilter are fixed when usingreverse=true.Fixed
not undefinedwhen strict undefined behavior is enabled.
minijinja 124 changes
Breaking changes 15
Some APIs using Arc<String> now use Arc<str>; StructObject::fields returns Arc<str>, and conversions only support Arc<str>.
Removed; use the loader feature's set_loader API instead.
Removed along with the source API; the loader feature provides replacement APIs.
Removed because the from_args function now provides the same functionality.
The new loader feature adds APIs for loading templates.
Removed without replacement because it exposed an implementation detail.
Provides the functionality previously available via Source::from_path.
Added by the loader feature as the replacement for setting a Source.
The Source type was removed; loader APIs replace its functionality.
The source feature was removed and replaced by the loader feature.
Removed without replacement because the information was unreliably maintained and caused issues with recursive calls.
State now provides render_block_to_write after evaluating or rendering a template to state.
The API moved to State returned by eval_to_state or render_and_return_state.
The testutils feature was removed; callers can create an empty State and use its methods to invoke filters.
The testutils module was removed; use methods on an empty State instead.
New APIs and options 7
Added by the loader feature for adding owned templates.
The function now provides Kwargs::from_args functionality, including splitting arguments and parsing values.
The autoreload crate supports fast reloading by clearing already loaded templates, enabled via this Notifier method.
An empty State can now be used to invoke filters through apply_filter.
An empty State can now be used to format values.
An empty State can now be used to perform tests through perform_test.
State now provides render_block after evaluating or rendering a template to state.
Behavior and default changes 1
The JSON formatter recognizes json5 as a file extension.
Fixes and other changes 1
Filters support unicode sorting when the unicode feature is enabled, also fixing confusing behavior when mixed types were sorted.