Giter Site home page Giter Site logo

ipython3-versioncontrol's Introduction

##Short description of the Ipython 3 to/from Python converter files.

The ipython notebook --script run option that produced python codes from an Ipython 2 notebook is deprecated in Ipython 3 (Jupyter, nbformat 4). The python file that Jupyter can produce has several shortcomings, the most problematic one is the missing metainformation: there is no cell type metadata, just a bracket indicates where a new code cell starts, but information about markdowncells are completly lost. This is why restoring the notebook (without the output content) without losing important information is not possible right now.

The scripts in the folder suggest a solution to this problem.

  • notebook_v4_to_py.py converts an Ipython notebook to py file that preserves cell metadata. The conversion can be done manually by running the following command

python notebook_v4_to_py.py -f notebook_filename.ipynb

  • While this script works, it is much more convenient to make Jupyter create the python file itself automatically. This can be done by adding the content of ipython_notebook_config.txt to the jupyter_notebook_config.py in the config file which can be located with

ipython locate profile default

  • The python files then can be version controlled, and the converter script that creates a notebook feom the .py file is py_to_notebook_v4.py:

python py_to_notebook_v4.py -f py_filename.py

Call the scripts with argument "--overwrite" to overwrite existing .ipynb or .py files.

Call the scripts with argument "--dry-run" to simulate (print out) what would happen.

An alternative conversion method

If one needs only a clean notebook in its original JSON format without the output and cell meatadata information, then this solution might be helpful.

ipython3-versioncontrol's People

Contributors

edooley7 avatar ghostrider77 avatar samuelsmal avatar jimmykaiser avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.