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: exceptiongroup backport is missing on Python 3.10 #3029

Closed
1 of 4 tasks
mtvx opened this issue Jan 26, 2024 · 2 comments · Fixed by #3035
Closed
1 of 4 tasks

Bug: exceptiongroup backport is missing on Python 3.10 #3029

mtvx opened this issue Jan 26, 2024 · 2 comments · Fixed by #3035
Labels
Bug 🐛 This is something that is not working as expected Dependencies This is updating a dependency file Good First Issue This is good for newcomers to take on Package This is related to the overall `litestar` package

Comments

@mtvx
Copy link

mtvx commented Jan 26, 2024

Description

Code expects exceptiongroup backport to be installed in

from exceptiongroup import ExceptionGroup as _ExceptionGroup # pyright: ignore

However, it's only declared for dev dependencies in

"exceptiongroup; python_version < \"3.11\"",
so after litestar install it won't be found and one has to manually require it now.

Running Python 3.10.

Logs

Full stacktrace (failure on launch):


Traceback (most recent call last):
  File "/home/api/.local/lib/python3.10/site-packages/litestar/utils/helpers.py", line 99, in get_exception_group
    return cast("type[BaseException]", ExceptionGroup)  # type:ignore[name-defined]
NameError: name 'ExceptionGroup' is not defined. Did you mean: '_ExceptionGroup'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/myproject/api/myproject/cloud_management/new_app.py", line 4, in <module>
    from litestar import Litestar
  File "/home/api/.local/lib/python3.10/site-packages/litestar/__init__.py", line 1, in <module>
    from litestar.app import Litestar
  File "/home/api/.local/lib/python3.10/site-packages/litestar/app.py", line 20, in <module>
    from litestar._openapi.plugin import OpenAPIPlugin
  File "/home/api/.local/lib/python3.10/site-packages/litestar/_openapi/plugin.py", line 10, in <module>
    from litestar.routes import HTTPRoute
  File "/home/api/.local/lib/python3.10/site-packages/litestar/routes/__init__.py", line 1, in <module>
    from .asgi import ASGIRoute
  File "/home/api/.local/lib/python3.10/site-packages/litestar/routes/asgi.py", line 7, in <module>
    from litestar.routes.base import BaseRoute
  File "/home/api/.local/lib/python3.10/site-packages/litestar/routes/base.py", line 13, in <module>
    from litestar._kwargs import KwargsModel
  File "/home/api/.local/lib/python3.10/site-packages/litestar/_kwargs/__init__.py", line 1, in <module>
    from .kwargs_model import KwargsModel
  File "/home/api/.local/lib/python3.10/site-packages/litestar/_kwargs/kwargs_model.py", line 49, in <module>
    _ExceptionGroup = get_exception_group()
  File "/home/api/.local/lib/python3.10/site-packages/litestar/utils/helpers.py", line 101, in get_exception_group
    from exceptiongroup import ExceptionGroup as _ExceptionGroup  # pyright: ignore
ModuleNotFoundError: No module named 'exceptiongroup'

Litestar Version

2.5.1

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
@mtvx mtvx added the Bug 🐛 This is something that is not working as expected label Jan 26, 2024
@peterschutt
Copy link
Contributor

Thanks, this was originally a testing utility that was moved into the main lib at some point and this would have been missed. PR welcome!

@peterschutt peterschutt added Good First Issue This is good for newcomers to take on Dependencies This is updating a dependency file Package This is related to the overall `litestar` package labels Jan 27, 2024
@provinzkraut provinzkraut linked a pull request Jan 27, 2024 that will close this issue
Copy link

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

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 Dependencies This is updating a dependency file Good First Issue This is good for newcomers to take on Package This is related to the overall `litestar` package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants