-
-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lite environment to pixi (#7134)
- Loading branch information
Showing
17 changed files
with
223 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,12 +206,7 @@ jobs: | |
(jupyter lab --config panel/tests/ui/jupyter_server_test_config.py --port 8887 > /tmp/jupyterlab_server.log 2>&1) & | ||
- name: Build JupyterLite | ||
shell: pixi run -e test-ui bash -el {0} | ||
run: | | ||
# TODO: Make this a pixi feature/environment | ||
python -m pip install -r ./lite/requirements.txt | ||
python ./scripts/build_pyodide_wheels.py lite/pypi | ||
python ./scripts/panelite/generate_panelite_content.py | ||
jupyter lite build --lite-dir lite --output-dir lite/dist | ||
run: pixi run -e lite lite-build | ||
- name: Wait for JupyterLab | ||
uses: ifaxity/[email protected] | ||
with: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
python ./scripts/build_pyodide_wheels.py dist | ||
python ./scripts/panelite/generate_panelite_content.py | ||
|
||
# Update lockfiles | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
rm -rf node_modules | ||
npm install . | ||
node update_lock.js | ||
python patch_lock.py | ||
rm node_modules/pyodide/*.whl | ||
|
||
jupyter lite build | ||
|
||
cp -r node_modules/pyodide/ ../../lite/dist/pyodide | ||
mv pyodide-lock.json ../../lite/dist/pyodide/pyodide-lock.json | ||
mv ../../dist/* ../../lite/dist/pyodide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
"panel", | ||
"bokeh", | ||
"pyodide-http" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,5 +57,5 @@ | |
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"jupyter-lite-schema-version": 0, | ||
"jupyter-config-data": { | ||
"litePluginSettings": { | ||
"@jupyterlite/pyodide-kernel-extension:kernel": { | ||
"pyodideUrl": "./pyodide/pyodide.js" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"LiteBuildConfig": { | ||
"contents": ["../../lite/files", "files"], | ||
"output_dir": "../../lite/dist" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"pyodide": "^0.26.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import hashlib | ||
import json | ||
import os.path | ||
|
||
from glob import glob | ||
|
||
from packaging.utils import parse_wheel_filename | ||
|
||
|
||
def calculate_sha256(file_path): | ||
sha256_hash = hashlib.sha256() | ||
|
||
with open(file_path, "rb") as file: | ||
for byte_block in iter(lambda: file.read(4096), b""): | ||
sha256_hash.update(byte_block) | ||
|
||
return sha256_hash.hexdigest() | ||
|
||
|
||
with open("package.json") as f: | ||
package = json.load(f) | ||
pyodide_version = package["dependencies"]["pyodide"].removeprefix("^") | ||
|
||
path = "pyodide-lock.json" | ||
url = f"https://cdn.jsdelivr.net/pyodide/v{pyodide_version}/full" | ||
|
||
with open(path) as f: | ||
data = json.load(f) | ||
|
||
for p in data["packages"].values(): | ||
if not p["file_name"].startswith("http"): | ||
p["file_name"] = f'{url}/{p["file_name"]}' | ||
|
||
|
||
whl_files = glob("../../dist/*.whl") | ||
for whl_file in whl_files: | ||
name, version, *_ = parse_wheel_filename(os.path.basename(whl_file)) | ||
|
||
package = data["packages"][name] | ||
package["version"] = str(version) | ||
package["file_name"] = os.path.basename(whl_file) | ||
package["sha256"] = calculate_sha256(whl_file) | ||
package["imports"] = [name] | ||
|
||
|
||
with open(path, "w") as f: | ||
data = json.dump(data, f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { loadPyodide } = require("pyodide"); | ||
const fs = require("fs"); | ||
|
||
async function main() { | ||
const extra = fs.readFileSync("extra_packages.json", "utf8"); | ||
|
||
let pyodide = await loadPyodide(); | ||
await pyodide.loadPackage(["micropip"]); | ||
|
||
output = await pyodide.runPythonAsync(` | ||
import json | ||
import micropip | ||
extra = json.loads("""${extra}""") | ||
await micropip.install(extra) | ||
micropip.freeze() | ||
`); | ||
fs.writeFileSync("pyodide-lock.json", output); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters