Skip to content
IPython 2to3 conversion
Jupyter Notebook Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
testing
.gitignore
LICENSE
README.md
ipy2to3.py

README.md

IPython Notebook 2-to-3

Converts IPython version 2 notebooks to IPython version 3.

I didn't find any tool online to convert ipython2 to ipython3 notebooks automatically, and it seemed simple enough, so I made my own.

I'm sure there are a lot of corner cases that are missed by the current script, but it should do the job for the vast majority of IPython notebooks. I suppose it would save people the pain of converting IPy notebooks manually or hacking up their own version of this.

Implementation

Converts all code sections by invoking 2to3. Handles any IPython magic statements by saving them over the conversion.

Usage

ipy2to3 fromfile.ipynb tofile.ipynb converts ipython2 file fromfile.ipynb to an ipython3 file tofile.ipynb.

Testing

Thanks to user shimondoodkin for adding unit tests! To invoke call python testing/test.py from the directory root.

Future Work

Make a lint checker for style of notebooks as well (How would this report location of the problem? Maybe it could automatically fix the problems and re-save the notebook?).

Verify there's no collision of ipython magic statements with regular Python code.

You can’t perform that action at this time.