Skip to content

Commit 7c6cd38

Browse files
authored
Readme and Konsole (#10)
* chore: konsole * docs: readm * lint
1 parent 36368c7 commit 7c6cd38

File tree

2 files changed

+28
-52
lines changed

2 files changed

+28
-52
lines changed

README.md

Lines changed: 26 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,40 @@
44
~ BSD 3-Clause License
55
-->
66

7-
# Jupyter Kernel Client (through http)
7+
[![Datalayer](https://assets.datalayer.tech/datalayer-25.svg)](https://datalayer.io)
88

9-
[![Github Actions Status](https://github.com/datalayer/jupyter-kernel-client/workflows/Build/badge.svg)](https://github.com/datalayer/jupyter-kernel-client/actions/workflows/build.yml)
10-
[![PyPI - Version](https://img.shields.io/pypi/v/jupyter-kernel-client)](https://pypi.org/project/jupyter-kernel-client)
11-
12-
Jupyter Kernel Client to connect via WebSocket to Jupyter Servers.
9+
[![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=1ABC9C)](https://github.com/sponsors/datalayer)
1310

14-
## Requirements
11+
# Jupyter Kernel Client (via WebSocket and HTTP)
1512

16-
- Jupyter Server with ipykernel running somewhere.
17-
You can install those packages using:
18-
19-
```sh
20-
pip install jupyter-server ipykernel
21-
```
13+
[![Github Actions Status](https://github.com/datalayer/jupyter-kernel-client/workflows/Build/badge.svg)](https://github.com/datalayer/jupyter-kernel-client/actions/workflows/build.yml)
14+
[![PyPI - Version](https://img.shields.io/pypi/v/jupyter-kernel-client)](https://pypi.org/project/jupyter-kernel-client)
2215

23-
## Install
16+
Jupyter Kernel Client allows you to connect via WebSocket and HTTP to Jupyter Kernels. It also provide a easy to use interactive Konsole (console for **K**ernels).
2417

25-
To install the extension, execute:
18+
To install the library, run the following command.
2619

2720
```bash
2821
pip install jupyter_kernel_client
2922
```
3023

3124
## Usage
3225

33-
### Kernel Client
34-
35-
1. Start a Jupyter Server (or JupyterLab or Jupyter Notebook)
26+
Check you have a Jupyter Server with ipykernel running somewhere. You can install those packages using:
3627

3728
```sh
38-
jupyter server
39-
# ...
40-
# To access the server, open this file in a browser:
41-
# file:///home/echarles/.local/share/jupyter/runtime/jpserver-910631-open.html
42-
# Or copy and paste one of these URLs:
43-
# http://localhost:8888/?token=aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b
44-
# http://127.0.0.1:8888/?token=aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b
29+
pip install jupyter-server ipykernel
4530
```
4631

47-
2. Note down the URL (usually `http://localhost:8888`) and the Server Token (in the above example it will be `aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b`)
32+
### Kernel Client
33+
34+
2. Start a Jupyter Server.
4835

49-
3. Launch `python` in a terminal.
36+
```sh
37+
jupyter server --port 8888 --IdentityProvider.token MY_TOKEN
38+
```
5039

51-
4. Execute the following snippet
40+
3. Launch `python` in a terminal and execute the following snippet (update the server_url and token).
5241

5342
```py
5443
import os
@@ -57,7 +46,7 @@ from platform import node
5746
from jupyter_kernel_client import KernelClient
5847

5948

60-
with KernelClient(server_url="http://localhost:8888", token="aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b") as kernel:
49+
with KernelClient(server_url="http://localhost:8888", token="MY_TOKEN") as kernel:
6150
reply = kernel.execute(
6251
"""import os
6352
from platform import node
@@ -75,40 +64,26 @@ print(f"Hey {os.environ.get('USER', 'John Smith')} from {node()}.")
7564
assert reply["status"] == "ok"
7665
```
7766

78-
### Jupyter Console
67+
### Jupyter Konsole (aka Console for Kernels)
7968

80-
This package can be used to open a Jupyter Console to a Jupyter Kernel through HTTP 🐣.
69+
This package can be used to open a Jupyter Console to a Jupyter Kernel 🐣.
8170

8271
1. Install the optional dependencies.
8372

8473
```sh
8574
pip install jupyter-kernel-client[konsole]
8675
```
8776

88-
2. Start a Jupyter Server (or JupyterLab or Jupyter Notebook).
89-
90-
```sh
91-
jupyter server
92-
# ...
93-
# To access the server, open this file in a browser:
94-
# file:///home/echarles/.local/share/jupyter/runtime/jpserver-910631-open.html
95-
# Or copy and paste one of these URLs:
96-
# http://localhost:8888/?token=aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b
97-
# http://127.0.0.1:8888/?token=aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b
98-
```
99-
100-
3. Note down the URL (usually `http://localhost:8888`) and the Server Token (in the above example it will be `aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b`)
101-
102-
4. Start the console.
77+
2. Start a Jupyter Server.
10378

10479
```sh
105-
jupyter-konsole --url http://localhost:8888 --token aed1fef59f754b9bfc99017e1dcf4d5602fc1a97d331069b
80+
jupyter server --port 8888 --token MY_TOKEN
10681
```
10782

108-
Example of console session.
83+
3. Start the konsole and execute code.
10984

11085
```bash
111-
jupyter-konsole --url http://localhost:8888 --token 0d2004a3f836e3dbb01a035c66a43b6fa06e44b004599835
86+
$ jupyter konsole --url http://localhost:8888 --IdentityProvider.token MY_TOKEN
11287
[KonsoleApp] KernelHttpManager created a new kernel: ...
11388
Jupyter Kernel console 0.2.0
11489

@@ -124,7 +99,7 @@ In [2]:
12499

125100
## Uninstall
126101

127-
To remove the extension, execute:
102+
To remove the library, execute:
128103

129104
```bash
130105
pip uninstall jupyter_kernel_client
@@ -139,7 +114,7 @@ pip uninstall jupyter_kernel_client
139114
# Change directory to the jupyter_kernel_client directory
140115
# Install package in development mode - will automatically enable
141116
# The server extension.
142-
pip install -e ".[test,lint,typing]"
117+
pip install -e ".[konsole,test,lint,typing]"
143118
```
144119

145120
### Running Tests
@@ -162,6 +137,6 @@ pytest
162137
pip uninstall jupyter_kernel_client
163138
```
164139

165-
### Packaging the extension
140+
### Packaging the library
166141

167142
See [RELEASE](RELEASE.md)

jupyter_kernel_client/konsoleapp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
)
6161
)
6262

63-
# copy flags from mixin
63+
# copy aliases from mixin
6464
aliases = dict(base_aliases)
6565
aliases.update(
6666
{
@@ -71,6 +71,7 @@
7171
}
7272
)
7373

74+
7475
# -----------------------------------------------------------------------------
7576
# Classes
7677
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)