question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider supporting .jinja2 extensions across the project

See original GitHub issue

Description

At the moment, various operators support reading templates from given filenames (for example, bash_command of BashOperator). However, all of these operators specify extensions such as .sh, .json etc., so it means users need to write Jinja2 templates inside .sh, .json files. A better way to do it would be supporting the .jinja2 extension.

Use case / motivation

The motivation is threefold:

  1. .jinja2 extension is a widespread convention which is supported by various editors, including Github itself, PyCharm and VSCode.
  2. Putting templates inside .jinja2 can help distinguish between regular files and template files just by looking at the directory contents
  3. Working with tools that recognize .jinja2 templates can help reduce errors while authoring templates.

Related Issues

https://github.com/apache/airflow/pull/8572#discussion_r416473395

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kaxilcommented, May 6, 2021

@kaxil this issue should be resolved by #14603 correct?

No, actually this is a bit different i.e. the OP wants to allow using “file.jinja2” instead of “file.bash” or “file.sql” in rendered template fields.

0reactions
eladkalcommented, May 5, 2021

@kaxil this issue should be resolved by https://github.com/apache/airflow/pull/14603 correct?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consider supporting .jinja2 extensions across the project ... - Re
Re: Consider supporting .jinja2 extensions across the project ... I built the code so it can easily accommodate other Jinja extensions if needed....
Read more >
Extensions — Jinja Documentation (3.0.x)
Jinja supports extensions that can add extra filters, tests, globals or even extend the parser. The main motivation of extensions is to move...
Read more >
Jinja extensions (like Django template library tags)
How to use and create Jinja extensions in Django projects. ... This is all that's necessary to enable a Jinja extension across all...
Read more >
Visual Studio Code and Jinja templates - Stack Overflow
This helps if you just want to limit the use of Unibeautify to just Jinja files on a project by project basis. I...
Read more >
Jinja2 Template Extensions - YouTube
How to use base templates and template extensions in Jinja2 This educational video was created for use in LaunchCode's in-person training ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found