Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: minijinja import too early on FlashPlugin #3415

Closed
1 of 4 tasks
euri10 opened this issue Apr 22, 2024 · 2 comments · Fixed by #3418
Closed
1 of 4 tasks

Bug: minijinja import too early on FlashPlugin #3415

euri10 opened this issue Apr 22, 2024 · 2 comments · Fixed by #3418
Labels
Bug 🐛 This is something that is not working as expected

Comments

@euri10
Copy link
Contributor

euri10 commented Apr 22, 2024

Description

error is:

❯ python main.py
Traceback (most recent call last):
  File "/home/lotso/.cache/pypoetry/virtualenvs/tt-n-gxmD69-py3.12/lib/python3.12/site-packages/litestar/contrib/minijinja.py", line 21, in <module>
    from minijinja import Environment  # type:ignore[import-untyped]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'minijinja'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lotso/toto/tt/main.py", line 2, in <module>
    from litestar.plugins.flash import FlashPlugin
  File "/home/lotso/.cache/pypoetry/virtualenvs/tt-n-gxmD69-py3.12/lib/python3.12/site-packages/litestar/plugins/flash.py", line 8, in <module>
    from litestar.contrib.minijinja import MiniJinjaTemplateEngine
  File "/home/lotso/.cache/pypoetry/virtualenvs/tt-n-gxmD69-py3.12/lib/python3.12/site-packages/litestar/contrib/minijinja.py", line 24, in <module>
    raise MissingDependencyException("minijinja") from e
litestar.exceptions.base_exceptions.MissingDependencyException: Package 'minijinja' is not installed but required. You can install it by running 'pip install litestar[minijinja]' to install litestar with the required extra or 'pip install minijinja' to install the package separately

the imports for minijinja seems to be too early in the game,

URL to code causing the issue

No response

MCVE

from litestar import Litestar
from litestar.plugins.flash import FlashPlugin


app = Litestar(route_handlers=[], plugins=[FlashPlugin])

Steps to reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"

Logs

No response

Litestar Version

2.8.2

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@euri10 euri10 added the Bug 🐛 This is something that is not working as expected label Apr 22, 2024
@euri10 euri10 changed the title Bug: minijinja import Bug: minijinja import too early on FlashPlugin Apr 22, 2024
peterschutt added a commit that referenced this issue Apr 23, 2024
Fix import from `contrib.minijinja` without handling for case where dependency is not installed.

Closes #3415
peterschutt added a commit that referenced this issue Apr 23, 2024
Fix import from `contrib.minijinja` without handling for case where dependency is not installed.

Closes #3415
Copy link

This issue has been closed in #3418. The change will be included in the upcoming patch release.

Copy link

github-actions bot commented Jun 2, 2024

A fix for this issue has been released in v2.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

1 participant