Skip to content

Commit

Permalink
Update to Pyodide 0.23, update mocks (#39)
Browse files Browse the repository at this point in the history
* Update to Pyodide 0.23.0a1

* Update CDN

* bump bottom jupyterlite-core

* bump to pyodide 0.23.0

* bump python versions in subpackages

* replace upstream fixtures

* fix proxy instance check

* backport repo checks from #27

* more pytest config

* ignore libarchive warning by env var

* roll back pytest warning settings

---------

Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
  • Loading branch information
bollwyvl and jtpio committed Mar 31, 2023
1 parent 4c3e283 commit 55d8df5
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
EXPECT_BUILD: |-
_output/extensions/@jupyterlite/pyodide-kernel-extension/static/pypi/all.json
JUPYTERLITE_NO_LIBARCHIVE: 1

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion examples/jupyter_lite_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"output_dir": "../build/docs-app",
"ignore_sys_prefix": ["federated_extensions"],
"federated_extensions": [
"https://files.pythonhosted.org/packages/df/82/4576cbc07ebace8c7734fe08b2c2f9123b7ebecd29e932a3b839b6bee2cb/jupyterlab_widgets-3.0.5-py3-none-any.whl",
"https://files.pythonhosted.org/packages/46/98/e7ce879b7b5d4871b80e291be967d22e5e66fa43474c476a95fe6231f50d/jupyterlab_widgets-3.0.7-py3-none-any.whl",
"../jupyterlite_pyodide_kernel/labextension"
],
"cache_dir": "../build/.lite-cache"
Expand Down
2 changes: 1 addition & 1 deletion jupyterlite_pyodide_kernel/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
PYODIDE_URL_ENV_VAR = "JUPYTERLITE_PYODIDE_URL"

#: probably only compatible with this version of pyodide
PYODIDE_VERSION = "0.22.1"
PYODIDE_VERSION = "0.23.0"

#: the only kind of noarch wheel piplite understands
NOARCH_WHL = "py3-none-any.whl"
Expand Down
6 changes: 6 additions & 0 deletions jupyterlite_pyodide_kernel/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
from pathlib import Path
import sys
import pytest
import jupyterlite_core.tests.conftest
from jupyterlite_core.tests.conftest import (
a_fixture_server,
an_empty_lite_dir,
an_unused_port,
)


from jupyterlite_pyodide_kernel.constants import (
PYODIDE_VERSION,
PYODIDE_KERNEL_NPM_NAME,
Expand All @@ -25,6 +27,10 @@
HERE = Path(__file__).parent
FIXTURES = HERE / "fixtures"

# patch the upstream fixtures with local ones
jupyterlite_core.tests.conftest.FIXTURES = FIXTURES


IN_TREE_EXTENSION = (HERE / "../labextension").resolve()
SHARE = Path(sys.prefix) / "share/jupyter/labextensions"
IN_SHARE_EXTENSION = (SHARE / PYODIDE_KERNEL_NPM_NAME).resolve()
Expand Down
42 changes: 42 additions & 0 deletions jupyterlite_pyodide_kernel/tests/test_repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Validate the integrity of the repo (or source checkout)"""
import json
from pathlib import Path

import pytest
from jupyterlite_core.constants import UTF8

from jupyterlite_pyodide_kernel.constants import PYODIDE_VERSION

from .conftest import HERE

PACKAGES = HERE / "../../packages"
KERNEL_PKG = PACKAGES / "pyodide-kernel"
KERNEL_PKG_JSON = KERNEL_PKG / "package.json"

if not KERNEL_PKG_JSON.exists(): # pragma: no cover
pytest.skip(
"not in a source checkout, skipping repo tests", allow_module_level=True
)


def test_pyodide_version():
kernel_pkg_data = json.loads(KERNEL_PKG_JSON.read_text(**UTF8))
assert (
kernel_pkg_data["devDependencies"]["pyodide"] == PYODIDE_VERSION
), f"{kernel_pkg_data} pyodide devDependency is not {PYODIDE_VERSION}"


@pytest.fixture
def the_default_pyodide_url():
return f"https://cdn.jsdelivr.net/pyodide/v{PYODIDE_VERSION}/full/pyodide.js"


@pytest.mark.parametrize(
"pkg_path",
[
"pyodide-kernel-extension/schema/kernel.v0.schema.json",
"pyodide-kernel-extension/src/index.ts",
],
)
def test_pyodide_url(pkg_path: Path, the_default_pyodide_url: str):
assert the_default_pyodide_url in (PACKAGES / pkg_path).read_text(**UTF8)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"pyodideUrl": {
"description": "The path to the main pyodide.js entry point",
"type": "string",
"default": "https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js",
"default": "https://cdn.jsdelivr.net/pyodide/v0.23.0/full/pyodide.js",
"format": "uri"
},
"disablePyPIFallback": {
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const KERNEL_ICON_URL = `data:image/svg+xml;base64,${btoa(KERNEL_ICON_SVG_STR)}`
/**
* The default CDN fallback for Pyodide
*/
const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.22.0/full/pyodide.js';
const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.23.0/full/pyodide.js';

/**
* The id for the extension, and key in the litePlugins.
Expand Down
6 changes: 3 additions & 3 deletions packages/pyodide-kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@types/jest": "^26.0.10",
"esbuild": "0.17.10",
"jest": "^26.4.2",
"pyodide": "0.22.0",
"pyodide": "0.23.0",
"rimraf": "~3.0.0",
"ts-jest": "^26.3.0",
"typescript": "~4.9.4"
Expand All @@ -75,8 +75,8 @@
"py/pyodide-kernel": "0.0.5",
"py/piplite": "0.0.5",
"py/ipykernel": "6.9.2",
"py/widgetsnbextension3/widgetsnbextension": "3.6.0",
"py/widgetsnbextension4/widgetsnbextension": "4.0.2"
"py/widgetsnbextension3/widgetsnbextension": "3.6.4",
"py/widgetsnbextension4/widgetsnbextension": "4.0.7"
}
},
"styleModule": "style/index.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/py/piplite/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{name = "JupyterLite Contributors"},
]
readme = "README.md"
requires-python = ">=3.10,<3.11"
requires-python = ">=3.11,<3.12"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: BSD License",
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/py/pyodide-kernel/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{name = "JupyterLite Contributors"},
]
readme = "README.md"
requires-python = ">=3.10,<3.11"
requires-python = ">=3.11,<3.12"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: BSD License",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{name = "JupyterLite Contributors"},
]
readme = "README.md"
requires-python = ">=3.10,<3.11"
requires-python = ">=3.11,<3.12"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: BSD License",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""A widgetsnbextension mock"""

__version__ = "3.6.0"
__version__ = "3.6.4"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{name = "JupyterLite Contributors"},
]
readme = "README.md"
requires-python = ">=3.10,<3.11"
requires-python = ">=3.11,<3.12"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: BSD License",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""A widgetsnbextension mock"""

__version__ = "4.0.2"
__version__ = "4.0.7"
4 changes: 2 additions & 2 deletions packages/pyodide-kernel/src/_pypi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export * as allJSONUrl from '../pypi/all.json';
export * as ipykernelWheelUrl from '../pypi/ipykernel-6.9.2-py3-none-any.whl';
export * as pipliteWheelUrl from '../pypi/piplite-0.0.5-py3-none-any.whl';
export * as pyodide_kernelWheelUrl from '../pypi/pyodide_kernel-0.0.5-py3-none-any.whl';
export * as widgetsnbextensionWheelUrl from '../pypi/widgetsnbextension-3.6.0-py3-none-any.whl';
export * as widgetsnbextensionWheelUrl1 from '../pypi/widgetsnbextension-4.0.2-py3-none-any.whl';
export * as widgetsnbextensionWheelUrl from '../pypi/widgetsnbextension-3.6.4-py3-none-any.whl';
export * as widgetsnbextensionWheelUrl1 from '../pypi/widgetsnbextension-4.0.7-py3-none-any.whl';
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class PyodideRemoteKernel {
* @param res The result object from the Pyodide evaluation
*/
formatResult(res: any): any {
if (!this._pyodide.isPyProxy(res)) {
if (!(res instanceof this._pyodide.ffi.PyProxy)) {
return res;
}
// TODO: this is a bit brittle
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"jupyterlite-core >=0.1.0b19,<0.2.0",
"jupyterlite-core >=0.1.0b22,<0.2.0",
"pkginfo"
]

Expand Down Expand Up @@ -125,15 +125,12 @@ addopts = [
"--cov-report=term-missing:skip-covered",
"--cov-report=html:build/reports/htmlcov",
"--cov-branch",
"--cov-fail-under=97",
"--cov-fail-under=96",
"--no-cov-on-fail",
# html
"--html=build/reports/pytest.html",
"--self-contained-html",
]
testpaths = [
"tests/",
]

[tool.jupyter-releaser.options]
version_cmd = "python scripts/bump-version.py"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7690,10 +7690,10 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==

pyodide@0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/pyodide/-/pyodide-0.22.0.tgz#44c264e26d5c054e676b051cc5a15a1d14e259c6"
integrity sha512-H5BV2m3dDXisZSxKZpPXDudsoAcRRo7Zq9ca4nlj5WjzSC2SY0+Q3fiZDMosgiz7W1BQz5FJUv3EDTmmscJRvA==
pyodide@0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/pyodide/-/pyodide-0.23.0.tgz#cf9414b643ad008af2ab52c5ee512afa55b877bb"
integrity sha512-7976PpL5PDeEhqRQYJLRM2iR9DFL71Fm+o6cTqQcZI3f+XWHyPg7dE4TTg5WMyCMVuMbgHGwWcm6lxIKTDbcFg==
dependencies:
base-64 "^1.0.0"
node-fetch "^2.6.1"
Expand Down

0 comments on commit 55d8df5

Please sign in to comment.