Skip to content
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

Nbformat.current is deprecated #53

Merged
merged 1 commit into from
Oct 1, 2015
Merged

Nbformat.current is deprecated #53

merged 1 commit into from
Oct 1, 2015

Conversation

gabraganca
Copy link
Contributor

This fix the warning that is thrown when runipy is loaded.

The version of the notebook changed to 4 with IPython 3.0.0. The format of the previous notebook and this new one is different. When the user is using IPython 3.0, runipy will load the notebook as version 3 and not 4. I think this PR can help on this.

@gabraganca
Copy link
Contributor Author

It still need to be tested on IPython < 3.0. I think it will not work because it will not find the read and write functions of nbformat.

@gabraganca
Copy link
Contributor Author

It is not passing the tests on IPython 2.x series.

Traceback (most recent call last):
  File "test.py", line 68, in testRunNotebooks
    self.assert_notebooks_equal(expected, runner.nb)
  File "test.py", line 49, in assert_notebooks_equal
    self.assertEquals(a, e)
AssertionError: {'output_type': u'pyout', 'prompt_number': 2, 'text': u'<IPython.core.display.SV [truncated]... != {u'output_type': u'pyout', u'prompt_number': 2, u'text': u'<IPython.core.display [truncated]...
- {'output_type': u'pyout',
+ {u'output_type': u'pyout',
?  +

-  'prompt_number': 2,
+  u'prompt_number': 2,
?  +

-  'svg': u'<svg height="100" width="100">\n    <circle cx="50" cy="50" fill="red" r="40" stroke="black" stroke-width="2"/>\n</svg>',
+  u'svg': u'<svg height="100" width="100">\n    <circle cx="50" cy="50" fill="red" r="40" stroke="black" stroke-width="2"/>\n</svg>',
?  +

-  'text': u'<IPython.core.display.SVG objecta90>'}
?                                            ---

+  u'text': u'<IPython.core.display.SVG object>'}
?  +

@gabraganca
Copy link
Contributor Author

About the error I mentioned above, I get the same thing when testing the master branch. So it could be some problem in my computer.

Checking the error output again, it seems related to some strings been tagged as unicode.

@gabraganca
Copy link
Contributor Author

If #54 is true, may this is not neccessary anymore....

@jakirkham
Copy link
Collaborator

Could you please rebase these changes on the current master?

@gabraganca
Copy link
Contributor Author

@jakirkham done.

Please note that it still does not support version 4 of the notebooks.

@jakirkham
Copy link
Collaborator

Thanks @gabraganca. Also, thanks for fixing up the tests. This looks generally good to me. I'll take a closer look later. I made a couple of minor comments.

@gabraganca
Copy link
Contributor Author

@jakirkham you're welcome. I just checked your comments and made the changes.

@gabraganca
Copy link
Contributor Author

@jakirkham If you are deprecating IPython 2.0 (#78), maybe it would be better to not accept this PR. What do you think?

nb = read(payload, 'json')
try:
# Ipython 3
nb = read(payload, '3')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be an int. ( https://ipython.org/ipython-doc/3/api/generated/IPython.nbformat.html#IPython.nbformat.reads ) Probably good to be consistent, as well.

IPython.nbformat.current has been deprecated.

The arguments passed to function `read` changed in IPython 3.0. It now
asks for the notebook version. The new version is v4.

If the user is using IPython < 3, it loads the notebook as before. If
it is 3.0 or greater, it will load the notebook as format v3. I tried to
load as v4, but its format different and more work is needed.
@jakirkham
Copy link
Collaborator

I see your point, @gabraganca. However, I think this is a harmless enough change that I am in favor of it.

Though I do favor deprecating an old and no longer actively maintained version of iPython. If there are runipy users on iPython 2, I would like to hear from them first. Admittedly, iPython has gone through a number of breaking changes in a relatively short window compared to other projects of similar reach. So, if there is still a user base that benefits from this functionality, I wouldn't be completely surprised.

jakirkham added a commit that referenced this pull request Oct 1, 2015
Nbformat.current is deprecated
@jakirkham jakirkham merged commit 4648001 into paulgb:master Oct 1, 2015
@jakirkham
Copy link
Collaborator

...and it's in. Thanks again @gabraganca.

@jakirkham
Copy link
Collaborator

@gabraganca
Copy link
Contributor Author

👍

Thanks.

@jakirkham jakirkham added this to the v0.1.4 milestone Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants