Skip to content

Conversation

@harkabeeparolus
Copy link

It would be useful to provide our users with the Rich traceback suppress parameter. This would allow developers to suppress uninteresting stack frames in tracebacks from other Python frameworks.

For example, python-github, which gives a verbose traceback with many frames on a simple GitlabAuthenticationError. I would like to be able to suppress this entire call stack, but it doesn't work:

#! /usr/bin/env -S uv run --script

# /// script
# dependencies = [ "python-gitlab", "typer", "rich" ]
# ///

import gitlab
import rich.traceback
import typer

# This code does nothing; Typer will override it
rich.traceback.install(suppress=[gitlab])

def main():
    gl = gitlab.Gitlab()
    print(gl.pagesdomains.list())

typer.run(main)

But with this pull request, you can suppress modules directly with Typer():

#! /usr/bin/env -S uv run --script

# /// script
# dependencies = [ "python-gitlab", "typer" ]
# ///

import gitlab
import typer

app = typer.Typer(pretty_exceptions_suppress=[gitlab])

@app.command()
def main():
    gl = gitlab.Gitlab()
    print(gl.pagesdomains.list())

app()

@harkabeeparolus harkabeeparolus changed the title New Option to suppress modules in Rich tracebacks 💡 Suppress modules in Rich tracebacks Jan 23, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

@svlandeg svlandeg added the feature New feature, enhancement or request label Jan 23, 2026
@svlandeg
Copy link
Member

I'll put this in draft as long as the tests are failing 🙏

@svlandeg svlandeg marked this pull request as draft January 23, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants