| name | pypi-release |
| description | Build and publish a new release of hot-notebook-patching to PyPI. Use when the user asks to release, publish, or push a new version of the package. |
| argument-hint | [new version, e.g. 0.2.1 — omit to auto-bump the patch version] |
PyPI release for hot-notebook-patching
Release the package from the repo root (/Users/jan-hendrik/projects/hot-notebook-patching).
All Python tooling lives in the project venv: use .venv/bin/... explicitly, never bare
jupyter/twine/python (they are not on PATH or point elsewhere).
If .venv or node_modules is missing, bootstrap first:
python3.12 -m venv .venv
.venv/bin/pip install jupyterlab jupyter-builder build twine
.venv/bin/jlpm install
If jlpm install modifies the committed yarn.lock and TypeScript then fails with
"two copies of @lumino/widgets" type errors, run .venv/bin/jlpm dedupe, then
rm -rf lib tsconfig.tsbuildinfo before compiling (stale tsbuildinfo keeps the error alive).
Steps
-
Determine the new version. If the user passed one in $ARGUMENTS, use it.
Otherwise read the current version from pyproject.toml and bump the patch part
(features → bump minor instead; ask only if genuinely ambiguous).
-
Bump the version in BOTH files — they must stay in sync:
pyproject.toml → version = "X.Y.Z"
package.json → "version": "X.Y.Z"
-
Compile TypeScript:
./node_modules/.bin/tsc --sourceMap
(jlpm is not on PATH; .venv/bin/jlpm exists if needed.)
-
Build the labextension in DEVELOPMENT mode:
.venv/bin/jupyter-builder build --development True .
(jupyter labextension build is deprecated and fails with
FileNotFoundError: 'jupyter-builder' because it shells out via PATH;
call the .venv/bin/jupyter-builder entry point directly.)
⚠️ Do NOT use a production build (jlpm build:prod / build without --development True):
it crashes on Node ≥ 26 (license-webpack-plugin: "Cannot read properties of undefined
(reading 'trim')") and wipes hot_notebook_patching/labextension/static/ down to just
style.js. The hatch build hook then "skip-if-exists" packages that broken directory
into a wheel that looks fine but contains no extension code. Dev-mode assets are what
previous releases shipped; they work fine, just unminified.
-
Build sdist + wheel:
rm -rf dist && .venv/bin/python -m build
-
Verify the wheel before uploading (this catches the broken-wheel trap above):
- The wheel must contain ≥ 3
static/*.js files including a remoteEntry.*.js under
*.data/data/share/jupyter/labextensions/hot-notebook-patching/static/.
- The packaged
labextension/package.json must show the new version.
- If the release contains a specific code change, grep the static JS inside the wheel
for a distinctive string from that change.
- Then run
.venv/bin/twine check dist/* — both files must PASS.
If verification fails, re-run step 4 (the dev build) and rebuild — do not upload.
-
Upload (credentials are in ~/.pypirc):
.venv/bin/twine upload dist/*
-
Confirm the release at https://pypi.org/project/hot-notebook-patching/X.Y.Z/
and report the URL to the user.
Notes
- Local dev install is symlinked (
jupyter labextension develop), so step 4 also updates
the running JupyterLab — remind the user to hard-refresh the browser tab.
- Don't commit/tag unless the user asks, but suggest it after a successful upload.