Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Python 3.11 and new emscripten-wasm32 platform #164

Merged
merged 4 commits into from
Oct 11, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 38 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defaults:
shell: bash -l {0}

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,27 +24,33 @@ jobs:
environment-file: environment.yml
cache-environment: true

- name: Dev install
- name: Lint
run: |
set -eux
jlpm
jlpm run build
jlpm run lint:check
python -m pip install -v .
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/xeus-python-kernel.*OK"

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: environment.yml
cache-environment: true

- name: Build the extension
run: |
pip install build
python -m build --sdist
cp dist/*.tar.gz jupyterlite-xeus-python.tar.gz
pip uninstall -y jupyterlite-xeus-python jupyterlab
rm -rf jupyterlite-xeus-python
run: python -m build

- uses: actions/upload-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
path: jupyterlite-xeus-python.tar.gz
name: dist ${{ github.run_number }}
path: ./dist

test_isolated:
needs: build
Expand All @@ -60,19 +66,21 @@ jobs:
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
name: dist ${{ github.run_number }}
path: ./dist
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install jupyterlite-xeus-python.tar.gz
pip install jupyterlite_xeus_python*.tar.gz
pip install "jupyterlab==4"
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/xeus-python-kernel.*OK"

# TODO: add JupyterLite browser check
# python -m jupyterlab.browser_check --no-chrome-test
working-directory: dist

python-tests-mamba-python:
needs: build
Expand All @@ -84,7 +92,8 @@ jobs:

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
name: dist ${{ github.run_number }}
path: ./dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -99,7 +108,8 @@ jobs:
python -c "from mamba.api import create"

- name: Install
run: pip install jupyterlite-xeus-python.tar.gz
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
Expand All @@ -115,7 +125,8 @@ jobs:

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
name: dist ${{ github.run_number }}
path: ./dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -125,7 +136,8 @@ jobs:
cache-environment: true

- name: Install
run: pip install jupyterlite-xeus-python.tar.gz
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
Expand All @@ -141,7 +153,8 @@ jobs:

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
name: dist ${{ github.run_number }}
path: ./dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -151,7 +164,8 @@ jobs:
cache-environment: true

- name: Install
run: pip install jupyterlite-xeus-python.tar.gz
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
Expand All @@ -167,7 +181,8 @@ jobs:

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-sdist
name: dist ${{ github.run_number }}
path: ./dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -177,7 +192,8 @@ jobs:
cache-environment: true

- name: Install
run: pip install jupyterlite-xeus-python.tar.gz
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Say you want to install `NumPy`, `Matplotlib` and `ipycanvas`, it can be done by
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- matplotlib
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Say you want to install `NumPy`, `Matplotlib` and `ipycanvas`, it can be done by
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- matplotlib
Expand Down Expand Up @@ -73,7 +73,7 @@ For example, if you were to install `ipycanvas` from PyPI, you would need to ins
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- pillow
Expand All @@ -89,7 +89,7 @@ a jupyterlite deployment in your Package documentation, allowing to test the ver
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- pip:
- ..
Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: xeus-python-kernel-docs
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- matplotlib
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
- conda-forge/label/jupyterlite_core_alpha
dependencies:
- python
- build
- pip
- jupyterlab >=4.0,<5
- jupyterlite-core >=0.2.0a1,<0.3.0
Expand Down
9 changes: 5 additions & 4 deletions jupyterlite_xeus_python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
CONDA_COMMAND = shutil.which("conda")

PYTHON_MAJOR = 3
PYTHON_MINOR = 10
PYTHON_MINOR = 11
PYTHON_VERSION = f"{PYTHON_MAJOR}.{PYTHON_MINOR}"

XEUS_PYTHON_VERSION = "0.15.9"
XEUS_PYTHON_VERSION = "0.15.10"

CHANNELS = [
"https://repo.mamba.pm/emscripten-forge",
"https://repo.mamba.pm/conda-forge",
"conda-forge",
]

PLATFORM = "emscripten-32"
PLATFORM = "emscripten-wasm32"
DEFAULT_REQUEST_TIMEOUT = 1 # in minutes


Expand Down Expand Up @@ -74,6 +74,7 @@ def create_env(
MICROMAMBA_COMMAND,
"create",
"--yes",
"--no-pyc",
"--root-prefix",
root_prefix,
"--name",
Expand Down
2 changes: 1 addition & 1 deletion tests/environment-1.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: xeus-python-kernel-1
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- matplotlib
Expand Down
2 changes: 1 addition & 1 deletion tests/environment-2.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: xeus-python-kernel-2
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- pip:
# Installing NumPy with pip should fail
Expand Down
2 changes: 1 addition & 1 deletion tests/test_package/environment-3.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: xeus-python-kernel-3
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
- conda-forge
dependencies:
- numpy
- pip:
Expand Down
14 changes: 7 additions & 7 deletions tests/test_xeus_python_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ def test_python_env_from_file_1():
assert os.path.isfile("/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/bin/xpython_wasm.wasm")

# Checking pip packages
assert os.path.isdir("/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.10")
assert os.path.isdir("/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.11")
assert os.path.isdir(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.10/site-packages"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.11/site-packages"
)
assert os.path.isdir(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.10/site-packages/ipywidgets"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.11/site-packages/ipywidgets"
)
assert os.path.isdir(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.10/site-packages/ipycanvas"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.11/site-packages/ipycanvas"
)
assert os.path.isdir(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.10/site-packages/py2vega"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-1/lib/python3.11/site-packages/py2vega"
)

# Checking labextensions
Expand Down Expand Up @@ -91,10 +91,10 @@ def test_python_env_from_file_3():

# Test
assert os.path.isdir(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.10/site-packages/test_package"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.11/site-packages/test_package"
)
assert os.path.isfile(
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.10/site-packages/test_package/hey.py"
"/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.11/site-packages/test_package/hey.py"
)

os.remove(Path(addon.cwd.name) / "empack_env_meta.json")
Expand Down
Loading