[IPython-dev] Where to look: extending Markdown, and including NB in other webpages
ellisonbg at gmail.com
Sun Jan 13 14:11:23 EST 2013
On Sat, Jan 12, 2013 at 1:56 PM, Stian Håklev <shaklev at gmail.com> wrote:
> Hi. I'm coming from the Ruby world, but have been blown away by IPython and
> Notebook, as well as the incredible support for scientific computing,
> statistics etc. I'm a PhD student in education, and have decided to try to
> use IPython for my statistical analysis, instead of SPSS etc. Also very
> interested in open scholarship/reproducible research etc.
Glad you like it!
> I've been working on an "open scholar" workflow, using Ruby+AppScript to
> integrate a citation manager, PDF reader, and Dokuwiki into a pretty neat
> system (see http://reganmian.net/wiki/researchr:start). I'm currently
> thinking about how to integrate IPython with my workflow. I have two ideas,
> and in both cases, I'd love a little pointer as to where to look (I realize
> I'll have to dig through some code, and learn more Python, to get there).
> 1. How easy is it to write a "plugin" for the Markdown parser? In my wiki,
> [@citekey] is replaced with a proper citation, with a link to the relevant
> article page etc. I also wrote a plugin for Wordpress to do the same (they
> get the info from a pre-processed JSON file). For WordPress this is as easy
> as a small php file with a regexp. How would I do some similar
> "post-processing" on Markdown cells?
As Matthias said, it could definitely be done, but we probably
wouldn't accept it into the project. By putting a custom.js file in
the right place in your IPython directory:
You can add anything you want to the notebook.
> 2. A more ambitious idea would be to try to integrate Notebook with
> Dokuwiki. My idea would be to have a php plugin which started an IPython
> instance, and then sent each code block on the page to the server, and got
> back output, which was written to the page (which is then cached, so it
> doesn't have to be re-run until the page changes).
If you want to integrate the notebook into other websites, you have two options:
1. Simply start the existing notebook server and use a proxy, such as
node-http-proxy to tie it into your site.
2. Just start to dig into the code and actually hack on it to build
what you want. This is more general, but a ton more work.
Also, keep in mind that the notebook server is equivalent to giving
someone a shell account on your system. You should not expect to to
offer the notebook to untrusted users on the web sithout a massive
investment in a comprehensive security architecture. The scope of the
IPython notebook is on *trusted* users where no additional security
infrastucture is needed, so you will have to build this yourself.
> I was thinking of having a markup like
> <IPython>plot(x,y)</IPython> - possibly also with the option of hiding the
> Python code and only showing the output (this would make it more similar to
> knitr), or also showing the color highlighted Python code...
> I'm not sure how easy this would be - I need to understand more about how to
> start and communicate with an IPython kernel, and what exactly it sends back
> (ie. how much of the HTML processing etc gets done in Notebook, as opposed
> to in the kernel, etc). Has anyone else tried to do something similar?
Honestly, I am not sure. I would just start to dig into the code - it
is somewhat complex and you should know that the actual backend for
the web app is very unstable. If you develop against it at this
point, you will have to change your code moving forward.
> Again, pointers to where I should start to look would be useful! I will of
> course share anything I come up with!
Here is the notebook code:
All of the kernel stuff is here:
> Thanks again for an amazing project. I look forward to the first Coursera
> course (or similar) using IPython and Numpy+Scipy+Pandas instead of R (I am
> thinking of trying to take one of the courses, and doing all the exercises
> in IPython instead).
> Stian Haklev
> Curriculum, Teaching and Learning, University of Toronto
> http://reganmian.net/blog -- Random Stuff that Matters
> IPython-dev mailing list
> IPython-dev at scipy.org
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com
More information about the IPython-dev