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

Enhancement: Using installed debugger post mortem #3949

Open
cansarigol opened this issue Jan 13, 2025 · 2 comments
Open

Enhancement: Using installed debugger post mortem #3949

cansarigol opened this issue Jan 13, 2025 · 2 comments
Labels
Enhancement This is a new feature or request

Comments

@cansarigol
Copy link

cansarigol commented Jan 13, 2025

Summary

First of all, thank you all for this amazing project. I was wondering if you guys consider replacing pdb.post_mortem with a debugger package of already installed ones. This way, we can continue with the terminals we are used to.

In my mind, it is something like this:

middleware/_internal/init.py :

def get_post_mortem():
    for package in ["pdbr", "pudb", "ipdb", "pdbpp"]:
        try:
            module = __import__(package, fromlist=["post_mortem"])
            return module.post_mortem
        except ImportError:
            continue

     
    import pdb
    return pdb.post_mortem

middleware/_internal/exceptions/middleware.py :

if litestar_app.pdb_on_exception:
    from .. import get_post_mortem
    get_post_mortem()()

Basic Example

image

Drawbacks and Impact

No response

Unresolved questions

No response

@cansarigol cansarigol added the Enhancement This is a new feature or request label Jan 13, 2025
@provinzkraut
Copy link
Member

Not unreasonable, but I think a better approach would be to allow passing a debugger_module or post_mortem param to the app, as it's more flexible

@euri10
Copy link
Contributor

euri10 commented Jan 13, 2025

not related but from the screen, given the reloader uses StatReload it seems you used pip install uvicorn when using uvicorn[standard] would be a little bit faster for the reload, but mainly for the http parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This is a new feature or request
Projects
None yet
Development

No branches or pull requests

3 participants