Skip to content

Commit

Permalink
Update JupyterLab tunnel docs (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljcollinsuk authored Jan 23, 2025
1 parent 8d5cfb4 commit feeec66
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions source/documentation/appendix-docs/app_development.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
> **IMPORTANT:**
> These instructions are for older versions of JupyterLab earlier than v3.6.3/4.1.0.
> [You can find the latest documentation on running an application locally here](https://user-guidance.analytical-platform.service.justice.gov.uk/tools/jupyterlab/index/html#accessing-a-locally-running-application).

# Running your app within Jupyter

It is likely that you will want to preview and test your app before you deploy it.
Expand Down
23 changes: 22 additions & 1 deletion source/documentation/tools/jupyterlab/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ python3 -m ipykernel install --user --name="pipenv-name" --display-name="My proj

And then select the kernel in Jupyter as [normal](../tools/package-management.html#venv-and-pip).

## Accessing a Locally Running Application

As of version JupyterLab v3.6.3/4.1.0, to access an application running locally (such as Dash or Streamlit), it *must* be running on port `8081`. You can then access it by visiting `https://${USERNAME}-jupyter-lab-tunnel.tools.analytical-platform.service.justice.gov.uk`. As apps are only accessible on port 8081, you can only run one app at a time.

This cannot be accessed by anyone other than yourself as it uses the same authentication method as your tooling.

There is no longer a requirement to run your app (e.g. Dash or Steamlit) on a base url path e.g. `/_tunnel_/8050/`. This is only required for older versions of JupyterLab that are now deprecated.

### Hints and tips
- To run a Dash app on port `8081` use the `port` arg when using the `app.run` command in your code e.g.:
```
if __name__ == '__main__':
app.run(port=8081)
```
- To run a Streamlit app on port `8081` you can use the `--server.port` flag when running the app e.g.
```
streamlit run app.py --server.port 8081
```
Alternatively, set the server port environment variable in your terminal session before running your app `export STREAMLIT_SERVER_PORT=8081`
## Hidden Files
As per [this](https://jupyterlab.readthedocs.io/en/stable/user/files.html#displaying-hidden-files) documentation, to display or hide the hidden files through the menu `View` -> `Show Hidden Files`.
As per [this](https://jupyterlab.readthedocs.io/en/stable/user/files.html#displaying-hidden-files) documentation, to display or hide the hidden files through the menu `View` -> `Show Hidden Files`.
2 changes: 1 addition & 1 deletion source/tools/jupyterlab/index.html.md.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: JupyterLab
weight: 30
last_reviewed_on: 2022-05-01
last_reviewed_on: 2025-01-23
review_in: 2 months
owner_slack: "#analytical-platform-support"
owner_slack_workspace: "mojdt"
Expand Down

0 comments on commit feeec66

Please sign in to comment.