apache / apache/airflow

Consider supporting .jinja2 extensions across the project

Open
#8,603 12 comments 1 reaction 1 assignee Assigned to @uranusjr View on GitHub
area:core kind:feature
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 9h
Merged PRs (30d)
472

Description

**Description**

At the moment, various operators support reading templates from given filenames (for example, [bash_command](https://airflow.apache.org/docs/stable/_api/airflow/operators/bash_operator/index.html#airflow.operators.bash_operator.BashOperator) 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](https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml).
1. Putting templates inside `.jinja2` can help distinguish between regular files and template files just by looking at the directory contents
1. 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.