Attention: Maintenance on monday 19.04.2021 from 07:00 - 13:00 (Gitlab and Mattermost are offline!)

Commit 8bd929ae authored by Theresa Pollinger's avatar Theresa Pollinger

made the thing (hopefully) locally installable

parent 8a89e555
**MetaKernel Echo** is a Jupyter kernel using MetaKernel magics, shell, help, and parallel processing tools. This code provides an example MetaKernel kernel.
**interview_kernel** is a Jupyter kernel using MetaKernel magics.
## Install
First, you need to install the metakernel_echo library and dependencies:
pip install interview_kernel --upgrade
Then, you need to install the metakernel echo kernel spec:
from this directory, run
python interview_kernel install
pip install interview_kernel
python install
cd interview_kernel
## Running
This diff is collapsed.
......@@ -17,12 +17,10 @@ def install_my_kernel_spec(user=True, prefix=None):
os.chmod(td, 0o755) # Starts off as 700, not user readable
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
# TODO: Copy any resources
# copyfile('./kernel.js', os.path.join(td, 'kernel.js'))
interview = Interview()
with open(os.path.join(td, 'kernel.js'), 'w') as f:
# javascript code that sets an initial markdown cell
# javascript code that sets an initial markdown cell in every new notebook
js = """define(['base/js/namespace'], function(Jupyter)
function onload()
......@@ -13,14 +13,19 @@ from pylatexenc.latex2text import LatexNodes2Text
import getpass
from import output_notebook
from pde_state_machine import *
from string_handling import build_url, get_recursively
#from . import pde_state_machine
import pde_state_machine
#from . import string_handling
import string_handling
from distutils.util import strtobool
"""This is a Jupyter kernel derived from MetaKernel. To use it, install it with the script and run
"jupyter notebook --debug --NotebookApp.token='' " from terminal. """
class Interview(MetaKernel):
implementation = 'Interview'
implementation_version = '0.1'
language = 'text'
......@@ -55,7 +60,7 @@ Otherwise, you can always answer with \LaTeX-type input.
def __init__(self, **kwargs):
self.state_machine = PDE_States(self.poutput, self.update_prompt, self.please_prompt, self.display_html)
self.state_machine = pde_state_machine.PDE_States(self.poutput, self.update_prompt, self.please_prompt, self.display_html)
# call superclass constructor
super(Interview, self).__init__(**kwargs)
......@@ -255,7 +260,7 @@ Otherwise, you can always answer with \LaTeX-type input.
url_args_dict = dict(type="pgraph",
# if applicable, highlight the ephemeral parts
thynames = get_recursively(self.state_machine.simdata, "theoryname")
thynames = string_handling.get_recursively(self.state_machine.simdata, "theoryname")
# if thynames:
# url_args_dict["highlight"] = ",".join(thynames)
# for now, highlight the "persistent ephemeral" theories, cf
......@@ -271,8 +276,8 @@ Otherwise, you can always answer with \LaTeX-type input.
# have the side bars go away
url_args_dict["viewOnlyMode"] = "true"
tgview_url = build_url(server_url, "graphs/tgview.html", args_dict=url_args_dict)
tgview_url = string_handling.build_url(server_url, "graphs/tgview.html", args_dict=url_args_dict)
# print(tgview_url)
code = """
......@@ -249,7 +249,7 @@ class PDE_States:
##### for state domain
def domain_begin(self):
self.poutput("What is the domain in your model? Ω : type ❘ = [?;?], e.g. `\\Omega = [0.0;1.0]`")
self.poutput("What is the domain in your model? Ω : type ❘ = [?;?], e.g. `\\\\Omega = [0.0;1.0]`")
# self.poutput("By the way, you can always try and use LaTeX-type input.")
self.simdata[self.state]["axes"] = OrderedDict()
......@@ -950,6 +950,8 @@ class PDE_States:
def recap(self, userstring=None): # TODO
self.poutput("You can inspect the persistently loaded MMT theories under " + self.mmtinterface.mmt_base_url)
def print_simdata(self):
self.poutput("These are the things we know so far about your problem:")
......@@ -9,7 +9,7 @@ from setuptools import setup
packages=['interview_kernel', 'interview_kernel/exastencils'],
author='Theresa Pollinger',
......@@ -20,13 +20,12 @@ setup(
# replicating contents of MANIFEST,
# cf.
'interview_kernel/exastencils': ['interview_kernel/exastencils/compiler.jar',
'interview_kernel': ['interview_kernel/exastencils/compiler.jar',
# use_scm_version=True,
setup_requires=['setuptools_scm'], # or possibly
install_requires=['transitions', 'bokeh', 'requests', 'pylatexenc', 'metakernel', 'lxml', 'IPython',
'jupyter_client', 'ipywidgets']
install_requires=['transitions', 'bokeh', 'requests', 'pylatexenc', 'metakernel', 'lxml', 'IPython', 'jupyter_client', 'ipywidgets']
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