From 90f5ac56c5a0ea0a5c1d21da16b11bb49ae18d28 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 18 Oct 2023 10:56:17 +0200 Subject: [PATCH] Add more `skip-if-exists`, fix wheel packaging (#181) * Add more skip-if-exists * remove wheel config * fix typo * Remove before-build-python hook * Re-add `wasm` to files * Fix build:prod script * Delete MANIFEST.in * edit config * include static directory explicitely ? * narrow down gitignore * fix typo --- .gitignore | 18 ++++++++++-------- MANIFEST.in | 30 ------------------------------ package.json | 4 ++-- pyproject.toml | 14 +++++++++----- 4 files changed, 21 insertions(+), 45 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.gitignore b/.gitignore index 2502856..2314a02 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ node_modules/ *.egg-info/ .ipynb_checkpoints *.tsbuildinfo -*.tar.gz -empack_env_meta.json +/*.tar.gz # Created by https://www.gitignore.io/api/python # Edit at https://www.gitignore.io/?templates=python @@ -114,15 +113,18 @@ dmypy.json _output *.doit.db -python_data.js -*.data +# Generated files +src/python_data.js +src/*.data src/*.js -xpython_wasm.js -xpython_wasm.wasm -xpython_wasm.hash - +src/xpython_wasm.js +src/xpython_wasm.wasm +src/xpython_wasm.hash src/worker.ts src/web_worker_kernel.ts +src/*.tar.gz +src/empack_env_meta.json +*.js.map # Labextension jupyterlite_xeus_python/labextension diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index f939d59..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,30 +0,0 @@ -include LICENSE -include *.md -include *.yml -include pyproject.toml -include package.json -include install.json -include ts*.json -include yarn.lock -include webpack.config.js -include worker.webpack.config.js -include build.js -recursive-include tests *.py - -graft share - -graft docs - -# Javascript files -include src/*.ts -graft style -prune **/node_modules -prune lib -prune binder - -# Patterns to exclude from any directory -global-exclude *~ -global-exclude *.pyc -global-exclude *.pyo -global-exclude .git -global-exclude .ipynb_checkpoints diff --git a/package.json b/package.json index 381e951..34fabfb 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "license": "BSD-3-Clause", "author": "JupyterLite Contributors", "files": [ - "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", + "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf,wasm}", "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}" ], "main": "lib/index.js", @@ -31,7 +31,7 @@ "build": "jlpm run build:xeus-python && jlpm run build:lib && jlpm run build:worker && jlpm run copy-files && jlpm run build:labextension:dev", "build:xeus-python": "python jupyterlite_xeus_python/build.py --output-path src --build-worker", "build:worker:prod": "webpack --config worker.webpack.config.js --mode=production", - "build:prod": "jlpm run clean && jlpm run build build:xeus-python && jlpm run build:lib:prod && jlpm run build:worker:prod && jlpm run copy-files && jlpm run build:labextension", + "build:prod": "jlpm run clean && jlpm run build:xeus-python && jlpm run build:lib:prod && jlpm run build:worker:prod && jlpm run copy-files && jlpm run build:labextension", "build:labextension": "jupyter labextension build .", "build:labextension:dev": "jupyter labextension build --development True .", "build:lib": "tsc --sourceMap", diff --git a/pyproject.toml b/pyproject.toml index 0566ced..3c55f33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,10 +52,6 @@ fields = ["description", "authors", "urls"] artifacts = ["jupyterlite_xeus_python/labextension"] exclude = [".github"] -[tool.hatch.build.targets.wheel] -artifacts = ["jupyterlite_xeus_python/labextension"] -include = ["jupyterlite_xeus_python/"] - [tool.hatch.build.targets.wheel.shared-data] "jupyterlite_xeus_python/labextension" = "share/jupyter/labextensions/@jupyterlite/xeus-python-kernel" "install.json" = "share/jupyter/labextensions/@jupyterlite/xeus-python-kernel/install.json" @@ -73,11 +69,19 @@ ensured-targets = [ "jupyterlite_xeus_python/labextension/static/xpython_wasm.wasm", "jupyterlite_xeus_python/labextension/package.json", ] -skip-if-exists = ["jupyterlite_xeus_python/labextension/static/style.js"] +skip-if-exists = [ + "jupyterlite_xeus_python/labextension/static/style.js", + "jupyterlite_xeus_python/labextension/static/empack_env_meta.json", + "jupyterlite_xeus_python/labextension/static/xpython_wasm.js", + "jupyterlite_xeus_python/labextension/static/xpython_wasm.wasm", + "jupyterlite_xeus_python/labextension/package.json", +] [tool.hatch.build.hooks.jupyter-builder.build-kwargs] build_cmd = "build:prod" npm = ["jlpm"] +source_dir = "src" +build_dir = "jupyterlite_xeus_python/labextension" [tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs] build_cmd = "install:extension"