Skip to content

Commit fee6bcd

Browse files
authored
Migrate to hatch (#52)
* Migrate to `hatch` * Update `check-release` workflow * Update `build.yml` * Remove `environment.yml` * Use `jupyterlab-filesystem-access` in some places * Remove lint workflow
1 parent 043521a commit fee6bcd

File tree

17 files changed

+155
-287
lines changed

17 files changed

+155
-287
lines changed

environment.yml renamed to .binder/environment.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: jupyterlab-filesystem-access
22
channels:
33
- conda-forge
44
dependencies:
5-
- jupyterlab
6-
- yarn
7-
- jupyter-packaging
8-
- build
9-
- check-manifest
5+
- python=3.10
6+
- jupyterlab >=3,<4.0.0a0
7+
- nodejs >=18,<19
108
- pip

.binder/postBuild

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
python -m pip install .

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ dist
33
coverage
44
**/*.d.ts
55
tests
6+
7+
**/__tests__
8+
ui-tests

.github/workflows/build.yml

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,89 @@ name: Build
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: main
76
pull_request:
87
branches: '*'
98

10-
defaults:
11-
run:
12-
shell: bash -l {0}
13-
149
jobs:
1510
build:
16-
runs-on: ${{ matrix.os }}
17-
strategy:
18-
matrix:
19-
os: [ubuntu-latest, windows-latest]
11+
runs-on: ubuntu-latest
12+
2013
steps:
2114
- name: Checkout
22-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
2316

24-
- name: Install Conda environment from environment.yml
25-
uses: mamba-org/provision-with-micromamba@main
17+
- name: Base Setup
18+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
19+
20+
- name: Install dependencies
21+
run: python -m pip install -U jupyterlab~=3.1
22+
23+
- name: Lint the extension
24+
run: |
25+
set -eux
26+
jlpm
27+
jlpm run lint:check
2628
2729
- name: Build the extension
2830
run: |
29-
python -m pip install .
31+
set -eux
32+
python -m pip install .[test]
3033
34+
jupyter labextension list
3135
jupyter labextension list 2>&1 | grep -ie "jupyterlab-filesystem-access.*OK"
3236
python -m jupyterlab.browser_check
3337
34-
check-manifest -v
38+
- name: Package the extension
39+
run: |
40+
set -eux
3541
36-
python -m build --sdist
37-
cp dist/*.tar.gz jupyterlab-filesystem-access.tar.gz
42+
pip install build
43+
python -m build
3844
pip uninstall -y "jupyterlab_filesystem_access" jupyterlab
39-
rm -rf jupyterlab-filesystem-access
4045
41-
- uses: actions/upload-artifact@v2
46+
- name: Upload extension packages
47+
uses: actions/upload-artifact@v3
4248
with:
43-
name: jupyterlab-filesystem-access-sdist
44-
path: jupyterlab-filesystem-access.tar.gz
49+
name: extension-artifacts
50+
path: dist/jupyterlab_filesystem_access*
51+
if-no-files-found: error
4552

4653
test_isolated:
4754
needs: build
48-
runs-on: ${{ matrix.os }}
49-
strategy:
50-
matrix:
51-
os: [ubuntu-latest, windows-latest]
55+
runs-on: ubuntu-latest
5256

5357
steps:
5458
- name: Checkout
55-
uses: actions/checkout@v2
56-
- name: Install Conda environment from environment.yml
57-
uses: mamba-org/provision-with-micromamba@main
58-
- uses: actions/download-artifact@v2
59+
uses: actions/checkout@v3
60+
- name: Install Python
61+
uses: actions/setup-python@v4
62+
with:
63+
python-version: '3.9'
64+
architecture: 'x64'
65+
- uses: actions/download-artifact@v3
5966
with:
60-
name: jupyterlab-filesystem-access-sdist
67+
name: extension-artifacts
6168
- name: Install and Test
6269
run: |
63-
pip install jupyterlab-filesystem-access.tar.gz
70+
set -eux
71+
# Remove NodeJS, twice to take care of system and locally installed node versions.
72+
sudo rm -rf $(which node)
73+
sudo rm -rf $(which node)
74+
75+
pip install "jupyterlab~=3.1" jupyterlab_filesystem_access*.whl
76+
77+
78+
jupyter labextension list
6479
jupyter labextension list 2>&1 | grep -ie "jupyterlab-filesystem-access.*OK"
6580
python -m jupyterlab.browser_check --no-chrome-test
81+
82+
83+
check_links:
84+
name: Check Links
85+
runs-on: ubuntu-latest
86+
timeout-minutes: 15
87+
steps:
88+
- uses: actions/checkout@v3
89+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
90+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

.github/workflows/check-release.yml

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,29 @@
11
name: Check Release
22
on:
33
push:
4-
branches:
5-
- main
4+
branches: ["main"]
65
pull_request:
7-
branches:
8-
- main
9-
10-
permissions:
11-
contents: write
6+
branches: ["*"]
127

138
jobs:
149
check_release:
1510
runs-on: ubuntu-latest
1611
steps:
1712
- name: Checkout
18-
uses: actions/checkout@v2
19-
- name: Install Python
20-
uses: actions/setup-python@v2
21-
with:
22-
python-version: 3.9
23-
architecture: 'x64'
24-
- name: Install node
25-
uses: actions/setup-node@v2
26-
with:
27-
node-version: '14.x'
28-
29-
30-
- name: Get pip cache dir
31-
id: pip-cache
32-
run: |
33-
echo "::set-output name=dir::$(pip cache dir)"
34-
- name: Cache pip
35-
uses: actions/cache@v1
36-
with:
37-
path: ${{ steps.pip-cache.outputs.dir }}
38-
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }}
39-
restore-keys: |
40-
${{ runner.os }}-pip-
41-
- name: Cache checked links
42-
uses: actions/cache@v2
43-
with:
44-
path: ~/.cache/pytest-link-check
45-
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
46-
restore-keys: |
47-
${{ runner.os }}-linkcheck-
48-
- name: Upgrade packaging dependencies
49-
run: |
50-
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
13+
uses: actions/checkout@v3
14+
- name: Base Setup
15+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
5116
- name: Install Dependencies
5217
run: |
53-
pip install .
18+
pip install -e .
5419
- name: Check Release
5520
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
5621
with:
22+
5723
token: ${{ secrets.GITHUB_TOKEN }}
5824

5925
- name: Upload Distributions
60-
uses: actions/upload-artifact@v2
26+
uses: actions/upload-artifact@v3
6127
with:
62-
name: jupyterlab_filesystem_access-releaser-dist-${{ github.run_number }}
28+
name: jupyterlab-filesystem-access-releaser-dist-${{ github.run_number }}
6329
path: .jupyter_releaser_checkout/dist

.github/workflows/lint.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
*.bundle.*
22
lib/
33
node_modules/
4+
*.log
45
.eslintcache
56
.stylelintcache
67
*.egg-info/
78
.ipynb_checkpoints
89
*.tsbuildinfo
910
jupyterlab_filesystem_access/labextension
11+
# Version file is handled by hatchling
12+
jupyterlab_filesystem_access/_version.py
13+
14+
# Integration tests
15+
ui-tests/test-results/
16+
ui-tests/playwright-report/
1017

1118
# Created by https://www.gitignore.io/api/python
1219
# Edit at https://www.gitignore.io/?templates=python
@@ -58,6 +65,7 @@ htmlcov/
5865
.coverage.*
5966
.cache
6067
nosetests.xml
68+
coverage/
6169
coverage.xml
6270
*.cover
6371
.hypothesis/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5+
!/package.json
56
jupyterlab_filesystem_access

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"trailingComma": "none",
4-
"arrowParens": "avoid"
4+
"arrowParens": "avoid",
5+
"endOfLine": "auto"
56
}

.stylelintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"rules": {
88
"property-no-vendor-prefix": null,
99
"selector-no-vendor-prefix": null,
10-
"value-no-vendor-prefix": null,
10+
"value-no-vendor-prefix": null
1111
}
1212
}

MANIFEST.in

Lines changed: 0 additions & 31 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pip install jupyterlab-filesystem-access
4242
To remove the extension, execute:
4343

4444
```bash
45-
pip uninstall jupyterlab_filesystem_access
45+
pip uninstall jupyterlab-filesystem-access
4646
```
4747

4848
## Contributing
@@ -57,7 +57,7 @@ The `jlpm` command is JupyterLab's pinned version of
5757

5858
```bash
5959
# Clone the repo to your local environment
60-
# Change directory to the jupyterlab_filesystem_access directory
60+
# Change directory to the jupyterlab-filesystem-access directory
6161
# Install package in development mode
6262
pip install -e .
6363
# Link your development version of the extension with JupyterLab
@@ -86,7 +86,7 @@ jupyter lab build --minimize=False
8686
### Development uninstall
8787

8888
```bash
89-
pip uninstall jupyterlab_filesystem_access
89+
pip uninstall jupyterlab-filesystem-access
9090
```
9191

9292
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`

install.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"packageManager": "python",
3-
"packageName": "jupyterlab_filesystem_access",
3+
"packageName": "jupyterlab-filesystem-access",
44
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_filesystem_access"
55
}
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
import json
2-
from pathlib import Path
3-
41
from ._version import __version__
52

63

7-
HERE = Path(__file__).parent.resolve()
8-
9-
10-
with (HERE / "labextension" / "package.json").open() as fid:
11-
data = json.load(fid)
12-
13-
144
def _jupyter_labextension_paths():
155
return [{
166
"src": "labextension",
17-
"dest": data["name"]
7+
"dest": "jupyterlab-filesystem-access"
188
}]
199

0 commit comments

Comments
 (0)