-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Make Spyder be recognized as a Jupyter environment #1221
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
Conversation
- Spyder uses qtconsole for its main console, but with a lot of customizations on top of it to connect it to its other panes (including a subclass of ZMQInteractiveShell). - That's why it was not recognized by Rich as a Jupyter environment.
|
I'm the Spyder maintainer, so in case you consider this change is not good enough, please let me know what else I could do to fix the situation for our users. |
Codecov Report
@@ Coverage Diff @@
## master #1221 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 69 69
Lines 6379 6379
=======================================
Hits 6368 6368
Misses 11 11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
I think there are two issue which break Rich in Spyder. The first is that Spyder wraps stdout with a file object where The second may be colorama which is a bit of a hack on Windows to get color on the classic terminal. It works fine for a terminal running with conhost.exe but not an emulated terminal as I guess you have in Spyder. Unfortunately, I don't have a good solution for this issue. You could run An env var may be best workaround at the moment, but I wouldn't approve of a specific env var for every IDE or terminal window. Possibly we could come up with a generic env var. Happy to brainstorm ideas, because of course I would want Spyder users to be able to enjoy Rich. That said, if this change works for you, I could merge that. But bear in mind that Jupyter support may not be as good as a regular terminal. There's no way in Jupyter to get the width of the terminal which is needed for things like Panels and Tables. |
|
For Note the check with |
Agreed. That would very easily allow you to control when to turn on/off certain features according to what an environment (notebook, editor, IDE) declares. If you can provide the (generic) name for it in a PR here, I could create a PR to set it in the appropriate Jupyter repo so that both Spyder and Jupyter use it out of the box.
It works in the sense that it gives Spyder the same support Jupyter has right now. But I'm fine if you prefer to wait until the env var solution is in place. |
We could patch But I have one question about it: Does |
|
@ccordoba12 For Linux |
|
@ccordoba12 colorama shouldn't have any effect on other platforms. From the docs:
By the looks of things, I can set A related is that Rich is unable to detect the terminal size, so it will be stuck at 80 columns. This is because |
|
@ccordoba12 Would it be possible for you to make |
|
THis should be fixed in Spider could return True from its proxy isatty() |
Type of changes
Checklist
Description