In [20]:
import ipykee

Set global configs


In [21]:
print ipykee.config


{'git-media-path': '/root/ipykee/git-media-data/', 'project-dir': '/root/ipykee/projects/', 'ipython-url': '127.0.0.1:8080', 'work-dir': '/root/ipykee/workdir/'}

In [22]:
new_path = ipykee.config["git-media-path"] # just showing how
ipykee.config.set_config({"git-media-path" : new_path})

We need to clean after previous runs of this howto :-)


In [23]:
try:
    ipykee.delete_project("TestProject")
except:
    pass

Let's create new test project


In [24]:
ipykee.create_project("TestProject")

To use ipykee, you should create session with appropriate project. Several notebooks may be in one project, but they all should have different name. By default, notebook name would be discovered automatically.


In [25]:
session = ipykee.Session(project_name="TestProject")


This notebook has name 13-howto-ipykee-advanced
Please, save your notebook before commit!

Let's plot some graphics.


In [26]:
import matplotlib.pyplot as plt  # Again, in pylab mode this import happens automatically
x = np.linspace(0, 10, 1000)
fig1 = plt.figure()
ax1 = fig1.add_subplot(1, 1, 1)
ax1.plot(x, np.sin(x))
ax1.set_title('sine')


Out[26]:
<matplotlib.text.Text at 0x7feed73ed1d0>

Let's save some data


In [27]:
session.add(x, "x")

Before running code below, please, save your notebook!


In [28]:
session.commit("Plot sin x")


Out[28]:
('867b1cdb290e6aacb7272ed05cf4447799edf140',
 '13-howto-ipykee-advanced: Plot sin x')

Also, if you have installed ipython extension - you could just push the special button. To install it - please take a look at https://github.com/ipython-contrib/IPython-notebook-extensions/wiki

Now, let's plot another plot and commit again


In [29]:
fig2 = plt.figure()
ax2 = fig2.add_subplot(1, 1, 1)
ax2.plot(x, np.cos(x))
ax2.set_title('cosine')


Out[29]:
<matplotlib.text.Text at 0x7feed7691ad0>

In [30]:
session.commit("Plot cos x") # or push the button


Out[30]:
('9cf4f9a6da5fe537d8ad2a5b276f5662fd42773f',
 '13-howto-ipykee-advanced: Plot cos x')

In [ ]: