Here is what I intend to cover today:
At the end of this process, I would like for each of you to be able to create an IPython Notebook locally on your computer, edit it on Wakari.io, and then be able to allow anyone else to see it using GitHub's IPython Notebook Viewer.
This very same file we have on the screen now will make that journey.
Things you'll need to do ahead of time:
Some references that will be very helpful to ensure you understand what we are doing and how it all works:
OK. Let's get you started.
This file you are currently viewing is part of the course's git repository, which you can find here:
http://github.com/marioberges/courses_12-752/
Since it is in a public repository, you should be able to clone that repository into your computer and edit each file locally. For that, you could either clone it using the command line interface to git, or a graphical user interface (whichever you installed on your computer if you chose to install git). From the command line, for instance, you would issue this command to clone it:
git clone http://github.com/marioberges/courses_12-752.git
If you are planning to edit IPython Notebooks locally on your computer (and not with Wakari.io), then make sure that you can clone the repository into your computer by issuing that command.
If you are successful, you will be able to see a new folder called courses_12-752
inside the folder where you issued the command. A copy of this IPython Notebook file should be in there as well, and you can view it by opening an IPython Notebook Server as follows:
ipython notebook
Just make sure you issue this last command on the corresponding folder.
Now let's test if you can also do this on Wakari.io. In other words, we will be cloning the class git repository into your Wakari.io environment, so that the files (including this notebook) are accessible to you on Wakari.io and you can use the IPython Notebook there to edit files and do whatever you like.
All you need to do is to go to Terminal mode on Wakari.io, and launch a new "Shell" terminal. Once there, you can use the same command we had issued earlier to clone the repository:
git clone http://github.com/marioberges/courses_12-752.git
If you were successful in doing this, then you will see a new folder appear on the left hand side of the screen (the folder view) called courses_12-752
. You may need to hit the refresh button to see it.
Now you can open that folder and load the IPython Notebook file for this lecture and edit it in Wakari.io
The steps we followed above were for cloning the course's official repository. However, you will want to repeat these steps for any other repository you may be interested in working with, especially the ones that you end up creating under your Github account. Thus, let's practice importing one of your repositories.
Follow these steps:
git clone http://github.com/yourusername/yourrepository.git
yourusername
and yourrepository
with the right information)Now it's time for you to practice some of your recently learned git skills.
Create a new IPython notebook in Wakari.io, making sure to place it inside the folder of the repository you just cloned.
Add a couple of Python commands to it, or some comments, and save it.
Now go back to the terminal and add, commit and push the changes to your repository:
git add yourfile.ipynb
git commit -m "Made my first commit"
git push origin master
If this worked, you should be able to see the file added to your repository by simply pointing your browser to:
http://github.com/yourusername/yourrepository
Because IPython can be used to issue commands to a shell, directly, you can avoid having to switch to a terminal screen if you want to. This means we could have performed all of the above git manipulation directly from this notebook. The trick is to create a Code cell (the default type of cells) in the IPython notebook and then issuing the commands preceded by a !
sign, as follows:
In [1]:
!git status
Try running the above cell and see what you get.
In [ ]: