-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1519 from willmcgugan/suppress-frames
Suppress frames and max_frames
- Loading branch information
Showing
9 changed files
with
222 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
Demonstrates Rich tracebacks for recursion errors. | ||
Rich can exclude frames in the middle to avoid huge tracebacks. | ||
""" | ||
|
||
from rich.console import Console | ||
|
||
|
||
def foo(n): | ||
return bar(n) | ||
|
||
|
||
def bar(n): | ||
return foo(n) | ||
|
||
|
||
console = Console() | ||
|
||
try: | ||
foo(1) | ||
except Exception: | ||
console.print_exception(max_frames=20) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
try: | ||
import click | ||
except ImportError: | ||
print("Please install click for this example") | ||
print(" pip install click") | ||
exit() | ||
|
||
from rich.traceback import install | ||
|
||
install(suppress=[click]) | ||
|
||
|
||
@click.command() | ||
@click.option("--count", default=1, help="Number of greetings.") | ||
def hello(count): | ||
"""Simple program that greets NAME for a total of COUNT times.""" | ||
1 / 0 | ||
for x in range(count): | ||
click.echo(f"Hello {name}!") | ||
|
||
|
||
if __name__ == "__main__": | ||
hello() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "rich" | ||
homepage = "https://github.com/willmcgugan/rich" | ||
documentation = "https://rich.readthedocs.io/en/latest/" | ||
version = "10.10.0" | ||
version = "10.11.0" | ||
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" | ||
authors = ["Will McGugan <[email protected]>"] | ||
license = "MIT" | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.