Mercurial > hg > Members > aka > jupyter_CbC_kernel
changeset 9:101e99452042
Dockerized project :)
author | Brendan Rius <brendan@omixy.com> |
---|---|
date | Sat, 26 Mar 2016 14:54:39 +0000 |
parents | ca8f6aa0f6ed |
children | eee0f8bf43f5 |
files | Dockerfile c_kernel/kernel.json c_kernel/kernel.py kernel.json setup.py |
diffstat | 5 files changed, 30 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dockerfile Sat Mar 26 14:54:39 2016 +0000 @@ -0,0 +1,8 @@ +FROM jupyter/minimal-notebook +MAINTAINER Brendan Rius <ping@brendan-rius.com> + +USER root + +COPY ./ /home/$NB_USER/.jupyter/jupyter_c_kernel/ +RUN pip install /home/$NB_USER/.jupyter/jupyter_c_kernel/ +RUN jupyter-kernelspec install /home/$NB_USER/.jupyter/jupyter_c_kernel/ \ No newline at end of file
--- a/c_kernel/kernel.json Fri Mar 25 15:03:55 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -{ - "argv": [ - "python", - "-m", - "c_kernel", - "-f", - "{connection_file}" - ], - "display_name": "C", - "language":"c" -}
--- a/c_kernel/kernel.py Fri Mar 25 15:03:55 2016 +0000 +++ b/c_kernel/kernel.py Sat Mar 26 14:54:39 2016 +0000 @@ -28,6 +28,7 @@ """Create a new temp file to be deleted when the kernel shuts down""" # We don't want the file to be deleted when closed, but only when the kernel stops kwargs['delete'] = False + kwargs['mode'] = 'w' file = tempfile.NamedTemporaryFile(**kwargs) self.files.append(file.name) return file @@ -37,7 +38,7 @@ """Execute a command and returns the return code, stdout and stderr""" p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() - return p.returncode, stdout, stderr + return p.returncode, stdout.decode('utf-8'), stderr.decode('utf-8') @staticmethod def compile_with_gcc(source_filename, binary_filename):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel.json Sat Mar 26 14:54:39 2016 +0000 @@ -0,0 +1,11 @@ +{ + "argv": [ + "python", + "-m", + "c_kernel", + "-f", + "{connection_file}" + ], + "display_name": "C", + "language": "c" +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Sat Mar 26 14:54:39 2016 +0000 @@ -0,0 +1,9 @@ +from distutils.core import setup + +setup(name='jupyter_c_kernel', + version='1.0', + description='Minimalistic C kernel for Jupyter', + author='Brendan Rius', + author_email='ping@brendan-rius.com', + packages=['c_kernel'], + )