Commit 6cac7e24 authored by Łukasz Nowak's avatar Łukasz Nowak

jupyter: Replace ipython_notebook with jupyter SR

parent fac20445
...@@ -61,7 +61,7 @@ class ERP5Kernel(Kernel): ...@@ -61,7 +61,7 @@ class ERP5Kernel(Kernel):
language = 'ERP5' language = 'ERP5'
language_version = '0.1' language_version = '0.1'
language_info = {'mimetype': 'text/plain', 'name':'python'} language_info = {'mimetype': 'text/plain', 'name':'python'}
banner = "ERP5 integration with ipython notebook" banner = "ERP5 integration with jupyter notebook"
def __init__(self, user=None, password=None, url=None, status_code=None, def __init__(self, user=None, password=None, url=None, status_code=None,
*args, **kwargs): *args, **kwargs):
......
...@@ -14,26 +14,26 @@ ...@@ -14,26 +14,26 @@
# section inheritance (< = ...) are NOT supported (but you should really # section inheritance (< = ...) are NOT supported (but you should really
# not need these here). # not need these here).
[instance-jupyter] [instance-jupyter-notebook]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 2c0ecc6f045504cb037709429132e08c md5sum = f0abfc788f6a83773d07dd37f9728db0
[ipython-notebook-config] [jupyter-notebook-config]
filename = template/ipython_notebook_config.py.jinja filename = jupyter_notebook_config.py.jinja
md5sum = 95a76a80718e2a933dd4854dcf9a4a65 md5sum = 720e90a829c63371696bc3009917a743
[ipython-notebook-set-password] [jupyter-set-password]
filename = template/ipython_set_password.cgi.jinja filename = jupyter_set_password.cgi.jinja
md5sum = d7d4a7e19d55bf14007819258bf42100 md5sum = b8d31441780b524a7e52d1710dd78385
[erp5-kernel] [erp5-kernel]
filename = template/ERP5kernel.py.jinja filename = ERP5kernel.py.jinja
md5sum = f7be6c3ef9cdfaaea3b8756895a22081 md5sum = 8bd16cc9f35b00172e8266f1cde5956f
[kernel-json] [kernel-json]
filename = template/kernel.json.jinja filename = kernel.json.jinja
md5sum = ab6e78ea20855e07d388b5b86d1770fe md5sum = ab6e78ea20855e07d388b5b86d1770fe
[custom-js] [custom-js]
filename = template/custom.js.jinja filename = custom.js.jinja
md5sum = 584aa839aa20263ba885537b74c83abd md5sum = 0bf9e2eb1718b14307265fe05a167018
...@@ -81,8 +81,8 @@ ...@@ -81,8 +81,8 @@
* @static * @static
*/ */
$([IPython.events]).on('notebook_loaded.Notebook', function(){ $([jupyter.events]).on('notebook_loaded.Notebook', function(){
var kernelname = IPython.notebook.kernel_selector.current_selection; var kernelname = jupyter.notebook.kernel_selector.current_selection;
var display_text="<div class='output_subarea output_text output_result'>\ var display_text="<div class='output_subarea output_text output_result'>\
<pre>Follow these steps to customize your notebook with ERP5 kernel :-</br>\ <pre>Follow these steps to customize your notebook with ERP5 kernel :-</br>\
1. Make sure you have 'erp5_data_notebook' business template installed in your ERP5</br>\ 1. Make sure you have 'erp5_data_notebook' business template installed in your ERP5</br>\
......
[buildout] [buildout]
parts = parts =
instance instance
ipython_notebook jupyter_notebook
read-knowledge0 read-knowledge0
publish-connection-parameter publish-connection-parameter
jupyter-notebook-config
erp5-kernel erp5-kernel
kernel-json kernel-json
custom-js custom-js
...@@ -33,7 +34,7 @@ port = 8888 ...@@ -33,7 +34,7 @@ port = 8888
host = ${slapconfiguration:ipv6-random} host = ${slapconfiguration:ipv6-random}
cert_file = ${generate-certificate:cert_file} cert_file = ${generate-certificate:cert_file}
key_file = ${generate-certificate:key_file} key_file = ${generate-certificate:key_file}
logfile = ${directory:log}/ipython_notebook.log logfile = ${directory:log}/jupyter_notebook.log
notebook_dir = ${directory:notebook_dir} notebook_dir = ${directory:notebook_dir}
[dynamic-jinja2-template-base] [dynamic-jinja2-template-base]
...@@ -52,13 +53,13 @@ command = ...@@ -52,13 +53,13 @@ command =
-out ${instance-parameter:cert_file} -out ${instance-parameter:cert_file}
fi fi
update-command = ${:command} update-command = ${:command}
cert_file = ${directory:etc}/ipython_notebook_cert.crt cert_file = ${directory:etc}/jupyter_cert.crt
key_file = ${directory:etc}/ipython_notebook_cert.key key_file = ${directory:etc}/jupyter_cert.key
[instance] [instance]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
command-line = command-line =
{{ bin_directory }}/ipython notebook {{ bin_directory }}/jupyter-notebook
--no-browser --no-browser
--ip=${instance-parameter:host} --ip=${instance-parameter:host}
--port=${instance-parameter:port} --port=${instance-parameter:port}
...@@ -66,24 +67,19 @@ command-line = ...@@ -66,24 +67,19 @@ command-line =
--certfile=${instance-parameter:cert_file} --certfile=${instance-parameter:cert_file}
--keyfile=${instance-parameter:key_file} --keyfile=${instance-parameter:key_file}
--notebook-dir=${instance-parameter:notebook_dir} --notebook-dir=${instance-parameter:notebook_dir}
--logfile=${instance-parameter:logfile}
--config=${ipython-notebook-config:rendered}
# Add 'log-level' alias to 'DEBUG' so as to log requests being done while running
# of service ipython_notebook.
--log-level="DEBUG" --log-level="DEBUG"
wrapper-path = ${directory:service}/ipython_notebook wrapper-path = ${directory:service}/jupyter-notebook
parameters-extra = true parameters-extra = true
# Explicitly define IPython Directory to be used while starting ipython notebook
# Also explicitly force IPython to use en_US.utf8 encoding
environment = environment =
IPYTHONDIR=${directory:ipython_dir} JUPYTER_PATH=${directory:jupyter_dir}
JUPYTER_CONFIG_DIR=${directory:ipython_dir} JUPYTER_CONFIG_DIR=${directory:jupyter_config_dir}
JUPYTER_RUNTIME_DIR=${directory:jupyter_runtime_dir}
LANG=C.UTF-8 LANG=C.UTF-8
[ipython-notebook-config] [jupyter-notebook-config]
<= dynamic-jinja2-template-base <= dynamic-jinja2-template-base
template = {{ ipython_notebook_config_location }}/{{ ipython_notebook_config_filename }} template = {{ jupyter_config_location }}/{{ jupyter_config_filename }}
rendered = ${directory:etc}/ipython_notebook_config.py rendered = ${directory:jupyter_config_dir}/jupyter_notebook_config.py
mode = 0744 mode = 0744
context = context =
raw config_cfg ${buildout:directory}/knowledge0.cfg raw config_cfg ${buildout:directory}/knowledge0.cfg
...@@ -98,12 +94,15 @@ service = ${:etc}/service ...@@ -98,12 +94,15 @@ service = ${:etc}/service
promise = ${:etc}/promise/ promise = ${:etc}/promise/
log = ${:var}/log log = ${:var}/log
notebook_dir = ${:var}/notebooks notebook_dir = ${:var}/notebooks
# Add folders to explicitly define ipython directory # Add folders to explicitly define jupyter directory
ipython_dir = ${:home}/ipython jupyter_dir = ${:home}/jupyter
ipython_kernel_dir = ${:ipython_dir}/kernels jupyter_config_dir = ${:jupyter_dir}/etc
erp5_kernel_dir = ${:ipython_kernel_dir}/ERP5 jupyter_kernel_dir = ${:jupyter_dir}/kernels
jupyter_runtime_dir = ${:jupyter_dir}/runtime
[ipython_notebook] jupyter_custom_dir = ${:jupyter_config_dir}/custom
erp5_kernel_dir = ${:jupyter_kernel_dir}/ERP5
[jupyter_notebook]
# This part is called like this because knowledge0.write uses the part name for # This part is called like this because knowledge0.write uses the part name for
# the section name in the config file. # the section name in the config file.
recipe = slapos.cookbook:zero-knowledge.write recipe = slapos.cookbook:zero-knowledge.write
...@@ -151,6 +150,6 @@ context = ...@@ -151,6 +150,6 @@ context =
[custom-js] [custom-js]
<= dynamic-jinja2-template-base <= dynamic-jinja2-template-base
template = {{ custom_js_location }}/{{ custom_js_filename }} template = {{ custom_js_location }}/{{ custom_js_filename }}
rendered = ${directory:ipython_dir}/profile_default/static/custom/custom.js rendered = ${directory:jupyter_custom_dir}/custom.js
mode = 0744 mode = 0744
...@@ -25,14 +25,14 @@ c = get_config() ...@@ -25,14 +25,14 @@ c = get_config()
parser = ConfigParser.ConfigParser() parser = ConfigParser.ConfigParser()
parser.read(knowledge_0) parser.read(knowledge_0)
if not parser.has_section("ipython_notebook"): if not parser.has_section("jupyter_notebook"):
parser.add_section("ipython_notebook") parser.add_section("jupyter_notebook")
if not parser.has_option("ipython_notebook", "password") or \ if not parser.has_option("jupyter_notebook", "password") or \
parser.get("ipython_notebook", "password") == "": parser.get("jupyter_notebook", "password") == "":
parser.set("ipython_notebook", "password", random_password()) parser.set("jupyter_notebook", "password", random_password())
c.NotebookApp.password = passwd(parser.get("ipython_notebook", "password")) c.NotebookApp.password = passwd(parser.get("jupyter_notebook", "password"))
with open(knowledge_0, 'w') as file: with open(knowledge_0, 'w') as file:
parser.write(file) parser.write(file)
\ No newline at end of file
...@@ -24,16 +24,16 @@ if not os.path.exists(config_file): ...@@ -24,16 +24,16 @@ if not os.path.exists(config_file):
parser = ConfigParser.ConfigParser() parser = ConfigParser.ConfigParser()
parser.read(config_file) parser.read(config_file)
if not parser.has_section("ipython_notebook"): if not parser.has_section("jupyter_notebook"):
parser.add_section("ipython_notebook") parser.add_section("jupyter_notebook")
if not parser.has_option("ipython_notebook", "password"): if not parser.has_option("jupyter_notebook", "password"):
parser.set("ipython_notebook", "password", "") parser.set("jupyter_notebook", "password", "")
if "password" in form: if "password" in form:
parser.set("ipython_notebook", "password", passwd(form["password"].value)) parser.set("jupyter_notebook", "password", passwd(form["password"].value))
# subprocess.call('{{ httpd_graceful }}') # subprocess.call('{{ httpd_graceful }}')
# TODO: we should restart ipython # TODO: we should restart jupyter
with open(config_file, 'w') as file: with open(config_file, 'w') as file:
parser.write(file) parser.write(file)
...@@ -43,7 +43,7 @@ print "<html><head>" ...@@ -43,7 +43,7 @@ print "<html><head>"
print "<link rel=\"stylesheet\" href=\"static/pure-min.css\">" print "<link rel=\"stylesheet\" href=\"static/pure-min.css\">"
print "<link rel=\"stylesheet\" href=\"static/style.css\">" print "<link rel=\"stylesheet\" href=\"static/style.css\">"
print "</head><body>" print "</head><body>"
print "<h1>IPython Notebook Password :</h1>" print "<h1>Jupyter Notebook Password :</h1>"
print "<form action=\"/index.cgi\" method=\"post\" class=\"pure-form-aligned\">" print "<form action=\"/index.cgi\" method=\"post\" class=\"pure-form-aligned\">"
print "<input type=\"hidden\" name=\"posting-script\" value=\"{{ pwd }}/{{ this_file }}\">" print "<input type=\"hidden\" name=\"posting-script\" value=\"{{ pwd }}/{{ this_file }}\">"
......
...@@ -3,59 +3,39 @@ versions = versions ...@@ -3,59 +3,39 @@ versions = versions
extends = extends =
buildout.hash.cfg buildout.hash.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
../../component/ipython/buildout.cfg
../../component/scipy/buildout.cfg
../../component/scikit-learn/buildout.cfg
../../component/pandas/buildout.cfg
../../component/openssl/buildout.cfg ../../component/openssl/buildout.cfg
../../component/seaborn/buildout.cfg ../../component/jupyter/buildout.cfg
../../stack/monitor/buildout.cfg ../../stack/monitor/buildout.cfg
parts = parts =
slapos-cookbook slapos-cookbook
ipython-notebook jupyter
instance-jupyter instance-jupyter-notebook
[ipython-notebook] [jupyter]
; In the ipython notebook software, we use more eggs than in the minimal python_executable = ${buildout:bin-directory}/${:interpreter}
; ipython notebook component
eggs +=
requests
astor
${scipy:egg}
${pandas:egg}
${scikit-learn:egg}
${seaborn:egg}
${statsmodels:egg}
patsy
[download-file-base] [download-file-base]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/template/${:filename} url = ${:_profile_base_location_}/${:filename}
download-only = true download-only = true
mode = 0644 mode = 0644
[ipython-notebook-config] [jupyter-notebook-config]
<= download-file-base <= download-file-base
filename = ipython_notebook_config.py.jinja
[ipython-notebook-set-password] [jupyter-set-password]
<= download-file-base <= download-file-base
filename = ipython_set_password.cgi.jinja
[erp5-kernel] [erp5-kernel]
<= download-file-base <= download-file-base
filename = ERP5kernel.py.jinja
[kernel-json] [kernel-json]
<= download-file-base <= download-file-base
filename = kernel.json.jinja
[custom-js] [custom-js]
<= download-file-base <= download-file-base
filename = custom.js.jinja
[instance-jupyter] [instance-jupyter-notebook]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename} template = ${:_profile_base_location_}/${:filename}
rendered = ${buildout:directory}/template.cfg rendered = ${buildout:directory}/template.cfg
...@@ -65,11 +45,11 @@ context = ...@@ -65,11 +45,11 @@ context =
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory key eggs_directory buildout:eggs-directory
key openssl_output openssl-output:openssl key openssl_output openssl-output:openssl
key python_executable python2.7:executable key python_executable jupyter:python_executable
key ipython_notebook_config_location ipython-notebook-config:location key jupyter_config_location jupyter-notebook-config:location
key ipython_notebook_config_filename ipython-notebook-config:filename key jupyter_config_filename jupyter-notebook-config:filename
key ipython_notebook_set_password_location ipython-notebook-set-password:location key jupyter_set_password_location jupyter-set-password:location
key ipython_notebook_set_password_filename ipython-notebook-set-password:filename key jupyter_set_password_filename jupyter-set-password:filename
key erp5_kernel_location erp5-kernel:location key erp5_kernel_location erp5-kernel:location
key erp5_kernel_filename erp5-kernel:filename key erp5_kernel_filename erp5-kernel:filename
key kernel_json_location kernel-json:location key kernel_json_location kernel-json:location
...@@ -162,3 +142,10 @@ subprocess32 = 3.2.7 ...@@ -162,3 +142,10 @@ subprocess32 = 3.2.7
# Required by: # Required by:
# prompt-toolkit==1.0.13 # prompt-toolkit==1.0.13
wcwidth = 0.1.7 wcwidth = 0.1.7
jupyter = 1.0.0
jupyter-console = 5.1.0
# Required by:
# jupyter==1.0.0
qtconsole = 4.3.0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment