Commit 230c51c
Migrate jinja to minijinja2 (#2025)
The `jinja` and `jinja-runtime` crates were migrated to use MiniJinja
2.x, addressing API changes and rendering differences.
Key changes include:
* **Dependency Update**: MiniJinja was upgraded from 1.0.16 to 2.10.2 in
`engine/Cargo.toml` and `engine/baml-lib/jinja/Cargo.toml`, with the
"serde" feature added to resolve deprecation warnings.
* **Object Trait Migration**:
* `StructObject` was replaced with the new `Object` trait across
`baml_value_to_jinja_value.rs`, `render_context.rs`, and `minijinja.rs`.
* The `call` method signature was updated to `self:
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Migrate from MiniJinja 1.x to 2.x, updating dependencies and adapting
to API changes, including replacing `StructObject` with `Object` trait
and updating method signatures.
>
> - **Dependency Update**:
> - Upgrade `minijinja` from 1.0.16 to 2.10.2 in `Cargo.toml` files.
> - Add `serde` feature to `minijinja` to resolve deprecation warnings.
> - **Object Trait Migration**:
> - Replace `StructObject` with `Object` trait in `minijinja.rs`,
`baml_value_to_jinja_value.rs`, and `render_context.rs`.
> - Update `call` method signatures to use `self: &Arc<Self>`.
> - Implement `render` method for `Object` trait in `minijinja.rs`,
`baml_value_to_jinja_value.rs`, and `output_format/mod.rs`.
> - **Code Adjustments**:
> - Handle `CallArg` variants in `expr.rs` and `pretty_print.rs`.
> - Update `parse_as_function_call` and `tracker_visit_expr` to handle
new `minijinja` AST structures.
> - Modify `evaluate_type` tests to align with new syntax in
`test_stmt.rs`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 0c832f2. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>1 parent 1b64d85 commit 230c51c
23 files changed
Lines changed: 399 additions & 218 deletions
File tree
- engine
- baml-lib
- baml-types/src
- jinja-runtime/src
- output_format
- jinja
- src
- evaluate_type
- integ-tests
- baml_src/test-files/functions
- input/named-args/single
- output
- go/baml_client
- python-v1/baml_client
- python/baml_client
- react/baml_client
- ruby/baml_client
- typescript-esm/baml_client
- typescript/baml_client
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
0 commit comments