feat(minijinja): migrate litestar.contrib.minijinja to litestar.plugins.minijinja#4760
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4760 +/- ##
==========================================
- Coverage 67.42% 67.41% -0.01%
==========================================
Files 292 292
Lines 15019 15018 -1
Branches 1686 1686
==========================================
- Hits 10127 10125 -2
- Misses 4756 4757 +1
Partials 136 136 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cofin
force-pushed
the
feat/minijinja-plugin
branch
from
May 10, 2026 14:23
2711260 to
a68c278
Compare
cofin
enabled auto-merge (squash)
May 10, 2026 14:24
provinzkraut
approved these changes
May 10, 2026
Add the MiniJinja template engine integration as a flat module under litestar.plugins (peer of htmx.py / flash.py / attrs.py). Drops the contrib framing and the `from __future__ import annotations` import in line with project conventions for new plugin modules. Preserves the module-level `_transform_state` helper at the new path so the lazy import inside `litestar.plugins.flash` can be migrated to the plugin namespace without behavior change. This is the main-side half of the 2-PR deprecation pattern; a follow-up v2 PR will add the deprecation shim at litestar.contrib.minijinja covering both public symbols and `_transform_state`. Co-authored-by: xronocode <myevdokimov@gmail.com>
…contrib path - Migrate every internal call site (tests, doc examples, the lazy import inside `litestar.plugins.flash`) to `from litestar.plugins.minijinja import ...`. The flash.py change preserves the public/private split: it still imports both `MiniJinjaTemplateEngine` and the module-level `_transform_state` helper. - Delete `litestar/contrib/minijinja.py`. The contrib path is gone on main; the v2 follow-up PR adds a deprecation shim at the contrib location covering both public symbols and `_transform_state`, so 2.x users (whose flash.py still imports from contrib) get a `DeprecationWarning` window with a real migration target on the version they are already running. - Salvage the contrib functional tests into `tests/unit/test_plugins/test_minijinja.py` (99% line coverage on the new module) and delete `tests/unit/test_contrib/test_minijinja.py`. - Add `docs/reference/plugins/minijinja.rst`; update the plugins reference toctree. Co-authored-by: xronocode <myevdokimov@gmail.com>
cofin
force-pushed
the
feat/minijinja-plugin
branch
from
May 11, 2026 15:25
a68c278 to
491799a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the MiniJinja template engine integration from
litestar.contrib.minijinjatolitestar.plugins.minijinja, and removes the contrib path onmain. A follow-up PR ontov2will add a deprecation shim covering both public and private symbols. Same shape as the OTel split (#4691 + #4759) and the repository split (#4735 + #4758).litestar/plugins/flash.pylazily imports the private_transform_statefrom MiniJinja, so any deprecation shim has to forward private symbols. That diagnosis came from @xronocode's audit in #4754; this PR preserves it by migrating flash.py before deleting contrib, so every intermediate commit keeps the dependency graph valid.Salvages the contrib tests into
tests/unit/test_plugins/test_minijinja.py(98% coverage), migrates every internal call site, and addsdocs/reference/plugins/minijinja.rst.Closes #4718.
📚 Documentation preview 📚: https://litestar-org.github.io/litestar-docs-preview/4760