Skip to content

Commit

Permalink
Merge pull request #368 from consideRatio/pr/rename-labext
Browse files Browse the repository at this point in the history
Rename @jupyterlab/server-proxy to @jupyterhub/jupyter-server-proxy
  • Loading branch information
consideRatio authored Jan 7, 2023
2 parents 80e2953 + 54e6910 commit bf858b1
Show file tree
Hide file tree
Showing 17 changed files with 413 additions and 765 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
- name: Javascript package
run: |
mkdir jsdist
cd jupyterlab-server-proxy
jlpm pack --filename ../jsdist/jupyterlab-server-proxy-jlpmpack.tgz
cd labextension
jlpm pack --filename ../jsdist/labextension-jlpmpack.tgz
- name: Upload Python artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -112,9 +112,9 @@ jobs:
name: jsdist
path: jsdist

- run: npm publish --dry-run ./jsdist/jupyterlab-server-proxy-jlpmpack.tgz
- run: npm publish --dry-run ./jsdist/labextension-jlpmpack.tgz

- run: npm publish ./jsdist/jupyterlab-server-proxy-jlpmpack.tgz
- run: npm publish ./jsdist/labextension-jlpmpack.tgz
if: startsWith(github.ref, 'refs/tags')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Install JupyterLab Extension
if: matrix.jupyterlab-version == '2'
run: |
cd jupyterlab-server-proxy
cd labextension
jupyter labextension install . --no-build --debug
jupyter lab build --minimize=False --debug
Expand All @@ -111,7 +111,7 @@ jobs:
if: ${{ !(matrix.jupyterlab-version == '2' && startsWith(matrix.python-version, '3.1')) }}
run: |
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie '@jupyterlab/server-proxy.*OK.*'
jupyter labextension list 2>&1 | grep -ie '@jupyterhub/jupyter-server-proxy.*OK.*'
python -m jupyterlab.browser_check
- name: Install Acceptance test dependencies
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ installed with JupyterLab.
> You may use `yarn` or `npm run` instead of `jlpm` below.
```bash
cd jupyterlab-server-proxy # Change to the root of the labextension
cd labextension # Change to the root of the labextension
jlpm # Install dependencies (or `npm i`)
jlpm build:prod # Build:
# - `jupyterlab-server-proxy/lib`
# - `labextension/lib`
# - `jupyter_server_proxy/labextension`
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions`
```
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include LICENSE
recursive-include jupyterlab-server-proxy *
prune jupyterlab-server-proxy/node_modules
recursive-include labextension *
prune labextension/node_modules
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jupyterhub/jupyter-server-proxy/Test?logo=github)](https://github.com/jupyterhub/jupyter-server-proxy/actions)
[![PyPI badge](https://img.shields.io/pypi/v/jupyter-server-proxy.svg?logo=pypi)](https://pypi.python.org/pypi/jupyter-server-proxy)
[![Conda badge](https://img.shields.io/conda/vn/conda-forge/jupyter-server-proxy?logo=conda-forge)](https://anaconda.org/conda-forge/jupyter-server-proxy)
[![NPM badge](https://img.shields.io/npm/v/@jupyterlab/server-proxy.svg?logo=npm)](https://www.npmjs.com/package/@jupyterlab/server-proxy)
[![NPM badge](https://img.shields.io/npm/v/@jupyterhub/jupyter-server-proxy.svg?logo=npm)](https://www.npmjs.com/package/@jupyterhub/jupyter-server-proxy)

Jupyter Server Proxy lets you run arbitrary external processes (such as
RStudio, Shiny Server, Syncthing, PostgreSQL, Code Server, etc)
alongside your notebook server and provide authenticated web access to
them using a path like `/rstudio` next to others like `/lab`. Alongside
the python package that provides the main functionality, the JupyterLab
extension (`@jupyterlab/server-proxy`) provides buttons in the
extension (`@jupyterhub/jupyter-server-proxy`) provides buttons in the
JupyterLab launcher window to get to RStudio for example.

**Note:** This project used to be called **nbserverproxy**. As
Expand Down Expand Up @@ -80,7 +80,7 @@ As of version 3.0.0 the Python package ships with a JupyterLab 3 compatible
extension, making this step only needed for JupyterLab 2.

```
jupyter labextension install @jupyterlab/server-proxy
jupyter labextension install @jupyterhub/jupyter-server-proxy
```

## Disable
Expand All @@ -99,13 +99,8 @@ jupyter nbextension disable --py jupyter_server_proxy

### JupyterLab extension

Note that the extension name provided to the command (`jupyterlab-server-proxy`) does not correspond
to the extension package name (`@jupyterlab/server-proxy`). The `jupyter labextension list` will
incorrectly report the extension as still being enabled after executing the disable command.
This will be fixed in the next major release of jupyter-server-proxy.

```
jupyter labextension disable jupyterlab-server-proxy
jupyter labextension disable @jupyterhub/jupyter-server-proxy
```

## Local development
Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ These are instructions on how to make a release.

## Steps to make a release

1. Create a PR updating `jupyterlab-server-proxy/yarl.lock` and continue only
1. Create a PR updating `labextension/yarn.lock` and continue only
when its merged.

This helps us avoid leaving known vulnerabilities are unfixed. To do this,
delete the file and manually perform the the `build dist` step in the
`.github/workflows/publish.yaml` workflow's `build` job as summarized below.

```shell
rm jupyterlab-server-proxy/yarn.lock
rm labextension/yarn.lock

pip install jupyter_packaging wheel jupyterlab~=3.0
python setup.py sdist bdist_wheel
Expand Down
6 changes: 3 additions & 3 deletions docs/source/launchers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ is already running, it is reused.
JupyterLab Launcher Extension
=============================

The jupyterlab-server-proxy JupyterLab extension can be installed
to provide launcher icons for registered server processes.
The @jupyterhub/jupyter-server-proxy JupyterLab extension can be installed to
provide launcher icons for registered server processes.

.. code:: bash
jupyter labextension install @jupyterlab/server-proxy
jupyter labextension install @jupyterhub/jupyter-server-proxy
This should provide icons for each registered process in the main
JupyterLab launcher
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions jupyterlab-server-proxy/README.md → labextension/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# jupyterlab-server-proxy
# @jupyterhub/jupyter-server-proxy labextension

Launcher icons for proxied applications
This JupyterLab extension that is bundled and requires with the PyPI package
jupyter-server-proxy adds items to the JupyterLab [Launcher] representing the
configured server processes.

[launcher]: https://jupyterlab.readthedocs.io/en/stable/extension/extension_points.html#launcher

## Prerequisites

Expand Down Expand Up @@ -29,7 +33,7 @@ conda install jupyter-server-proxy
For JupyterLab 2, ensure `nodejs` is installed and available on `$PATH` and run:

```bash
jupyter labextension install @jupyterlab/server-proxy
jupyter labextension install @jupyterhub/jupyter-server-proxy
```

> This will cause:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@jupyterlab/server-proxy",
"version": "3.2.2",
"description": "Jupyter server extension to supervise and proxy web services",
"name": "@jupyterhub/jupyter-server-proxy",
"version": "4.0.0-alpha.1",
"description": "A JupyterLab extension accompanying the PyPI package jupyter-server-proxy adding launcher items for configured server processes.",
"keywords": [
"jupyter",
"jupyterlab",
Expand Down
18 changes: 14 additions & 4 deletions jupyterlab-server-proxy/src/index.ts → labextension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ function newServerProxyWidget(id: string, url: string, text: string): MainAreaWi
return widget;
}

/**
* The activate function is registered to be called on activation of the
* jupyterlab extension.
*
* ref: https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html
*/
async function activate(app: JupyterFrontEnd, launcher: ILauncher, restorer: ILayoutRestorer) : Promise<void> {
// Fetch configured server processes from {base_url}/server-proxy/servers-info
const response = await fetch(PageConfig.getBaseUrl() + 'server-proxy/servers-info');
if (!response.ok) {
console.log('Could not fetch metadata about registered servers. Make sure jupyter-server-proxy is installed.');
console.log(response);
return;
}
const { commands, shell } = app;

const data = await response.json();

const namespace = 'server-proxy';
const tracker = new WidgetTracker<MainAreaWidget<IFrame>>({
namespace
Expand All @@ -46,6 +52,7 @@ async function activate(app: JupyterFrontEnd, launcher: ILauncher, restorer: ILa
});
}

const { commands, shell } = app;
commands.addCommand(command, {
label: args => args['title'] as string,
execute: args => {
Expand Down Expand Up @@ -101,10 +108,13 @@ async function activate(app: JupyterFrontEnd, launcher: ILauncher, restorer: ILa
}

/**
* Initialization data for the jupyterlab-server-proxy extension.
* Data to register the extension with jupyterlab which also clarifies whats
* required by the extension and passed to our provided activate function.
*
* ref: https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html#application-plugins
*/
const extension: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-server-proxy',
id: '@jupyterhub/jupyter-server-proxy:add-launcher-entries',
autoStart: true,
requires: [ILauncher, ILayoutRestorer],
activate: activate
Expand Down
File renamed without changes.
Loading

0 comments on commit bf858b1

Please sign in to comment.