I am a college student working on a project to create a Python playground website where users can write and run Python code. I am using the Ace code editor for the frontend, and I believe I need to use IPython in the backend to provide a Python environment for users to execute their code.
However, I am unsure about how to proceed with integrating IPython into my website. Specifically, I need guidance on how to communicate with the IPython kernel and frontend. Additionally, I would like to set up isolated environments for each user using Docker, but I'm not sure how to implement this.
Also, I think the Jupyter client can be an easy way to communicate with Kernal.
Top comments (4)
You can leverage a running IPython kernel and connect your frontend to it
Here is my
client.py
file which I am going to use to connect with a kernelNow I am confused about whether
KernelManager(kernel_id='9912')
is connecting to my configured kernel or create one on its own.Here is my complete process -
Step 1
Created a
k_conf.json
file to configure kernelThen I used the command
ipython kernel k_conf.json
Output:
TO check the output is basically generated from the kernel with
k_conf.json
configuration or not I need the log of created kernel.I think it is creating a new kernel, as it created a new file in my
tmp/
directory,kernel-9912.json
I can simply run the ipython kernel with the help of
ipython kernel
and Now I wanted to connect to that kernel and I believejupyter_client
would be beneficial in this case but I am unable to connect to the kernel.