Skip to content

✨ Jupyterlab 4.4 + Python 3.12 + 3.13 Support #393

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

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b81a703
Update README.md
wmeddie Jun 4, 2023
88c7a8e
bump main jupyterlab version to 4.4
MFA-X-AI Apr 18, 2025
3a5dab8
bump test versions
MFA-X-AI Apr 18, 2025
35cd4d4
limit tcli est run to 5 mins
MFA-X-AI Apr 18, 2025
d97369b
update lock file
MFA-X-AI Apr 18, 2025
30b799e
drop support for py3.8
MFA-X-AI Apr 18, 2025
a0aa144
update component list to only search on xai_*/*.py level
MFA-X-AI Mar 12, 2025
f663452
add wip tests
MFA-X-AI Mar 17, 2025
5550693
Add new tests
rabea-al Mar 21, 2025
45b35c6
Add run-cli-tests
rabea-al Mar 21, 2025
c0ba056
Fix issues in tests
rabea-al Mar 28, 2025
67e4f64
Fixed bug causing installed libraries to show as incomplete
rabea-al Mar 28, 2025
235f3d8
remove tests for unready features
MFA-X-AI Mar 31, 2025
63fc526
set specific workflow in run test to ensure consistency
MFA-X-AI Mar 31, 2025
d04e52c
Add new Playwright tests
rabea-al Apr 14, 2025
b52122a
Add timout to run CLI workflow
rabea-al Apr 19, 2025
c8f30bd
remove dependency on gradio library
rabea-al Apr 21, 2025
34c823f
bump main jupyterlab version to 4.4
MFA-X-AI Apr 18, 2025
58fe176
bump test versions
MFA-X-AI Apr 18, 2025
94ab02e
limit tcli est run to 5 mins
MFA-X-AI Apr 18, 2025
beb70dd
update lock file
MFA-X-AI Apr 18, 2025
5edbfc2
drop support for py3.8
MFA-X-AI Apr 18, 2025
24d2e63
Fix bugs and skip failing datatype test
rabea-al Apr 22, 2025
97faf49
replace TS tests with Python: literal edit + node connect
rabea-al Apr 23, 2025
320770c
Pause TS tests
rabea-al Apr 23, 2025
5189fb6
Update xircuits_test_utils
rabea-al Apr 23, 2025
9906f33
Merge branch 'fahreza/jupyterlab-4.4' into jupyterlab-4.4
MFA-X-AI Apr 27, 2025
1252656
Merge pull request #395 from rabea-al/jupyterlab-4.4
MFA-X-AI Apr 27, 2025
332cdbe
prevent fail fast for CLI tests
MFA-X-AI Apr 27, 2025
59a3175
specify workflow for cli test 17
MFA-X-AI Apr 27, 2025
c60caa5
add wait before dblclick on xai_tests
rabea-al Apr 28, 2025
3bcb634
Merge pull request #397 from rabea-al/jupyterlab-4.4
MFA-X-AI Apr 28, 2025
caf93f7
Merge tag 'v1.17.2' into fahreza/jupyterlab-4.4
MFA-X-AI Apr 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-python-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/run-cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]


steps:
- name: Checkout code
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ on:
required: false
default: 'master'


jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -78,13 +79,31 @@ jobs:
- name: Install xvfb
run: sudo apt-get install -y xvfb

- name: Install Playwright Dependencies
run: sudo npx playwright install-deps
# - name: Install Playwright Dependencies
# run: sudo npx playwright install-deps

- name: Test E2E
run: |
(jupyter lab --ServerApp.token='' --ServerApp.password='' --LabApp.default_url='/lab?reset' &) && cd ui-tests && npm install && npx playwright install && xvfb-run npx playwright test e2e/datatype-test.spec.ts
# - name: Test E2E (TypeScript)
# run: |
# (jupyter lab --ServerApp.token='' --ServerApp.password='' --LabApp.default_url='/lab?reset' &) && cd ui-tests && npm install && npx playwright install && xvfb-run npx playwright test e2e/datatype-test.spec.ts

- name: Run Python UI Tests
run: |
pip install playwright
playwright install
nohup jupyter lab --ServerApp.token='' --ServerApp.password='' --LabApp.default_url='/lab?reset' > jupyter.log 2>&1 &
sleep 10
cd ui-tests/tests
xvfb-run -a python3 arg_input_ui_test.py
xvfb-run -a python3 parameter-names-autoshift.py
xvfb-run -a python3 parameter-names-despawn.py
xvfb-run -a python3 parameter-names-spawn.py
xvfb-run -a python3 protected-nodes-and-lock-test.py
xvfb-run -a python3 remote_run_arguments_test.py
xvfb-run -a python3 connecting-nodes-test.py
xvfb-run -a python3 editing-literal-nodes-test.py



- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<h1>PyPI rocks!</h1>
<p align="center">
<img src="https://user-images.githubusercontent.com/68586800/151280601-7ff2b7b2-10e5-4544-b3df-aa6a5a654dae.png" width="450"/>
</p>
Expand Down Expand Up @@ -31,7 +32,7 @@
<img alt="Documentation" src="https://img.shields.io/website/http/xircuits.io.svg?color=orange">
</a>
<a>
<img alt="Python" src="https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue">
<img alt="Python" src="https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue">
</a>
</p>

Expand Down
31 changes: 17 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/application": "^4.4.0",
"@jupyterlab/coreutils": "^6.0.0",
"@jupyterlab/fileeditor": "4.0.9",
"@jupyterlab/launcher": "^4.0.9",
"@jupyterlab/logconsole": "^4.0.9",
"@jupyterlab/mainmenu": "^4.0.9",
"@jupyterlab/services": "^7.0.0",
"@jupyterlab/settingregistry": "^4.0.0",
"@projectstorm/geometry": "^7.0.2",
"@projectstorm/react-diagrams": "^7.0.3",
"@jupyterlab/fileeditor": "4.4.0",
"@jupyterlab/launcher": "^4.4.0",
"@jupyterlab/logconsole": "^4.4.0",
"@jupyterlab/mainmenu": "^4.4.0",
"@jupyterlab/services": "^7.4.0",
"@jupyterlab/settingregistry": "^4.4.0",
"@projectstorm/geometry": "7.0.2",
"@projectstorm/react-canvas-core": "7.0.2",
"@projectstorm/react-diagrams": "7.0.3",
"@projectstorm/react-diagrams-core": "7.0.2",
"@projectstorm/react-diagrams-defaults": "7.1.2",
"colorjs.io": "^0.4.5",
"marked": "^11.0.0",
"react-accessible-accordion": "^5.0.0",
Expand All @@ -76,8 +79,8 @@
"react-tooltip": "^4.2.21"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
"@jupyterlab/testutils": "^4.0.0",
"@jupyterlab/builder": "^4.4.0",
"@jupyterlab/testutils": "^4.4.0",
"@types/jest": "^29.2.0",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.0.26",
Expand All @@ -95,11 +98,11 @@
"rimraf": "^5.0.1",
"source-map-loader": "^1.0.2",
"style-loader": "^3.3.1",
"stylelint": "^15.10.1",
"stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard": "^38.0.0",
"stylelint-csstree-validator": "^3.0.0",
"stylelint-prettier": "^4.0.0",
"stylelint-prettier": "^5.0.3",
"typescript": "~5.0.2",
"yjs": "^13.5.0"
},
Expand Down
23 changes: 14 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
[build-system]
requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version>=0.3.2"]
requires = [
"hatchling>=1.5.0",
"hatch-jupyter-builder>=0.9.1",
"jupyterlab>=4.0.0,<5",
"hatch-nodejs-version>=0.3.2",
]
build-backend = "hatchling.build"

[project]
Expand All @@ -22,7 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"jupyterlab>=4.0.0,<4.1",
"jupyterlab>=4.4.0,<4.5",
"jupyter_server>=2.0.1,<3",
"requests",
"toml",
Expand Down Expand Up @@ -63,7 +68,7 @@ exclude = [".github", "binder", "node_modules", "lib", ".yarn"]
path = "xircuits/_version.py"

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
dependencies = ["hatch-jupyter-builder>=0.9.1"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"xircuits/labextension/static/style.js",
Expand All @@ -73,13 +78,13 @@ skip-if-exists = ["xircuits/labextension/static/style.js"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
npm = ["jlpm"]
npm = ["jlpm"]

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "xircuits/labextension"
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "xircuits/labextension"

[tool.jupyter-releaser.options]
version_cmd = "hatch version"
Expand Down Expand Up @@ -107,4 +112,4 @@ include = [
"xircuits/",
"examples/",
]
artifacts = ["xircuits/labextension"]
artifacts = ["xircuits/labextension"]
7 changes: 1 addition & 6 deletions tests/cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,7 @@ def test_16_run_existing_py_file():
def test_17_run_with_custom_output():
"""Test run with a custom output file name"""
run_command("xircuits init")

# Find an example file in the xai_controlflow folder
example_files = list(Path("xai_components/xai_controlflow").glob("*.xircuits"))
assert example_files, "No .xircuits files found in xai_controlflow."
example_file = str(example_files[0])

example_file = "xai_components/xai_controlflow/ControlflowBranch.xircuits"
custom_output = "custom_output.py"
# run with the custom output name
stdout, stderr, return_code = run_command(f"xircuits run {example_file} {custom_output}")
Expand Down
65 changes: 64 additions & 1 deletion ui-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,67 @@ PWDEBUG=1 npx playwright test
Alternatively, if you would like to debug in the browser console:
```
PWDEBUG=console npx playwright test testname.spec.ts
``
```

## Run Python-based Playwright UI Tests

This section describes how to run the new **Python-based UI tests** located in the `ui-tests/` folder using [Playwright](https://playwright.dev/python).

These tests simulate user interactions with Xircuits inside JupyterLab and cover various UI behaviors such as argument input, remote run, port spawning, and node protection.

---

### Prerequisites

Ensure you have the following:

- Python 3.11 or later (recommended)
- `pip` and `virtualenv`
- Xircuits

Install Playwright for Python:

```bash
pip install playwright
playwright install
```

---

### Running the tests

1. Launch JupyterLab in one terminal:

```bash
jupyter lab --ServerApp.token= --ServerApp.password= --LabApp.default_url=/lab\?reset
```

2. In a separate terminal, run one of the test scripts:

```bash
cd ui-tests
python arg_input_ui_test.py
python remote_run_arguments_test.py
python autospawn_and_despawn_ports_test.py
python protected-nodes-and-lock-test.py
```

> Tip: you can pause tests at the end with `input("any")` to let you inspect the result before closing the browser.

---

### Tests Overview

- **`arg_input_ui_test.py`**
Verifies that argument input prompts appear correctly.

- **`remote_run_arguments_test.py`**
Tests remote run with string, float, and boolean arguments.

- **`autospawn_and_despawn_ports_test.py`**
Checks dynamic port spawning and removal when components are connected/disconnected.

- **`protected-nodes-and-lock-test.py`**
Ensures that Start/Finish nodes can't be deleted and locked components remain protected.

For more details about the helper functions, refer to `ui-tests/xircuits_test_utils.py`.
Loading