Skip to content

Commit c218e07

Browse files
authored
Update to hatch-based build system and fix CI (#541)
* Update to hatch-based build system and fix CI * Temporarily fix pre-commit hooks * Limit to Python 3.9 to 3.12 * Exclude text from Matplotlib UI image comparison tests * Fix test matrix * Install from sdist on python 3.11 not 3.12 to avoid compiling zmq
1 parent 238d796 commit c218e07

39 files changed

+2958
-4338
lines changed

setup.cfg renamed to .flake8

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
[bdist_wheel]
2-
universal=1
3-
4-
[metadata]
5-
license_file = LICENSE
6-
71
[flake8]
8-
exclude = docs, _version.py, .eggs, example
2+
exclude = docs, _version.py, .eggs, example node_modules
93
max-line-length = 88
104
docstring-convention = "numpy"
115
extend-ignore =

.github/workflows/docs.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ defaults:
77
run:
88
shell: bash -l {0}
99
jobs:
10-
build:
10+
build_docs:
1111
runs-on: ubuntu-20.04
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Install Conda environment with Micromamba
15-
uses: mamba-org/provision-with-micromamba@main
15+
uses: mamba-org/setup-micromamba@v1
1616
with:
17-
environment-name: ipympl-dev
1817
environment-file: dev-environment.yml
19-
channels: conda-forge
2018
- name: Install
2119
run: python -m pip install -v .[docs]
2220
- name: Build

.github/workflows/main.yml

+23-21
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
2221
- name: Checkout
2322
uses: actions/checkout@v2
2423

2524
- name: Install Conda environment with Micromamba
26-
uses: mamba-org/provision-with-micromamba@main
25+
uses: mamba-org/setup-micromamba@v1
2726
with:
28-
environment-name: ipympl-dev
29-
environment-file: dev-environment.yml
30-
channels: conda-forge
27+
environment-file: dev-environment.yml
3128

3229
- name: Build packages
3330
run: |
34-
python setup.py sdist bdist_wheel
31+
python -m build
3532
cd dist
3633
sha256sum * | tee SHA256SUMS
3734
@@ -49,25 +46,30 @@ jobs:
4946
fail-fast: false
5047
matrix:
5148
os: [ubuntu, macos]
52-
python: ['3.10', '3.9']
53-
mpl-version: ['3.5', 'latest']
49+
python: ['3.9', '3.12']
50+
mpl-version: ['latest']
51+
dist: ['ipympl*.whl']
5452
include:
55-
- python: '3.10'
56-
dist: 'ipympl*.tar.gz'
57-
- python: '3.9'
53+
# Earliest supported Matplotlib, needs python <= 3.10
54+
- os: ubuntu
55+
python: '3.9'
56+
mpl-version: '3.5'
5857
dist: 'ipympl*.whl'
58+
# Install from sdist not wheel
59+
- os: ubuntu
60+
python: '3.11'
61+
mpl-version: 'latest'
62+
dist: 'ipympl*.tar.gz'
5963

6064
steps:
6165
- name: Checkout
6266
uses: actions/checkout@v2
6367

6468
- name: Install Conda environment with Micromamba
65-
uses: mamba-org/provision-with-micromamba@main
69+
uses: mamba-org/setup-micromamba@v1
6670
with:
67-
environment-name: ipympl-dev
6871
environment-file: dev-environment.yml
69-
channels: conda-forge
70-
extra-specs: |
72+
create-args: >-
7173
python=${{ matrix.python }}
7274
7375
- if: matrix.mpl-version == 'latest'
@@ -104,18 +106,18 @@ jobs:
104106
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib
105107

106108
- name: Run pytest
107-
run: pytest .
109+
run: pytest -v .
108110

109111
- name: Install Galata test dependencies
110112
if: matrix.os == 'ubuntu'
111113
run: |
112-
yarn install
113-
yarn playwright install chromium
114+
jlpm install
115+
jlpm playwright install chromium
114116
working-directory: ui-tests
115117

116118
- name: Launch JupyterLab
117119
if: matrix.os == 'ubuntu'
118-
run: yarn run start:detached
120+
run: jlpm start:detached
119121
working-directory: ui-tests
120122

121123
- name: Wait for JupyterLab
@@ -127,7 +129,7 @@ jobs:
127129

128130
- name: Run UI Tests
129131
if: matrix.os == 'ubuntu'
130-
run: yarn run test
132+
run: jlpm test
131133
working-directory: ui-tests
132134

133135
- name: Upload UI Test artifacts
@@ -150,7 +152,7 @@ jobs:
150152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151153
OS: ${{ matrix.os }}
152154
PYTHON: ${{ matrix.python }}
153-
MATPLOLIBT: ${{ matrix.mpl-version }}
155+
MATPLOTLIB: ${{ matrix.mpl-version }}
154156
RUN_ID: ${{ github.run_id }}
155157
TITLE: '[test-bot] Scheduled Tests are failing'
156158
with:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
3939
- name: Publish the NPM package
4040
run: |
41-
yarn install && yarn run build
41+
jlpm install && jlpm build
4242
npm publish
4343
env:
4444
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/update_galata_references.yaml

+7-10
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,22 @@ jobs:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434

3535
- name: Install Conda environment with Micromamba
36-
uses: mamba-org/provision-with-micromamba@main
36+
uses: mamba-org/setup-micromamba@v1
3737
with:
38-
environment-name: ipympl-dev
3938
environment-file: dev-environment.yml
40-
python-version: 3.9
41-
auto-activate-base: false
42-
channels: conda-forge
43-
39+
create-args: >-
40+
python=3.9
4441
- name: Install ipympl
4542
run: pip install .
4643

4744
- name: Install Galata
4845
run: |
49-
yarn install
50-
yarn playwright install chromium
46+
jlpm install
47+
jlpm playwright install chromium
5148
working-directory: ui-tests
5249

5350
- name: Launch JupyterLab
54-
run: yarn run start:detached
51+
run: jlpm start:detached
5552
working-directory: ui-tests
5653

5754
- name: Wait for JupyterLab
@@ -61,7 +58,7 @@ jobs:
6158
timeout: 20000
6259

6360
- name: Generate updated Galata References
64-
run: yarn run test:update
61+
run: jlpm test:update
6562
working-directory: ui-tests
6663

6764
- name: Compress screenshots

.pre-commit-config.yaml

+15-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- id: autoflake
1919
args: ["--in-place", "--remove-all-unused-imports", "--ignore-init-module-imports", "--remove-unused-variables"]
2020
- repo: https://github.com/PyCQA/isort
21-
rev: 5.10.1
21+
rev: 5.13.2
2222
hooks:
2323
- id: isort
2424
- repo: https://github.com/psf/black
@@ -36,17 +36,17 @@ repos:
3636
- id: prettier
3737
types: [ts]
3838

39-
- repo: https://github.com/pre-commit/mirrors-eslint
40-
rev: 'v8.19.0'
41-
hooks:
42-
- id: eslint
43-
files: \.ts$ # *.ts
44-
types: [file]
45-
additional_dependencies:
46-
- eslint
47-
- prettier
48-
- typescript
49-
- '@typescript-eslint/eslint-plugin'
50-
- '@typescript-eslint/parser'
51-
- 'eslint-config-prettier'
52-
- 'eslint-plugin-prettier'
39+
# - repo: https://github.com/pre-commit/mirrors-eslint
40+
# rev: 'v8.19.0'
41+
# hooks:
42+
# - id: eslint
43+
# files: \.ts$ # *.ts
44+
# types: [file]
45+
# additional_dependencies:
46+
# - eslint
47+
# - prettier
48+
# - typescript
49+
# - '@typescript-eslint/eslint-plugin'
50+
# - '@typescript-eslint/parser'
51+
# - 'eslint-config-prettier'
52+
# - 'eslint-plugin-prettier'

MANIFEST.in

-28
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ notebook / lab frontend. For lab, this is done by the command:
105105

106106
```bash
107107
jupyter labextension develop --overwrite .
108-
yarn run build
108+
jlpm build
109109
```
110110

111111
For classic notebook, you need to run:
@@ -122,7 +122,7 @@ If you use JupyterLab to develop then you can watch the source directory and run
122122

123123
```bash
124124
# Watch the source directory in one terminal, automatically rebuilding when needed
125-
yarn run watch
125+
jlpm watch
126126
# Run JupyterLab in another terminal
127127
jupyter lab
128128
```

dev-environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ channels:
44
dependencies:
55
- pip
66
- yarn
7-
- jupyter-packaging
87
- jupyterlab=3
98
- ipywidgets>=7.6
109
- pillow

docs/_static/custom.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* Fix numpydoc format delimiters */
22
.classifier:before {
3-
font-style: normal;
4-
margin: 0.5em;
5-
content: ":";
3+
font-style: normal;
4+
margin: 0.5em;
5+
content: ':';
66
}
77

88
/* override table no-wrap */
99
.wy-table-responsive table td,
1010
.wy-table-responsive table th {
11-
white-space: normal;
11+
white-space: normal;
1212
}

docs/contributing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ notebook / lab frontend. For lab, this is done by the command:
2626

2727
```bash
2828
jupyter labextension develop --overwrite .
29-
yarn run build
29+
jlpm build
3030
```
3131

3232
For classic notebook, you need to run:
@@ -45,7 +45,7 @@ If you use JupyterLab to develop then you can watch the source directory and run
4545

4646
```bash
4747
# Watch the source directory in one terminal, automatically rebuilding when needed
48-
yarn run watch
48+
jlpm watch
4949
# Run JupyterLab in another terminal
5050
jupyter lab
5151
```

package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@
1616
"url": "https://github.com/matplotlib/jupyter-matplotlib.git"
1717
},
1818
"scripts": {
19-
"build": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev",
20-
"build:prod": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension",
19+
"build": "jlpm build:lib && jlpm build:nbextension && jlpm build:labextension:dev",
20+
"build:prod": "jlpm build:lib && jlpm build:nbextension && jlpm build:labextension",
2121
"build:labextension": "jupyter labextension build .",
2222
"build:labextension:dev": "jupyter labextension build --development True .",
2323
"build:lib": "tsc",
2424
"build:nbextension": "webpack --mode=production",
25-
"clean": "yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension",
25+
"clean": "jlpm clean:lib && jlpm clean:nbextension && jlpm clean:labextension",
2626
"clean:lib": "rimraf lib",
2727
"clean:labextension": "rimraf ipympl/labextension",
2828
"clean:nbextension": "rimraf ipympl/nbextension/static/index.js",
29-
"prepack": "yarn run build:lib",
29+
"prepack": "jlpm build:lib",
3030
"test": "jest",
3131
"watch": "npm-run-all -p watch:*",
3232
"watch:lib": "tsc -w",
3333
"watch:nbextension": "webpack --watch --mode=development",
3434
"watch:labextension": "jupyter labextension watch .",
3535
"eslint": "eslint . --fix --ignore-path .eslintignore --ext .ts",
3636
"eslint:check": "eslint . --ignore-path .eslintignore --ext .ts",
37-
"lint": "yarn run prettier && yarn run eslint",
38-
"lint:check": "yarn run prettier:check && yarn run eslint:check",
39-
"prepublish": "yarn run clean && yarn run build",
37+
"lint": "jlpm prettier && jlpm eslint",
38+
"lint:check": "jlpm prettier:check && jlpm eslint:check",
39+
"prepublish": "jlpm clean && jlpm build",
4040
"prettier": "prettier --ignore-path .eslintignore --write \"**/*{.ts,.css,.json}\"",
4141
"prettier:check": "prettier --check --ignore-path .eslintignore \"**/*{.ts,.css,.json}\""
4242
},
@@ -57,6 +57,7 @@
5757
"@phosphor/application": "^1.6.0",
5858
"@phosphor/widgets": "^1.6.0",
5959
"@types/jest": "^26.0.0",
60+
"@types/lodash": "^4.14.202",
6061
"@types/webpack-env": "^1.13.6",
6162
"@typescript-eslint/eslint-plugin": "^3.6.0",
6263
"@typescript-eslint/parser": "^3.6.0",
@@ -76,13 +77,14 @@
7677
"style-loader": "^1.0.0",
7778
"ts-jest": "^26.0.0",
7879
"ts-loader": "^8.0.0",
79-
"typescript": "~4.1.3",
80+
"typescript": "^4.0.0",
8081
"webpack": "^5.61.0",
8182
"webpack-cli": "^4.0.0"
8283
},
8384
"dependencies": {
8485
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
8586
"@types/node": "^14.14.35",
87+
"crypto": "1.0.1",
8688
"lodash": "^4.17.21"
8789
},
8890
"keywords": [

0 commit comments

Comments
 (0)