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 pyodide 0.25.0 #82

Merged
merged 5 commits into from
Feb 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
8 changes: 3 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@

# theme
html_theme = "pydata_sphinx_theme"
html_logo = "../packages/pyodide-kernel-extension/style/img/pyodide.svg"
html_logo = "../packages/pyodide-kernel-extension/style/img/pyodide.svg"
html_favicon = html_logo
html_theme_options = {
"github_url": P["urls"]["Source"],
"icon_links": [
{"name": "PyPI", "url": P["urls"]["PyPI"], "icon": "fa-solid fa-box"}
{"name": "PyPI", "url": P["urls"]["PyPI"], "icon": "fa-solid fa-box"}
],
"logo": {
"text": P["name"]
},
"logo": {"text": P["name"]},
"navigation_with_keys": False,
"pygment_light_style": "github-light",
"pygment_dark_style": "github-dark",
Expand Down
154 changes: 93 additions & 61 deletions examples/intro.ipynb
Original file line number Diff line number Diff line change
@@ -1,63 +1,95 @@
{
"metadata": {
"kernelspec": {
"name": "python",
"display_name": "Python (Pyodide)",
"language": "python"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8"
}
"cells": [
{
"cell_type": "markdown",
"id": "ab1dc4ef-36ae-4893-8fb4-474440fabc8a",
"metadata": {},
"source": [
"# Introduction to `jupyterlite-pyodide-kernel`\n",
"\n",
"`jupyterlite-pyodide-kernel` extends [JupyterLite](https://jupyterlite.rtfd.io) with a Python 3 kernel, powered by [Pyodide](https://pyodide.org/)."
]
},
"nbformat_minor": 5,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": "# Introduction to `jupyterlite-pyodide-kernel`\n\n`jupyterlite-pyodide-kernel` extends [JupyterLite](https://jupyterlite.rtfd.io) with a Python 3 kernel, powered by [Pyodide](https://pyodide.org/).",
"metadata": {},
"id": "ab1dc4ef-36ae-4893-8fb4-474440fabc8a"
},
{
"cell_type": "markdown",
"source": "## Visualizing data in a Notebook ✨\n\nBelow is an example of a code cell. We'll visualize some simple data using two popular\npackages in Python. We'll use [NumPy](https://numpy.org/) to create some random data,\nand [Matplotlib](https://matplotlib.org) to visualize it.\n\nNote how the code and the results of running the code are bundled together.",
"metadata": {},
"id": "a6372e17-bf46-48c5-90a3-bdd6236e376e"
},
{
"cell_type": "code",
"source": "from matplotlib import pyplot as plt\nimport numpy as np\n\n# Generate 100 random data points along 3 dimensions\nx, y, scale = np.random.randn(3, 100)\nfig, ax = plt.subplots()\n\n# Map each onto a scatterplot we'll create with Matplotlib\nax.scatter(x=x, y=y, c=scale, s=np.abs(scale) * 500)\nax.set(title=\"Some random data, created with JupyterLab!\")\nplt.show()",
"metadata": {
"trusted": true
},
"execution_count": null,
"outputs": [],
"id": "fe55883a-6887-43dd-9498-5333a51799e2"
},
{
"cell_type": "markdown",
"source": "## Interact with Widgets 🎛️\n\n[Jupyter Widgets](https://jupyter.org/widgets) power rich interactivity between users of Jupyter clients and Jupyter kernels. With `jupyterlab_widgets` installed, all of the [core widgets](https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html) will work in `jupyterlite-pyodide-kernel`, as do many third-party packages.",
"metadata": {},
"id": "61bd8fda-3e36-4910-b319-668e8843f322"
},
{
"cell_type": "code",
"source": "%pip install ipywidgets\nfrom ipywidgets import *\nslider = FloatSlider()\nreadout = FloatText()\njslink((slider, \"value\"), (readout, \"value\"))\nHBox([slider, readout])",
"metadata": {
"trusted": true
},
"execution_count": null,
"outputs": [],
"id": "b034c439-aea0-4880-9118-75f7a2b1092a"
}
]
}
{
"cell_type": "markdown",
"id": "a6372e17-bf46-48c5-90a3-bdd6236e376e",
"metadata": {},
"source": [
"## Visualizing data in a Notebook ✨\n",
"\n",
"Below is an example of a code cell. We'll visualize some simple data using two popular\n",
"packages in Python. We'll use [NumPy](https://numpy.org/) to create some random data,\n",
"and [Matplotlib](https://matplotlib.org) to visualize it.\n",
"\n",
"Note how the code and the results of running the code are bundled together."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fe55883a-6887-43dd-9498-5333a51799e2",
"metadata": {},
"outputs": [],
"source": [
"from matplotlib import pyplot as plt\n",
"import numpy as np\n",
"\n",
"# Generate 100 random data points along 3 dimensions\n",
"x, y, scale = np.random.randn(3, 100)\n",
"fig, ax = plt.subplots()\n",
"\n",
"# Map each onto a scatterplot we'll create with Matplotlib\n",
"ax.scatter(x=x, y=y, c=scale, s=np.abs(scale) * 500)\n",
"ax.set(title=\"Some random data, created with JupyterLab!\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "61bd8fda-3e36-4910-b319-668e8843f322",
"metadata": {},
"source": [
"## Interact with Widgets 🎛️\n",
"\n",
"[Jupyter Widgets](https://jupyter.org/widgets) power rich interactivity between users of Jupyter clients and Jupyter kernels. With `jupyterlab_widgets` installed, all of the [core widgets](https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html) will work in `jupyterlite-pyodide-kernel`, as do many third-party packages."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b034c439-aea0-4880-9118-75f7a2b1092a",
"metadata": {},
"outputs": [],
"source": [
"%pip install ipywidgets\n",
"from ipywidgets import *\n",
"\n",
"slider = FloatSlider()\n",
"readout = FloatText()\n",
"jslink((slider, \"value\"), (readout, \"value\"))\n",
"HBox([slider, readout])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""source of truth for ``jupyterlite-pyodide-kernel``` version."""

__version__ = "0.2.1"
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/addons/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

https://github.com/jupyterlite/jupyterlite/issues/996
"""

import json
from pathlib import Path
from typing import Generator, Dict, Any
Expand Down
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CLI entrypoint for managing piplite wheels"""

from pathlib import Path

from jupyter_core.application import JupyterApp
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.24.1"
PYODIDE_VERSION = "0.25.0"

#: the only kind of noarch wheel piplite understands
NOARCH_WHL = "py3-none-any.whl"
Expand Down
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""test configuration for jupyterlite-pyodide-kernel"""

from pathlib import Path
import sys
import pytest
Expand Down
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/tests/test_piplite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests of various mechanisms of providing federated_extensions"""

import json
import shutil

Expand Down
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/tests/test_pyodide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests of various mechanisms of using pyodide"""

import os
import shutil
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions jupyterlite_pyodide_kernel/tests/test_repo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Validate the integrity of the repo (or source checkout)"""

import json
from pathlib import Path

Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"lint:check": "jlpm lint:js:check && jlpm lint:py:check",
"lint:js": "jlpm prettier && jlpm eslint",
"lint:js:check": "jlpm prettier:check && jlpm eslint:check",
"lint:py": "jlpm lint:py:black && jlpm lint:py:ruff --fix-only",
"lint:py": "jlpm lint:py:ruff:fix",
"lint:py:check": "jlpm lint:py:pip && jlpm lint:py:ruff:check",
"lint:py:pip": "python -m pip check",
"lint:py:check": "jlpm lint:py:pip && jlpm lint:py:black --check && jlpm lint:py:ruff",
"lint:py:black": "black scripts jupyterlite_pyodide_kernel packages/pyodide-kernel/py",
"lint:py:ruff": "ruff scripts jupyterlite_pyodide_kernel packages/pyodide-kernel/py",
"lint:py:ruff:fix": "ruff format && ruff --fix-only",
"lint:py:ruff:check": "ruff format --check",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml,.yaml}\"",
"prettier:check": "jlpm prettier:base --check",
"prettier": "jlpm prettier:base --write --list-different",
Expand All @@ -59,7 +59,10 @@
"prettier": {
"singleQuote": true,
"printWidth": 88,
"proseWrap": "always"
"proseWrap": "always",
"overrides": [
{"files": "**/*tsconfig*.json", "options": {"trailingComma": "none"}}
]
},
"eslintConfig": {
"ignorePatterns": [
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel-extension/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
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.24.1/full/pyodide.js",
"default": "https://cdn.jsdelivr.net/pyodide/v0.25.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.24.1/full/pyodide.js';
const PYODIDE_CDN_URL = 'https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js';

/**
* The id for the extension, and key in the litePlugins.
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/jest": "^29.5.4",
"esbuild": "^0.19.2",
"jest": "^29.7.0",
"pyodide": "0.24.1",
"pyodide": "0.25.0",
"rimraf": "^5.0.1",
"ts-jest": "^26.3.0",
"typescript": "~5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/py/ipykernel/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/py/piplite/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions packages/pyodide-kernel/py/piplite/piplite/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A configurable Python package backed by Pyodide's micropip"""

from .piplite import install

__version__ = "0.2.1"
Expand Down
1 change: 1 addition & 0 deletions packages/pyodide-kernel/py/piplite/piplite/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async def install(
As this is _not_ really a CLI, it doesn't bother with accurate return codes, and should
failures should not block execution.
"""

import re
import sys
import typing
Expand Down
1 change: 1 addition & 0 deletions packages/pyodide-kernel/py/piplite/piplite/piplite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
`pyodide-kernel` also includes a browser shim for the IPython `%pip` magic

"""

from typing import Any
import asyncio
import json
Expand Down
2 changes: 1 addition & 1 deletion packages/pyodide-kernel/py/pyodide-kernel/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

https://github.com/ipython/ipython/blob/8.5.0/IPython/core/inputtransformer2.py
"""

import re
import shlex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mocks installed directly into sys.modules"""

import sys
import types

Expand Down
10 changes: 9 additions & 1 deletion packages/pyodide-kernel/py/pyodide-kernel/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ classifiers = [
[project.urls]
Source = "https://github.com/jupyterlite/pyodide-kernel"

[tool.ruff.per-file-ignores]
[tool.ruff]
include = [
"setup.py",
"scripts/",
"jupyterlite_pyodide_kernel/",
"packages/pyodide-kernel/py/",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, JupyterLite Contributors
Copyright (c), JupyterLite Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Loading
Loading