Minijinja

Latest version: v2.7.0

Safety actively analyzes 702116 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 15

1.0.5

- Added the ability to merge multiple values with the `context!`
macro. (317)
- `Option<T>` now accepts `none` in filters. Previously only
undefined values were accepted. This bugfix might have a minor impact
on code that relied in this behavior. (320)
- Fix a compilation error for `minijinja-contrib` if the `timezone`
feature is not enabled.

1.0.4

- Added the `args!` macro which can be used to create an argument
slice on the stack. (311)
- Improved error reporting for missing keyword arguments.
- Added `chrono` support to the time filters in the `minijinja-contrib` crate.

1.0.3

- Republished `1.0.2` with fixed docs.

1.0.2

- Added `TryFrom` and `ArgType` for `Arc<str>`.
- Added `datetimeformat`, `dateformat`, `timeformat` and `now()` to the
contrib crate. (309)

1.0.1

- Fixed a bug that caused `{% raw %}` blocks to accidentally not skip the
surrounding tags, causing `{% raw %}` and `{% endraw %}` to show up in
output. (307)

1.0

some minor exceptions be rather trivial changes.

- `Environment::source`, `Environment::set_source` and the `Source` type
together with the `source` feature were removed. The replacement is the
new `loader` feature which adds the `add_template_owned` and `set_loader`
APIs. The functionality previously provided by `Source::from_path` is
now available via `path_loader`.

Old:

rust
let mut source = Source::with_loader(|name| ...);
source.add_template("foo", "...").unwrap();
let mut env = Environment::new();
env.set_source(source);


New:

rust
let mut env = Environment::new();
env.set_loader(|name| ...);
env.add_template_owned("foo", "...").unwrap();


Old:

rust
let mut env = Environment::new();
env.set_source(Source::from_path("templates"));


New:

rust
let mut env = Environment::new();
env.set_loader(path_loader("templates"));


- `Template::render_block` and `Template::render_block_to_write` were
replaced with APIs of the same name on the `State` returned by
`Template::eval_to_state` or `Template::render_and_return_state`:

Old:

rust
let rv = tmpl.render_block("name", ctx)?;


New:

rust
let rv = tmpl.eval_to_state(ctx)?.render_block("name")?;


- `Kwargs::from_args` was removed as API as it's no longer necessary since
the `from_args` function now provides the same functionality:

Before:

rust
// just split
let (args, kwargs) = Kwargs::from_args(values);

// split and parse
let (args, kwargs) = Kwargs::from_args(values);
let (a, b): (i32, i32) = from_args(args)?;


After:

rust
// just split
let (args, kwargs): (&[Value], Kwargs) = from_args(values)?;

// split and parse
let (a, b, kwargs): (i32, i32, Kwargs) = from_args(values)?;


- The `testutils` feature and `testutils` module were removed. Instead you
can now directly create an empty `State` and use the methods provided
to invoke filters.

Before:

rust
let env = Environment::new();
let rv = apply_filter(&env, "upper", &["hello world".into()]).unwrap();


After:

rust
let env = Environment::new();
let rv = env.empty_state().apply_filter("upper", &["hello world".into()]).unwrap();


Before:

rust
let env = Environment::new();
let rv = perform_test(&env, "even", &[42.into()]).unwrap();


After:

rust
let env = Environment::new();
let rv = env.empty_state().perform_test("even", &[42.into()]).unwrap();


Before:

rust
let env = Environment::new();
let rv = format(&env, 42.into()).unwrap();


After:

rust
let env = Environment::new();
let rv = env.empty_state().format(42.into()).unwrap();


- `intern` and some APIs that use `Arc<String>` now use `Arc<str>`. This
means that for instance `StructObject::fields` returns `Arc<str>` instead
of `Arc<String>`. All the type conversions that previously accepted
`Arc<String>` now only support `Arc<str>`.

- `State::current_call` was removed without replacement. This information
was unreliably maintained in the engine and caused issues with recursive
calls. If you have a need for this API please reach out on the issue
tracker.

- `Output::is_discarding` was removed without replacement. This is
an implementation detail and was unintentionally exposed. You should not
write code that depends on the internal state of the `Output`.

Page 6 of 15

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.