From 2c6ce4839095327a785be94277d53765b43545dc Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:06:58 -0400 Subject: [PATCH] update bumpversion script and release instructions to include rebuilding jupyterlab extension --- RELEASE.md | 4 +++- commands.py | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index c1b29f6d99..5d15f88fb9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -30,6 +30,7 @@ a link to the plotly.js CHANGELOG. - `uv.lock` - `js/package.json` - `js/package-lock.json` + - `plotly/labextension/*` - `CHANGELOG.md` (Adds a new header for X.Y.Z above the unreleased items) - `CITATION.cff` @@ -37,8 +38,9 @@ a link to the plotly.js CHANGELOG. - Note: The current date is used as the release date in `CHANGELOG.md` and `CITATION.cff`. If you want to use a different date, edit these files manually afterward. - If the bumpversion command failed for any reason, you can update the versions yourself by doing the following: - Manually update the version number (and release date, as needed) in `pyproject.toml`, `CHANGELOG.md` and `CITATION.cff` - - Run `npm version X.Y.Z` to update `js/package.json` and `js/package-lock.json` - Run `uv lock` to update `uv.lock` + - From the `js/` dir, run `npm version X.Y.Z` to update `js/package.json` and `js/package-lock.json` + - From the `js/` dir, run `npm run build:labextension` to regenerate the files in `plotly/labextension/` - Commit and push the changed files to the release branch: ```sh diff --git a/commands.py b/commands.py index ff32f4b14a..c83f2ef00b 100644 --- a/commands.py +++ b/commands.py @@ -328,7 +328,7 @@ def bump_version_pyproject_toml(new_version): subprocess.run(["uv", "lock"], check=True) print( - f"Updated version in {pyproject_toml_path} to {new_version},", + f"SUCCESS: Updated version in {pyproject_toml_path} to {new_version},", "and updated uv lockfile", ) return True @@ -346,8 +346,20 @@ def bump_version_package_json(new_version): check=True, ) print( - f"Updated version in {js_dir}/package.json and {js_dir}/package-lock.json to {new_version}" + f"SUCCESS: Updated version in {js_dir}/package.json and {js_dir}/package-lock.json to {new_version}" ) + + # After modifying files in js/, we need to rebuild the JupyterLab extension + print("Rebuilding JupyterLab extension (this may take a few seconds)...") + subprocess.run( + ["npm", "run", "build:labextension"], + cwd=js_dir, + check=True, + stdout=subprocess.DEVNULL, # Suppress stdout and stderr to avoid terminal clutter + stderr=subprocess.DEVNULL, + ) + print(f"SUCCESS: Updated JupyterLab extension files in plotly/labextension") + return True @@ -392,7 +404,7 @@ def bump_version_citation_cff(new_version, new_date): with open(citation_cff_path, "w") as f: f.write(new_content) print( - f"Updated version in {citation_cff_path} to {new_version}", + f"SUCCESS: Updated version in {citation_cff_path} to {new_version}", f"and date-released to {new_date}", ) return True @@ -414,7 +426,7 @@ def bump_version_changelog_md(new_version, new_date): already_exists_pattern = rf"(^\s*##\s*\[ *{re.escape(new_version)} *\])" if re.search(already_exists_pattern, content, flags=re.MULTILINE): print( - f"Header for version {new_version} already exists ", + f"Header for version {new_version} already exists", f"in {changelog_md_path}.", ) return True