Skip to content

Commit ec8fe79

Browse files
committed
use hatch
1 parent bf858b1 commit ec8fe79

File tree

14 files changed

+207
-211
lines changed

14 files changed

+207
-211
lines changed

.github/workflows/linkcheck.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ jobs:
2525
- uses: actions/setup-python@v4
2626
with:
2727
python-version: "3.11"
28+
cache: pip
29+
cache-dependency-path: pyproject.toml
2830

2931
- name: Install deps
30-
run: pip install -r docs/requirements.txt
32+
run: pip install .[docs]
3133

3234
- name: make linkcheck
3335
run: |

.github/workflows/publish.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,29 @@ jobs:
3535

3636
steps:
3737
- uses: actions/checkout@v3
38+
3839
- uses: actions/setup-python@v4
3940
with:
4041
python-version: "3.11"
42+
cache: pip
43+
cache-dependency-path: pyproject.toml
44+
45+
- uses: actions/setup-node@v3
46+
with:
47+
cache: yarn
48+
node-version: 18.x
49+
registry-url: https://registry.npmjs.org
50+
cache-dependency-path: labextension/yarn.lock
51+
52+
- name: Update root build packages
53+
run: |
54+
pip install --upgrade build pip jupyterlab~=3.0
4155
4256
- name: Build dist
4357
run: |
44-
pip install jupyter_packaging wheel jupyterlab~=3.0
45-
python setup.py sdist bdist_wheel
58+
set -eux
59+
pyproject-build
60+
cd dist && sha256sum * | tee SHA256SUMS
4661
4762
- name: Check dist sizes
4863
run: |
@@ -52,9 +67,12 @@ jobs:
5267
5368
- name: Javascript package
5469
run: |
70+
set -eux
5571
mkdir jsdist
5672
cd labextension
5773
jlpm pack --filename ../jsdist/labextension-jlpmpack.tgz
74+
cd ../jsdist && sha256sum * | tee SHA256SUMS
75+
5876
5977
- name: Upload Python artifact
6078
uses: actions/upload-artifact@v3
@@ -112,9 +130,11 @@ jobs:
112130
name: jsdist
113131
path: jsdist
114132

115-
- run: npm publish --dry-run ./jsdist/labextension-jlpmpack.tgz
133+
- run: |
134+
npm publish --dry-run ./jsdist/labextension-jlpmpack.tgz
116135
117-
- run: npm publish ./jsdist/labextension-jlpmpack.tgz
136+
- run: |
137+
npm publish ./jsdist/labextension-jlpmpack.tgz
118138
if: startsWith(github.ref, 'refs/tags')
119139
env:
120140
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yaml

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,61 +43,79 @@ jobs:
4343

4444
steps:
4545
- uses: actions/checkout@v3
46+
4647
- uses: actions/setup-python@v4
4748
with:
4849
python-version: "${{ matrix.python-version }}"
50+
cache: pip
51+
cache-dependency-path: pyproject.toml
52+
53+
- uses: actions/setup-node@v3
54+
with:
55+
cache: yarn
56+
node-version: 18.x
57+
registry-url: https://registry.npmjs.org
58+
cache-dependency-path: labextension/yarn.lock
59+
60+
- name: Update root build packages
61+
run: |
62+
pip install --upgrade build pip
4963
5064
- name: Build Python package
5165
run: |
52-
pip install jupyter_packaging wheel jupyterlab
53-
python setup.py sdist bdist_wheel
66+
pyproject-build
5467
55-
- name: Install Python dependencies
68+
- name: Install Python package
5669
# NOTE: See CONTRIBUTING.md for a local development setup that differs
5770
# slightly from this.
5871
#
5972
# Pytest options are set in tests/pytest.ini.
6073
run: |
61-
pip install --upgrade pip
62-
pip install jupyter_packaging jupyterlab~=${{ matrix.jupyterlab-version }}.0
63-
pip install ./dist/jupyter_server_proxy-*.whl
64-
pip install pytest pytest-cov pytest-html
65-
# Ensure we don't accidentally depend on notebook
66-
if [ "${{ matrix.jupyter-app }}" == "notebook" ]; then
67-
pip install "notebook<7"
68-
fi
74+
set -eux
75+
pip install -vv $(ls ./dist/jupyter_server_proxy-*.whl)\[acceptance\] 'jupyterlab~=${{ matrix.jupyterlab-version }}.0'
76+
77+
- name: List Python packages
78+
run: |
79+
set -eux
6980
pip freeze
81+
pip check
7082
7183
- name: Run tests
7284
run: |
85+
set -eux
7386
JUPYTER_TOKEN=secret jupyter-${{ matrix.jupyter-app }} --config=./tests/resources/jupyter_server_config.py &
7487
sleep 5
7588
cd tests
76-
pytest
89+
pytest -k "not acceptance"
7790
7891
- name: Upload pytest and coverage reports
7992
if: always()
8093
uses: actions/upload-artifact@v3
8194
with:
82-
name: unit-tests-${{ matrix.python-version }}-${{ matrix.jupyter-app }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
95+
name: |-
96+
unit-tests-${{ matrix.python-version }}-${{ matrix.jupyter-app }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
8397
path: |
8498
./build/pytest
8599
./build/coverage
86100
87101
- name: Check the Notebook Server extension is installed
88102
run: |
103+
set -eux
89104
jupyter serverextension list
90-
jupyter serverextension list 2>&1 | grep -ie "jupyter_server_proxy.*enabled" -
105+
jupyter serverextension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
91106
92107
- name: Check the Jupyter Server extension is installed
93108
run: |
109+
set -eux
94110
pip install jupyter-server
95111
jupyter server extension list
96-
jupyter server extension list 2>&1 | grep -ie "jupyter_server_proxy.*enabled" -
112+
jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
97113
98114
- name: Install JupyterLab Extension
99115
if: matrix.jupyterlab-version == '2'
100116
run: |
117+
set -eux
118+
export NODE_OPTIONS=--openssl-legacy-provider
101119
cd labextension
102120
jupyter labextension install . --no-build --debug
103121
jupyter lab build --minimize=False --debug
@@ -108,25 +126,23 @@ jobs:
108126
# jupyterlab.browser_check with jupyterlab 2 and a modern version of
109127
# python (3.11+).
110128
#
111-
if: ${{ !(matrix.jupyterlab-version == '2' && startsWith(matrix.python-version, '3.1')) }}
129+
if: ${{ !(matrix.jupyterlab-version == '2' && startsWith(matrix.python-version, '3.11')) }}
112130
run: |
131+
set -eux
113132
jupyter labextension list
114-
jupyter labextension list 2>&1 | grep -ie '@jupyterhub/jupyter-server-proxy.*OK.*'
133+
jupyter labextension list 2>&1 | grep -iE '@jupyterhub/jupyter-server-proxy.*OK.*'
115134
python -m jupyterlab.browser_check
116135
117-
- name: Install Acceptance test dependencies
118-
run: |
119-
# the acceptance test requires notebook to run
120-
pip install "notebook<7" "robotframework-jupyterlibrary>=0.4.2"
121-
122136
- name: Run acceptance tests
123137
run: |
124-
pytest -k acceptance -s
138+
set -eux
139+
pytest -s -k "acceptance"
125140
126141
- name: Upload acceptance test reports
127142
if: always()
128143
uses: actions/upload-artifact@v3
129144
with:
130-
name: acceptance-tests-${{ matrix.python-version }}-${{ matrix.jupyter-app }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
145+
name: |-
146+
acceptance-tests-${{ matrix.python-version }}-${{ matrix.jupyter-app }}-${{ matrix.jupyterlab-version }}-${{ github.run_number }}
131147
path: |
132148
./build/robot

CONTRIBUTING.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ To install these in addition to the [Python package](#python-package) test
3939
dependencies, run:
4040

4141
```bash
42-
pip install -e .[test,acceptance]
42+
pip install -e .[acceptance]
4343
```
4444

4545
In addition, compatible versions of:
4646

4747
- `geckodriver`
4848
- `firefox`
4949

50-
Needs to be on your `$PATH` and compatible with each other.
50+
Need to be on your `$PATH` and compatible with each other.
5151

5252
To run _only_ the acceptance tests, use the `-k` switch:
5353

@@ -74,11 +74,10 @@ jlpm build:prod # Build:
7474
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions`
7575
```
7676

77-
You can watch the source directory and automatically rebuild the `lib` folder:
77+
You can watch the source directory and automatically rebuild the `labextension/lib`
78+
and `jupyter_server_proxy/labextension` folders:
7879

7980
```bash
80-
jlpm watch # ... watch the source directory in another terminal tab
81+
cd labextension
82+
jlpm watch
8183
```
82-
83-
However, the built-in `jupyter labextension watch` does _not_ work with this repo,
84-
as the `package.json` and `setup.py` would need to be at the same level.

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ contains information on installation & usage.
3535
## Security warning
3636

3737
Jupyter Server Proxy is often used to start a user defined process listening to
38-
some network port (e.g. http://localhost:4567) for a user starting a Jupyter Server
38+
some network port (e.g. `http://localhost:4567`) for a user starting a Jupyter Server
3939
that only that user has permission to access. The user can then access the
4040
started process proxied through the Jupyter Server.
4141

@@ -47,7 +47,7 @@ A common strategy to enforce access proxied via Jupyter Server is to start
4747
Jupyter Server within a container and only allow network access to the Jupyter
4848
Server via the container.
4949

50-
For more insights, see [Ryan Lovetts comment about
50+
> For more insights, see [Ryan Lovett's comment about
5151
it](https://github.com/jupyterhub/jupyter-server-proxy/pull/359#issuecomment-1350118197).
5252

5353
## Install
@@ -58,18 +58,22 @@ it](https://github.com/jupyterhub/jupyter-server-proxy/pull/359#issuecomment-135
5858

5959
### Python package
6060

61-
#### pip
61+
#### `pip`
6262

63-
```
63+
```bash
6464
pip install jupyter-server-proxy
6565
```
6666

67-
#### conda
67+
#### `conda`
6868

69-
```
69+
```bash
7070
conda install jupyter-server-proxy -c conda-forge
7171
```
7272

73+
#### Local development
74+
75+
> See the [contributing guide](https://github.com/jupyterhub/jupyter-server-proxy/blob/main/CONTRIBUTING.md).
76+
7377
### JupyterLab extension
7478

7579
Note that as the JupyterLab extension only is a graphical interface to
@@ -79,30 +83,27 @@ requires the python package to be installed.
7983
As of version 3.0.0 the Python package ships with a JupyterLab 3 compatible
8084
extension, making this step only needed for JupyterLab 2.
8185

82-
```
86+
```bash
8387
jupyter labextension install @jupyterhub/jupyter-server-proxy
8488
```
8589

8690
## Disable
8791

8892
### Server extension
8993

90-
``` 
91-
jupyter serverextension disable jupyter_server_proxy
94+
```bash
95+
jupyter serverextension disable --sys-prefix jupyter_server_proxy
96+
jupyter server extension disable --sys-prefix jupyter_server_proxy
9297
```
9398

9499
### Notebook classic extension
95100

96-
```
97-
jupyter nbextension disable --py jupyter_server_proxy
101+
```bash
102+
jupyter nbextension disable --sys-prefix --py jupyter_server_proxy
98103
```
99104

100105
### JupyterLab extension
101106

102-
```
107+
```bash
103108
jupyter labextension disable @jupyterhub/jupyter-server-proxy
104109
```
105-
106-
## Local development
107-
108-
See [CONTRIBUTING.md](CONTRIBUTING.md).

RELEASE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ These are instructions on how to make a release.
2020
```shell
2121
rm labextension/yarn.lock
2222

23-
pip install jupyter_packaging wheel jupyterlab~=3.0
24-
python setup.py sdist bdist_wheel
23+
pip install --upgrade pip build
24+
pyproject-build
2525
```
2626

2727
2. Create a PR updating `docs/source/changelog.md` with [github-activity][] and

labextension/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# @jupyterhub/jupyter-server-proxy labextension
1+
# `@jupyterhub/jupyter-server-proxy`
22

3-
This JupyterLab extension that is bundled and requires with the PyPI package
4-
jupyter-server-proxy adds items to the JupyterLab [Launcher] representing the
5-
configured server processes.
3+
A JupyterLab extension that adds items to the JupyterLab [Launcher] representing the
4+
configured server processes managed by the python package `jupyter-server-proxy` (required).
65

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

@@ -25,7 +24,7 @@ conda install jupyter-server-proxy
2524
```
2625

2726
> As a _prebuilt_ extension, it will "just work," only a simple page reload should be required
28-
> to see launcher items. However, a full restart of `jupyter_server` or `notebook` is required
27+
> to see launcher items. However, a full restart of `jupyter_server` or `notebook` is required
2928
> to reload the `jupyter_server_proxy` serverextension which provides most of the functionality.
3029
3130
### JupyterLab 2

0 commit comments

Comments
 (0)