-
-
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
MNT: Do not use IPython stream in console #10942
Conversation
There are other uses of |
@saimn , I am not convinced that As you can see, most of the class is called here or there, though whether the calls are still necessary or not is another story.
|
Well, the other uses of |
You can probably also get rid of these lines: https://github.com/astropy/astropy/pull/10942/files#diff-582a94e0a0f7293634d5bb6531b7bdf8a847ecd2a380ec691a65bac8beaff546R137 |
@embray , can you please clarify #10942 (comment) ? That link points back to the diff that I made, so not sure if I understand. |
68cc237
to
52036da
Compare
This comment has been minimized.
This comment has been minimized.
@pllim - I'm not sure to understand everything in this module, but I would say that we should keep |
52036da
to
a67781d
Compare
Tests passed. Not sure about the coverage. Someone familiar with IPython stream should review. Thanks! |
@pllim Sorry for the late reply. I don't know why my link didn't work (it was some code that was not in the default context of one of your diffs, but GH didn't expand the context when clicking it. Nevertheless, it looks like in your followup commit you did address exactly the code I was referring to. |
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.
Makes sense to me. I tested this (both running the tests, and some manual testing) on IPython down to 4.2.1. Since it works that far back let's keep the pyreadline stuff for now and just leave the note that it can be removed one day in the future. In the meantime supporting old IPython versions is not a bad idea.
astropy/utils/console.py
Outdated
# - File name is 'stdout'; or | ||
# - File wraps a Console | ||
if getattr(file, 'name', None) == 'stdout': | ||
return True | ||
|
||
if hasattr(file, 'stream'): | ||
# FIXME: pyreadline has no had new release since 2015, drop it? |
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.
Do we have a published minimum IPython version supported? IPython 5.x dropped dependency on pyreadline, over 4 years ago.
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.
Sounds good!
a67781d
to
46fdeab
Compare
@embray , I went ahead and defined minversion for ipython here. Does this look good now or did I miss something? |
Hmm... Looking at https://travis-ci.com/github/astropy/astropy/jobs/432592934 using
|
That's annoying indeed. I had a look at the So we could either pin it to Or do something annoying like: diff --git a/astropy/table/pandas.py b/astropy/table/pandas.py
index 6c0004e7b..85a1f48b2 100644
--- a/astropy/table/pandas.py
+++ b/astropy/table/pandas.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import warnings
+
ascii_coded = ('Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙'
'♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐'
'♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐'
@@ -26,7 +28,14 @@ try:
return self.backup_text
dhtml = HTMLWithBackup(html, ascii_uncoded)
- display.display(dhtml)
+ with warnings.catch_warnings():
+ # ignore deprecation warning from newer traitlets versions
+ # used with older IPython versions
+ # https://github.com/astropy/astropy/pull/10942#issuecomment-724927877
+ warnings.filterwarnings('ignore', '.*traitlets 4.1.*',
+ DeprecationWarning)
+
+ display.display(dhtml)
except ImportError:
print(ascii_uncoded)
except (UnicodeEncodeError, SyntaxError): |
I think IPython not pinning their stuff isn't our problem. I'll try pinning traitlets in tox.ini as you suggested once we get the CI running again over at #10388 |
d28aaee
to
aa44b80
Compare
@embray , you can ignore the remote data job. What do you think of the PR now? |
My thoughts exactly. |
Description
I ran into a deprecation warning when I ran
pytest -s astropy/utils/tests/test_console.py
:With this patch, the tests pass again:
I am not that familiar with
console.py
, so I opted not to try to gut the_IPython
class.xref ipython/ipython#9504
Fix #11005
TODO