Skip to content

Commit 941356f

Browse files
committed
Fix Typos and minor cleanups
1 parent 7b33d45 commit 941356f

File tree

4 files changed

+29
-30
lines changed

4 files changed

+29
-30
lines changed

docs/source/standalone.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Spawning and proxying a web service from JupyterHub
44

55
The `standalone` feature of Jupyter Server Proxy enables JupyterHub Admins to launch and proxy arbitrary web services
6-
directly, in place of the JupyterLab or Notebook. You can use Jupyter Server Proxy to spawn a single proxy,
6+
directly, instead of JupyterLab or Notebook. You can use Jupyter Server Proxy to spawn a single proxy,
77
without it being attached to a Jupyter server. The proxy securely authenticates and restricts access to authorized
8-
users through JupyterHub, giving a unified way to securely provide arbitrary applications.
8+
users through JupyterHub, providing a unified way to access arbitrary applications securely.
99

10-
This works similar to {ref}`proxying Server Processes <server-process>`, where a server process is started and proxied.
10+
This works similarly to {ref}`proxying Server Processes <server-process>`, where a server process is started and proxied.
1111
The Proxy is usually started from the command line, often by modifying the `Spawner.cmd` in your
1212
[JupyterHub Configuration](https://jupyterhub.readthedocs.io/en/stable/tutorial/getting-started/spawners-basics.html).
1313

@@ -16,7 +16,7 @@ This feature builds upon the work of [Dan Lester](https://github.com/danlester),
1616

1717
## Installation
1818

19-
This feature has a dependency to JupyterHub and must be explicitly installed via an optional dependency:
19+
This feature has a dependency on JupyterHub and must be explicitly installed via an optional dependency:
2020

2121
```shell
2222
pip install jupyter-server-proxy[standalone]
@@ -32,17 +32,17 @@ The standalone proxy is controlled with the `jupyter standaloneproxy` command. Y
3232
jupyter standaloneproxy -- voila --no-browser --port={port} /path/to/some/Notebook.ipynb
3333
```
3434

35-
Executing this command will spawn a new HTTP Server, which will spawn the voilà dashboard and render the notebook.
35+
Executing this command will spawn a new HTTP Server, creating the voilà dashboard and rendering the notebook.
3636
Any template strings (like the `--port={port}`) inside the command will be automatically replaced when the command is
3737
executed.
3838

39-
The CLI has multiple advanced options to customize the behavior of the proxy. Execute `jupyter standaloneproxy --help`
39+
The CLI has multiple advanced options to customize the proxy behavior. Execute `jupyter standaloneproxy --help`
4040
to get a complete list of all arguments.
4141

42-
### Specify address and port
42+
### Specify the address and port
4343

44-
The proxy will try to extract the address and port from the `JUPYTERHUB_SERVICE_URL` environment variable, which is
45-
set if an application is launched by JupyterHub. Otherwise, it will be launched on `127.0.0.1:8888`.
44+
The proxy will try to extract the address and port from the `JUPYTERHUB_SERVICE_URL` environment variable. This variable
45+
will be set by JupyterHub. Otherwise, the server will be launched on `127.0.0.1:8888`.
4646
You can also explicitly overwrite these values:
4747

4848
```shell
@@ -52,7 +52,7 @@ jupyter standaloneproxy --address=localhost --port=8000 ...
5252
### Disable Authentication
5353

5454
For testing, it can be useful to disable the authentication with JupyterHub. Passing `--skip-authentication` will
55-
not triggering the login process when accessing the application.
55+
not trigger the login process when accessing the application.
5656

5757
```{warning} Disabling authentication will leave the application open to anyone! Be careful with it,
5858
especially on multi-user systems.
@@ -61,15 +61,15 @@ especially on multi-user systems.
6161
## Usage with JupyterHub
6262

6363
To launch a standalone proxy with JupyterHub, you need to customize the `Spawner` inside the configuration
64-
using traitlets:
64+
using `traitlets`:
6565

6666
```python
6767
c.Spawner.cmd = "jupyter-standaloneproxy"
6868
c.Spawner.args = ["--", "voila", "--no-browser", "--port={port}", "/path/to/some/Notebook.ipynb"]
6969
```
7070

7171
This will hard-code JupyterHub to launch voilà instead of `jupyterhub-singleuser`. In case you want to give the users
72-
of the JupyterHub the ability to select which application to launch (like selecting either JupyterLab or voilà),
72+
of JupyterHub the ability to select which application to launch (like selecting either JupyterLab or voilà),
7373
you will want to make this configuration optional:
7474

7575
```python
@@ -108,15 +108,14 @@ This executable is usually a wrapper around the `JupyterLab` or `Notebook` appli
108108
additions regarding authentication and multi-user systems.
109109
In the standalone feature, we try to mimic these additions, but instead of using `JupyterLab` or `Notebook`, we
110110
will wrap them around an arbitrary web application.
111-
This will ensure only authenticated access to the application, while providing direct access to the application
112-
without needing a Jupyter server to be running in the background.
113-
The different additions will be discussed in more detail below.
111+
This will ensure direct, authenticated access to the application, without needing a Jupyter server to be running
112+
in the background. The different additions will be discussed in more detail below.
114113

115114
### Structure
116115

117116
The standalone feature is built on top of the `SuperviseAndProxyhandler`, which will spawn a process and proxy
118-
requests to this server. While this process is called _Server_ in the documentation, I will call it _Application_
119-
here, to avoid confusion with the other server where the `SuperviseAndProxyhandler` is attached to.
117+
requests to this server. While this process is called _Server_ in the documentation, the term _Application_ will be
118+
used here, to avoid confusion with the other server where the `SuperviseAndProxyhandler` is attached to.
120119
When using jupyter-server-proxy, the proxies are attached to the Jupyter server and will proxy requests
121120
to the application.
122121
Since we do not want to use the Jupyter server here, we instead require an alternative server, which will be used
@@ -127,9 +126,9 @@ For that, we use tornado `HTTPServer`.
127126

128127
One central component is the authentication with the JupyterHub Server.
129128
Any client accessing the application will need to authenticate with the JupyterHub API, which will ensure only
130-
the user themselves (or otherwise allowed users, e.g., admins) can access the application.
129+
users themselves (or otherwise allowed users, e.g., admins) can access the application.
131130
The Login process is started by deriving our `StandaloneProxyHandler` from
132-
[jupyterub.services.auth.HubOAuthenticated](https://github.com/jupyterhub/jupyterhub/blob/5.0.0/jupyterhub/services/auth.py#L1541)
131+
[jupyterhub.services.auth.HubOAuthenticated](https://github.com/jupyterhub/jupyterhub/blob/5.0.0/jupyterhub/services/auth.py#L1541)
133132
and decorating any methods we want to authenticate with `tornado.web.authenticated`.
134133
For the proxy, we just decorate the `proxy` method with `web.authenticated`, which will authenticate all routes on all HTTP Methods.
135134
`HubOAuthenticated` will automatically provide the login URL for the authentication process and any
@@ -140,21 +139,21 @@ This redirect will be received on the `/oauth_callback` path, from where we need
140139
root of the application.
141140
We use the [HubOAuthCallbackHander](https://github.com/jupyterhub/jupyterhub/blob/5.0.0/jupyterhub/services/auth.py#L1547),
142141
another handler from the JupyterHub package, for this.
143-
It will also cache the received OAuth state from the login, so that we can skip authentication for the next requests
142+
It will also cache the received OAuth state from the login so that we can skip authentication for the next requests
144143
and do not need to go through the whole login process for each request.
145144

146145
### SSL certificates
147146

148-
In some JupyterHub configurations, the launched application will be configured to use an SSL certificate for request
147+
In some JupyterHub configurations, the launched application will be configured to use an SSL certificate for requests
149148
between the JupyterLab / Notebook and the JupyterHub API. The path of the certificate is given in the
150149
`JUPYTERHUB_SSL_*` environment variables. We use these variables to create a new SSL Context for both
151150
the `AsyncHTTPClient` (used for Activity Notification, see below) and the `HTTPServer`.
152151

153152
### Activity Notifications
154153

155154
The `jupyterhub-singleuser` will periodically send an activity notification to the JupyterHub API and inform it that
156-
the currently running application is still active. Whether this information is actually used or not depends on the
157-
specific configuration of this JupyterHub.
155+
the currently running application is still active. Whether this information is used or not depends on the specific
156+
configuration of this JupyterHub.
158157

159158
### Environment Variables
160159

jupyter_server_proxy/standalone/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations # For Python 3.8 compatibility
1+
from __future__ import annotations
22

33
import argparse
44
import logging
@@ -66,7 +66,7 @@ def run(
6666
port = port or address_port_default[1]
6767

6868
if skip_authentication:
69-
log.warn("Disabling Authentication with JuypterHub Server!")
69+
log.warn("Disabling Authentication with JupyterHub Server!")
7070

7171
prefix = os.environ.get("JUPYTERHUB_SERVICE_PREFIX", "/")
7272

@@ -95,7 +95,7 @@ def run(
9595
# Periodically send JupyterHub Notifications, that we are still running
9696
if activity_interval > 0:
9797
log.info(
98-
f"Sending Acitivity Notivication to JupyterHub with interval={activity_interval}s"
98+
f"Sending Activity Notification to JupyterHub with interval={activity_interval}s"
9999
)
100100
start_activity_update(activity_interval)
101101

@@ -140,7 +140,7 @@ def main():
140140
parser.add_argument(
141141
"--socket-auto",
142142
action="store_true",
143-
help="Use Unix Socket for proxying, but let Jupyter Server Proxy automatically create one.",
143+
help="Use Unix Socket for proxying, but let jupyter-server-proxy automatically create one.",
144144
)
145145
parser.add_argument(
146146
"--env",

jupyter_server_proxy/standalone/activity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
async def notify_activity():
1111
"""
1212
Regularly notify JupyterHub of activity.
13-
See `jupyrehub/singleuser/extensions#L396`
13+
See https://github.com/jupyterhub/jupyterhub/blob/4.x/jupyterhub/singleuser/extension.py#L389
1414
"""
1515

1616
client = httpclient.AsyncHTTPClient()

jupyter_server_proxy/standalone/proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations # For Python 3.8 compatibility
1+
from __future__ import annotations
22

33
import os
44
import re
@@ -81,7 +81,7 @@ def get_timeout(self):
8181

8282

8383
def configure_ssl():
84-
# See jupyter_server/serverapp:init_webapp
84+
# See https://github.com/jupyter-server/jupyter_server/blob/v2.0.0/jupyter_server/serverapp.py#L2053-L2073
8585
keyfile = os.environ.get("JUPYTERHUB_SSL_KEYFILE", "")
8686
certfile = os.environ.get("JUPYTERHUB_SSL_CERTFILE", "")
8787
client_ca = os.environ.get("JUPYTERHUB_SSL_CLIENT_CA", "")

0 commit comments

Comments
 (0)