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
Improvements to IPython printing: strings, floats, and ints. #2683
Conversation
Removed strings from LaTeX printing in IPython as this was causing dictionaries that contained strings and other valid LaTeX printable types to render. This is typically not desirable especially if you have a dictionary with only strings, floats, and integers. I also added an option `print_builtin` to `init_printing` that allows you to disable the float and integer LaTeX printing. For example, if you don't want a dictionary of integer keys and float values to render in LaTeX. Fixes issue sympy#2672.
Previous behavior: http://nbviewer.ipython.org/gist/moorepants/7931775 New behavior: http://nbviewer.ipython.org/gist/moorepants/7974682 |
The Travis failure seems unrelated to the PR. |
Add tests. |
I think you somehow squashed on top of #2656. |
With regards to the failure? What do you mean I squashed on top of #2656? |
How do I check for LaTeX printing in the IPython notebook? It seems that my test is only checking for pretty printing. |
Your first commit contains changes from that PR. |
I guess you need to check whatever the mime type of mathjax is instead of text/plain. |
My first commit only has things I added as far as I can tell. I'm not seeing what you think is from #2656 |
I don't really understand what's going on in the tests. It looks like we call |
The docstring of |
I edited the doc string of |
Oh, so it was made independently. In that case, maybe you could review the said PR, as it has many of the same changes you are making. |
I think the only same changes in #2656 are the addition of the docstrings for the extra parameters. One of our commits has to go in first and the other adjust. I think this one is ready to go. I couldn't tell the status of the other one. @moble can you comment? I can just remove these doc string additions, but we are likely to have a merge conflict regardless. |
I don't remember how. I thought you just went to https://www.hipchat.com/ghSp7E1uY and entered your name. |
I've added the last test here to check for the LaTeX representations. Ready to be reviewed for merge. |
@asmeurer ping |
Things to check:
|
I don't have environments on my local machine setup to test all kinds of versions of Python and IPython. I've been meaning to get familiar with conda, but haven't had the chance. Have people checked all these other versions before me? Is there no automated testing to deal with this? |
conda/Anaconda would be the easiest way to do this. You could check everything in a jiffy. I personally can't check everything because there is not yet a pyqt (hence qtconsole) conda package for Python 3 on Mac OS X, but I believe there is on Linux. |
There doesn't seem to be Python 3 packages for conda for IPython 0.13.2. This is a lot of fussing around...not really a jiffy. |
I can't get qtconsole to run with anaconda. I keep getting failures in loading pygments.lexers. |
I've checked everything you listed except for all the permutations of version, of course. |
Also check the tests. I can't remember if they are run in Travis. But anyway, +1. |
The tests only run if IPython is installed. So, I don't think they happen on Travis. I'm getting a test failure with Python 3.3 and IPython 0.13.2:
This is returning the unicode version instead of a plain string. It passes on master but fails on this branch. I didn't touch that test. Not sure what the issue is. |
Would this failure have to do with removing the 'string_types'? |
No, this is something I wrote. Maybe it has to do with Python 3.3 strings being unicode. |
This is interesting:
Seems the test passes on the first call but not on the second. Is that because Update: Notice that this isn't using the conda ipython. |
The tests pass on my machine for Python 3.3/IPython 0.13.2 but fail again on Python 2.7.5/IPython 1.1.0. It is some kind of unicode issue. I'm not familiar at all in the differences in strings/unicode from Python 2 to Python 3. I'll come back to this. |
Can you paste the error here? |
Ok, tests now pass on:
Gonna merge based on the +1 from @asmeurer. Should be ready to merge at this point. |
Improvements to IPython printing: strings, floats, and ints.
Can you document any major changes (here and in other PRs) in the release notes? |
Yes, I'll do that. |
Removed strings from LaTeX printing in IPython as this was causing dictionaries
that contained strings and other valid LaTeX printable types to render. This is
typically not desirable especially if you have a dictionary with only strings,
floats, and integers.
I also added an option
print_builtin
toinit_printing
that allows you todisable the float and integer LaTeX printing. For example, if you don't want a
dictionary of integer keys and float values to render in LaTeX.
Fixes issue #2672.
Tasks