feat: integrate minijinja for tasks' command's rendering#3579
feat: integrate minijinja for tasks' command's rendering#3579ruben-arts merged 44 commits intoprefix-dev:mainfrom
Conversation
|
The problem with I see two options:
|
|
That is unfortunate. Trading arithmetic operations for dashes in identifiers is a bad deal for us. It also sucks since we go for kebab-case in all other parts of the manifest. I think we still want to go with the current approach. Templating makes sense for our use case and using minijinja will open the door for more functionality like boolean, integer or list variables. Other Rust template crates seem to have the same limitation. Personally, I prefer a third option next to @wolfv's suggestions: error on identifiers with a dash in them. This should make it easy to give good error messages and minimize user confusion. |
Hofer-Julian
left a comment
There was a problem hiding this comment.
I've added a few comments.
Let's also error for variables with a dash in them
Hofer-Julian
left a comment
There was a problem hiding this comment.
Looks like a good first step.
After the comments are addressed, and the rest of the functionality is implemented let's remember to also extend the tests a bit.
- Add a snapshot test for the error message if args with a dash in them like
python-fileare used - Add a test that uses a minijinja filter, let's try if
titleworks as expected for example: https://docs.rs/minijinja/latest/minijinja/filters/fn.title.html
|
Looks good @prsabahrami! The tests still need to be updated or there other things missing as well? :) |
|
I pushed a few small improvements to your branch |
|
Remaining tasks:
|
ruben-arts
left a comment
There was a problem hiding this comment.
I reviewed it as a first time user, I was mostly missing examples and a little more documentation on the logic that happens when I define these minijinja things.
I would also like to see more integration level tests to make sure we have a good set of cases that we assure keep working.
This feature feels like a cool first step, the variables and custom functions like being able to reuse global defined variables, being able to get the platform from pixi, being able to use env variables would make this a very useful feature!
Co-authored-by: Ruben Arts <ruben@prefix.dev>
ruben-arts
left a comment
There was a problem hiding this comment.
Really promising feature!
Hofer-Julian
left a comment
There was a problem hiding this comment.
Awesome work @prsabahrami, this will enable a lot of exciting use cases in the future 🪄
This replaces the use of regex with minijnja in order to support template rendering.
I'm not fully confident or in favour of the current design for error handling. So, I'd appreciate it if you could give some feedback on the error handling @Hofer-Julian.
Also, one of the tests are failing because minijinja automatically thinks of
{{ python-file }}as a subtraction. I was not able to find the config to play with this. Do you know how to tell minijinja to skip this?