🪐 > Jupyter Kernel Client
Jupyter Kernel Client allows you to connect to live Jupyter Kernels through HTTP and WebSocket.
A Kernel is the process responsible to execute the notebook code.
Jupyter Kernel Client also provides a easy to use interactive Konsole (console for Kernels aka REPL, Read-Evaluate-Print-Loop).
Install
To install the library, run the following command.
pip install jupyter_kernel_client
Jupyter Server Kernel
Check you have a Jupyter Server with ipykernel running somewhere. You can install those packages with the following command.
pip install jupyter-server ipykernel
- Start a Jupyter Server.
# make jupyter-server
jupyter server --port 8888 --ServerApp.port_retries 0 --IdentityProvider.token MY_TOKEN
- Launch a IPython REPL in a terminal with
ipython(orjupyter console). Execute the following snippet (update the server_url and token if needed).
import os
from platform import node
from jupyter_kernel_client import JupyterKernelClient
with JupyterKernelClient(server_url="http://localhost:8888", token="MY_TOKEN") as kernel:
code = """import os
from platform import node
print(f"Hey {os.environ.get('USER', 'John Smith')} from {node()}.")
"""
reply = kernel.execute(code)
print(reply)
assert reply["execution_count"] == 1
assert reply["outputs"] == [
{
"output_type": "stream",
"name": "stdout",
"text": f"Hey {os.environ.get('USER', 'John Smith')} from {node()}.\n",
}
]
assert reply["status"] == "ok"
Check the response.
{"execution_count": 1, "outputs": [{"output_type": "stream", "name": "stdout", "text": "Hey echarles from eric.\n"}], "status": "ok"}
Instead of using the kernel client as context manager, you can call the start() and stop() methods.
from jupyter_kernel_client import JupyterKernelClient
kernel = JupyterKernelClient(server_url="http://localhost:8888", token="MY_TOKEN")
kernel.start()
reply = kernel.execute(code)
print(reply)
kernel.stop()
To connect to an existing Jupyter Kernel, first start JupyterLab, open a Notebook with a Kernel and take not of the Kernel ID.
TODO: Document how to get the
Kernel ID.
make jupyterlab
You can now connect to the existing Kernel and run code (do not invoke stop).
from jupyter_kernel_client import JupyterKernelClient
kernel = JupyterKernelClient(server_url="http://localhost:8888", kernel_id="83ef59b7-9c78-40bd-8cc2-4447635e7d0b", token="MY_TOKEN")
kernel.start()
reply = kernel.execute("x=1")
print(reply)
Jupyter Konsole
Jupyter Konsole can be used to open a Console to a Kernel.
- Install the optional dependencies.
pip install jupyter-kernel-client[konsole]
- Start a Jupyter Server.
# make jupyter-server
jupyter server --port 8888 --ServerApp.port_retries 0 --IdentityProvider.token MY_TOKEN
- Start the konsole and execute code.
# make jupyter-konsole
jupyter konsole --url http://localhost:8888 --token MY_TOKEN
[KonsoleApp] KernelHttpManager created a new kernel:...
Jupyter Konsole...
In [1]: 1+1
2
Uninstall
To remove the library, execute the following command.
pip uninstall jupyter_kernel_client
Contributing
Development install
# Clone the repo to your local environment
# Change directory to the jupyter_kernel_client directory
# Install package in development mode, this will automatically enable the server extension.
pip install -e ".[konsole,test,lint,typing]"
Running Tests
Install dependencies.
pip install -e ".[test]"
Run the python tests.
pytest
Development uninstall
pip uninstall jupyter_kernel_client
Packaging the library
See RELEASE
Metadata
Release files for jupyter-kernel-client 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jupyter_kernel_client-1.0.4.tar.gz | 59.8 kB | With provenance | Details for jupyter_kernel_client-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jupyter_kernel_client-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for jupyter_kernel_client-1.0.4-py3-none-any.whl |
Total release size: 108.2 kB
Release files / jupyter_kernel_client-1.0.4.tar.gz
| Download URL | jupyter_kernel_client-1.0.4.tar.gz |
|---|---|
| Size | 59.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e3ac0ecff2fc810b8728ac6d241fe607f13b6dc30b88da8774c6cf7efca2632
|
|
BLAKE2b-256 checksum How to use checksums |
89b902758673a0d25fe3d14806ca565a95cff48c63ea19b402714e74e54814e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / jupyter_kernel_client-1.0.4-py3-none-any.whl
| Download URL | jupyter_kernel_client-1.0.4-py3-none-any.whl |
|---|---|
| Size | 48.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
794f5b5180124403281ba933d59bfd96947d28ed61c1a726a1dc2a8d318f3f7d
|
|
BLAKE2b-256 checksum How to use checksums |
4763c22c263e2ef663fcf161e82c197c2f1c32c451a21b503a12a455da7c2dbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for jupyter-kernel-client 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jupyter_kernel_client-1.0.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.