Skip to content

Feature: Use Jinja's new NativeEnvironment to get native types instead of strings! #3828

Description

@cognifloyd

It's really hard to deal with magically converting from Jinja strings back into native python types. Let's just skip the conversion and use native python types.

How you ask? Jinja has merged a pretty cool PR: pallets/jinja#708
Here's a quote from the new doc:

The default jinja2.Environment renders templates to strings. With NativeEnvironment, rendering a template produces a native Python type.

This consists of three basic parts: NativeCodeGenerator, NativeTemplate, and NativeEnvironment. Check out the code. This will land in Jinja 2.10.

This comes from an ansible PR by @jctanner: ansible/ansible#23943

I suspect that using NativeEnvironment would resolve (or make a big dent in) these:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions