GitLab is open source software to collaborate on code (a GitHub clone to run on your own server). Clicking a blob (a file in a repository) in GitLab shows a nice rendering if GitLab supports the file type (e.g., images, Markdown documents), or its content as plain text otherwise. The patch described here adds support to GitLab for rendering IPython notebooks (.ipynb files).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var raw_edit = function(notebook){ | |
| var md = notebook.metadata | |
| var textarea = $('<textarea/>') | |
| .attr('rows','13') | |
| .attr('cols','75') | |
| .attr('name','metadata') | |
| .text(JSON.stringify(md, null,4)||''); | |
| var dialogform = $('<div/>').attr('title','Edit the metadata') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GNU GENERAL PUBLIC LICENSE | |
| Version 3, 29 June 2007 | |
| Copyright (C) 2007 Free Software Foundation, Inc. {http://fsf.org/} | |
| Everyone is permitted to copy and distribute verbatim copies | |
| of this license document, but changing it is not allowed. | |
| Preamble | |
| The GNU General Public License is a free, copyleft license for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Script for running and save notebooks from command line. | |
| How to use: `ipynb_run_save.py foo.ipynb | |
| Some tweaks over ipydoctest.py from minrk | |
| by @damianavila | |
| """ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pickle | |
| import gzip | |
| def save(object, filename, protocol = 0): | |
| """Saves a compressed object to disk | |
| """ | |
| file = gzip.GzipFile(filename, 'wb') | |
| file.write(pickle.dumps(object, protocol)) | |
| file.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import IPython.core.display | |
| import matplotlib as mpl | |
| def clean(): | |
| # set mpl defaults for nice display | |
| mpl.rcParams['font.size'] = 12 | |
| mpl.rcParams['figure.figsize'] = (18, 6) | |
| mpl.rcParams['lines.linewidth'] = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| simple example script for running and testing notebooks. | |
| Usage: `ipnbdoctest.py foo.ipynb [bar.ipynb [...]]` | |
| Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook. | |
| """ | |
| from __future__ import print_function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package: | |
| name: examplepackage | |
| version: "1.0" |