Dockerized project :)

This commit is contained in:
Brendan Rius 2016-03-26 14:54:39 +00:00
parent 8ad18c3d91
commit 177229a39d
4 changed files with 21 additions and 3 deletions

8
Dockerfile Normal file
View File

@ -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/

View File

@ -28,6 +28,7 @@ class CKernel(Kernel):
"""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 @@ class CKernel(Kernel):
"""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):

View File

@ -7,5 +7,5 @@
"{connection_file}"
],
"display_name": "C",
"language":"c"
}
"language": "c"
}

9
setup.py Normal file
View File

@ -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'],
)