-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Introduce the uninstall method #2972
base: master
Are you sure you want to change the base?
Conversation
Pinging for review/comments, do you think this is still valuable? |
for the sanity of everyone everywhere please merge this |
@qrdlgit Could I ask you to read over the code of conduct and reflect on your approach and language: https://github.com/Textualize/rich/blob/master/CODE_OF_CONDUCT.md I'm sure whatever issues you've run into, due to the decisions made by the authors of the libraries you've chosen to install, are frustrating; but using Rich issues to vent at the authors and maintainers of Rich isn't going to solve anything. |
@noklam Not something I'm in a position to help with I'm afraid. |
This is nonsense. Your belligerent tone makes me disinclined to unburden you of your ignorance. If you want help, post a new issue (do not reply to this issue). But bear in mind you are talking to real people who have worked very hard to bring you some amazing software for free. |
rich/traceback.py
Outdated
ipy_excepthook_closure(ip) | ||
return sys.excepthook | ||
return old_hooks |
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.
This method now returns two quite different return types, if I read this right.
Feels like a code smell. How about we return a callable which uninstalls?
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.
Hey! Thanks for having a look at this. It has been a while so I have forgotten some details. Let me have a look today and come back to this.
rich/traceback.py
Outdated
except Exception: | ||
# otherwise use default system hook | ||
old_excepthook = sys.excepthook | ||
sys.excepthook = excepthook | ||
return old_excepthook | ||
|
||
|
||
def uninstall(hooks): |
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.
It would be better for this method not to require a parameter. If we return an uninstall callable, perhaps it can be stored as a global and called here.
I'll also need a docstring.
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.
Thanks for the comment, I have made some changes.
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.
I'd like to do something similar with rich.pretty.install
as well
… a global `UNINSTALL_CALLABLE`
I see a linting error but doesn't seem to be related to my change. |
Type of changes
Checklist
Description
Related #2461, #1947
This is a very rough draft but it's a working solution. List of questions that I have
install
for IPython, it returns asys.excepthook
which isn't useful, because it's just a pointer to the object and the old hooks that we want to preserve are gone.uninstall
rich.traceback.uninstall()
, but it will also be a breaking change so I haven't implement in this way yet, would love to get some feedback.Manual Test
Python
IPython
Please describe your changes here. If this fixes a bug, please link to the issue, if possible.
I have tested this on Github workspace, you can use this script to verify the behavior.