-
-
Notifications
You must be signed in to change notification settings - Fork 772
♻️ When printing error tracebacks with Rich, default to not showing locals, which are sometimes verbose #1072
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
base: master
Are you sure you want to change the base?
Conversation
If your Typer application handles **delicate information**, for example a **password**, a **key**, a **token**, then it could be problematic if the automatic errors show the value in those <abbr title="a variable that lives only inside a function, its value is only visible inside of it">local variables</abbr>. | ||
When using Rich, you can get more verbose output by printing the values of the <abbr title="a variable that lives only inside a function, its value is only visible inside of it">local variables</abbr> as part of the error message. | ||
|
||
By default, this setting is disabled (since Typer v0.18.0) to avoid showing **delicate information**, for example a **password**, a **key** or a **token**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: update version number here when/if we do decide to release this change
📝 Docs preview for commit 97b800d at: https://f2c37e25.typertiangolo.pages.dev Modified Pages |
I've updated this PR by changing the documentation to explain first the (new) default setting, showing no local variables. Then, showing how to enable them. Updated the tests accordingly as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, this is a breaking change in behaviour, as the default case will now show less information in error logs. But it's not breaking in the sense of "applications downstream will be breaking", and we're now error'ing on the side of caution, so that's better IMO.
♻️ When printing error tracebacks with Rich, default to not showing locals, which are sometimes verbose