Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
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. This is problematic

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ash Berlin-Taylor
Are you also proposing that, for example .sh would not be templated, but that .sh.jinja2 would be templated? Ash On 29 April 2020 11:39:13 BST, Ori Popowski wrote: >At the moment, various operators support reading templates from given >filenames (for example, `bash_command` of `BashOperator`).

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
No. Any extension mentioned in `template_ext` will still be templated. But in addition, also those ending with `.jinja2`, as long it's preceded by one of those extensions (meaning that `file.jinja2` won't be templated) On Wed, Apr 29, 2020 at 1:41 PM Ash Berlin-Taylor wrote: > Are you also propo

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Kaxil Naik
Somewhat off-topic: What's the plugin for Pycharm/Intellij that supports Syntax highlighting for Jinja2 templates ? On Wed, Apr 29, 2020 at 12:17 PM Ori Popowski wrote: > No. Any extension mentioned in `template_ext` will still be templated. But > in addition, also those ending with `.jinja2`, a

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
In my PyCharm version, it came out-of-the-box with the syntax highlighting On Wed, Apr 29, 2020 at 2:20 PM Kaxil Naik wrote: > Somewhat off-topic: What's the plugin for Pycharm/Intellij that supports > Syntax highlighting for Jinja2 templates ? > > On Wed, Apr 29, 2020 at 12:17 PM Ori Popowski

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
I'm trying to attach a screenshot [image: image.png] On Wed, Apr 29, 2020 at 2:20 PM Kaxil Naik wrote: > Somewhat off-topic: What's the plugin for Pycharm/Intellij that supports > Syntax highlighting for Jinja2 templates ? > > On Wed, Apr 29, 2020 at 12:17 PM Ori Popowski wrote: > >> No. Any

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Kaxil Naik
Looks like it is only available in Pycharm Professional Edition :) Thanks Regards, Kaxil On Wed, Apr 29, 2020 at 12:30 PM Ori Popowski wrote: > I'm trying to attach a screenshot > > [image: image.png] > > > On Wed, Apr 29, 2020 at 2:20 PM Kaxil Naik wrote: > >> Somewhat off-topic: What's the

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ash Berlin-Taylor
We could do this globally for 1.10, but for 2.0 I think it might be nice to change this as follows: Rename template_ext to file_exts, and it looks for files with those extensions, but doesn't render them. And then make it only render files with, for example, .sh.jinja2. Right now it's impossible

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Kaxil Naik
Yea I like that plan. Curious to hear what other users think? On Wed, Apr 29, 2020 at 12:33 PM Ash Berlin-Taylor wrote: > We could do this globally for 1.10, but for 2.0 I think it might be nice > to change this as follows: > > Rename template_ext to file_exts, and it looks for files with those

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
@ash I agree that in 2.0 it will be much better to _not_ render files not ending with .jinja2, and to render only .jinja2 files. It's much more intuitive, since it can be quite confusing for a dev to see regular files being rendered. On Wed, Apr 29, 2020 at 2:33 PM Ash Berlin-Taylor wrote: > We

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Xinbin Huang
I like the idea of rendering files with .jinja2 extensions, and we can extend it a bit to some variations that are generally recognized by Plugins, e.g. .jinja, .j2. For VSCode, the plugin I use is Better Jinja . Best Bi

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ori Popowski
I built the code so it can easily accommodate other Jinja extensions if needed. When this issue consolidates they can be added to the source code and it will work automatically (although at the moment it's only .jinja2) On Wed, Apr 29, 2020 at 7:01 PM Xinbin Huang wrote: > I like the idea of ren

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Kaxil Naik
Yea it can (and should) be a configurable value with `.jinja2` & `.j2` as the default. On Wed, Apr 29, 2020 at 5:06 PM Ori Popowski wrote: > I built the code so it can easily accommodate other Jinja extensions if > needed. > When this issue consolidates they can be added to the source code and i

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Edgar Ramírez
+1 I like the idea. Setting `template_ext=['.sh']` in an operator class would mean rendering both `.sh` and `.sh.jinja2` (and possibly `.j2`) files. On Wed, Apr 29, 2020 at 5:39 AM Ori Popowski wrote: > At the moment, various operators support reading templates from given > filenames (for exampl

Re: Consider supporting .jinja2 extensions across the project

2020-04-29 Thread Ash Berlin-Taylor
We're now walking about making it read but NOT render .sh, and only render .sh.jinja2 etc. (See the other messages in this thread) -ash On Apr 30 2020, at 12:16 am, Edgar Ramírez wrote: > +1 I like the idea. Setting `template_ext=['.sh']` in an operator class > would mean rendering both `.sh`