Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to hatch-based build system and fix CI #541

Merged
merged 6 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
[bdist_wheel]
universal=1

[metadata]
license_file = LICENSE

[flake8]
exclude = docs, _version.py, .eggs, example
exclude = docs, _version.py, .eggs, example node_modules
max-line-length = 88
docstring-convention = "numpy"
extend-ignore =
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ defaults:
run:
shell: bash -l {0}
jobs:
build:
build_docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
channels: conda-forge
- name: Install
run: python -m pip install -v .[docs]
- name: Build
Expand Down
44 changes: 23 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
channels: conda-forge
environment-file: dev-environment.yml

- name: Build packages
run: |
python setup.py sdist bdist_wheel
python -m build
cd dist
sha256sum * | tee SHA256SUMS

Expand All @@ -49,25 +46,30 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos]
python: ['3.10', '3.9']
mpl-version: ['3.5', 'latest']
python: ['3.9', '3.12']
mpl-version: ['latest']
dist: ['ipympl*.whl']
include:
- python: '3.10'
dist: 'ipympl*.tar.gz'
- python: '3.9'
# Earliest supported Matplotlib, needs python <= 3.10
- os: ubuntu
python: '3.9'
mpl-version: '3.5'
dist: 'ipympl*.whl'
# Install from sdist not wheel
- os: ubuntu
python: '3.11'
mpl-version: 'latest'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we missing an os entry here? I wonder if this is the reason why the workflow does not start

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've corrected this now.

Could you cancel the old CI runs as I don't have permissions to do that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

dist: 'ipympl*.tar.gz'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
channels: conda-forge
extra-specs: |
create-args: >-
python=${{ matrix.python }}

- if: matrix.mpl-version == 'latest'
Expand Down Expand Up @@ -104,18 +106,18 @@ jobs:
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib

- name: Run pytest
run: pytest .
run: pytest -v .

- name: Install Galata test dependencies
if: matrix.os == 'ubuntu'
run: |
yarn install
yarn playwright install chromium
jlpm install
jlpm playwright install chromium
working-directory: ui-tests

- name: Launch JupyterLab
if: matrix.os == 'ubuntu'
run: yarn run start:detached
run: jlpm start:detached
working-directory: ui-tests

- name: Wait for JupyterLab
Expand All @@ -127,7 +129,7 @@ jobs:

- name: Run UI Tests
if: matrix.os == 'ubuntu'
run: yarn run test
run: jlpm test
working-directory: ui-tests

- name: Upload UI Test artifacts
Expand All @@ -150,7 +152,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
MATPLOLIBT: ${{ matrix.mpl-version }}
MATPLOTLIB: ${{ matrix.mpl-version }}
RUN_ID: ${{ github.run_id }}
TITLE: '[test-bot] Scheduled Tests are failing'
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: Publish the NPM package
run: |
yarn install && yarn run build
jlpm install && jlpm build
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/update_galata_references.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-name: ipympl-dev
environment-file: dev-environment.yml
python-version: 3.9
auto-activate-base: false
channels: conda-forge

create-args: >-
python=3.9
- name: Install ipympl
run: pip install .

- name: Install Galata
run: |
yarn install
yarn playwright install chromium
jlpm install
jlpm playwright install chromium
working-directory: ui-tests

- name: Launch JupyterLab
run: yarn run start:detached
run: jlpm start:detached
working-directory: ui-tests

- name: Wait for JupyterLab
Expand All @@ -61,7 +58,7 @@ jobs:
timeout: 20000

- name: Generate updated Galata References
run: yarn run test:update
run: jlpm test:update
working-directory: ui-tests

- name: Compress screenshots
Expand Down
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports", "--ignore-init-module-imports", "--remove-unused-variables"]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
Expand All @@ -36,17 +36,17 @@ repos:
- id: prettier
types: [ts]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v8.19.0'
hooks:
- id: eslint
files: \.ts$ # *.ts
types: [file]
additional_dependencies:
- eslint
- prettier
- typescript
- '@typescript-eslint/eslint-plugin'
- '@typescript-eslint/parser'
- 'eslint-config-prettier'
- 'eslint-plugin-prettier'
# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: 'v8.19.0'
# hooks:
# - id: eslint
# files: \.ts$ # *.ts
# types: [file]
# additional_dependencies:
# - eslint
# - prettier
# - typescript
# - '@typescript-eslint/eslint-plugin'
# - '@typescript-eslint/parser'
# - 'eslint-config-prettier'
# - 'eslint-plugin-prettier'
28 changes: 0 additions & 28 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ notebook / lab frontend. For lab, this is done by the command:

```bash
jupyter labextension develop --overwrite .
yarn run build
jlpm build
```

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

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
yarn run watch
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```
Expand Down
1 change: 0 additions & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
dependencies:
- pip
- yarn
- jupyter-packaging
- jupyterlab=3
- ipywidgets>=7.6
- pillow
Expand Down
8 changes: 4 additions & 4 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Fix numpydoc format delimiters */
.classifier:before {
font-style: normal;
margin: 0.5em;
content: ":";
font-style: normal;
margin: 0.5em;
content: ':';
}

/* override table no-wrap */
.wy-table-responsive table td,
.wy-table-responsive table th {
white-space: normal;
white-space: normal;
}
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ notebook / lab frontend. For lab, this is done by the command:

```bash
jupyter labextension develop --overwrite .
yarn run build
jlpm build
```

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

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
yarn run watch
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
"url": "https://github.com/matplotlib/jupyter-matplotlib.git"
},
"scripts": {
"build": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev",
"build:prod": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension",
"build": "jlpm build:lib && jlpm build:nbextension && jlpm build:labextension:dev",
"build:prod": "jlpm build:lib && jlpm build:nbextension && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:nbextension": "webpack --mode=production",
"clean": "yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension",
"clean": "jlpm clean:lib && jlpm clean:nbextension && jlpm clean:labextension",
"clean:lib": "rimraf lib",
"clean:labextension": "rimraf ipympl/labextension",
"clean:nbextension": "rimraf ipympl/nbextension/static/index.js",
"prepack": "yarn run build:lib",
"prepack": "jlpm build:lib",
"test": "jest",
"watch": "npm-run-all -p watch:*",
"watch:lib": "tsc -w",
"watch:nbextension": "webpack --watch --mode=development",
"watch:labextension": "jupyter labextension watch .",
"eslint": "eslint . --fix --ignore-path .eslintignore --ext .ts",
"eslint:check": "eslint . --ignore-path .eslintignore --ext .ts",
"lint": "yarn run prettier && yarn run eslint",
"lint:check": "yarn run prettier:check && yarn run eslint:check",
"prepublish": "yarn run clean && yarn run build",
"lint": "jlpm prettier && jlpm eslint",
"lint:check": "jlpm prettier:check && jlpm eslint:check",
"prepublish": "jlpm clean && jlpm build",
"prettier": "prettier --ignore-path .eslintignore --write \"**/*{.ts,.css,.json}\"",
"prettier:check": "prettier --check --ignore-path .eslintignore \"**/*{.ts,.css,.json}\""
},
Expand All @@ -57,6 +57,7 @@
"@phosphor/application": "^1.6.0",
"@phosphor/widgets": "^1.6.0",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.202",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
Expand All @@ -76,13 +77,14 @@
"style-loader": "^1.0.0",
"ts-jest": "^26.0.0",
"ts-loader": "^8.0.0",
"typescript": "~4.1.3",
"typescript": "^4.0.0",
"webpack": "^5.61.0",
"webpack-cli": "^4.0.0"
},
"dependencies": {
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@types/node": "^14.14.35",
"crypto": "1.0.1",
"lodash": "^4.17.21"
},
"keywords": [
Expand Down