Skip to content
Open
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
57 changes: 33 additions & 24 deletions .github/workflows/check-js-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,72 @@ on: push

jobs:
check-js-build:
name: Check JS build artifacts
name: Check JS version number and build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"


- name: Check that version number for JS project matches version number for Python project
run: |
PYPROJECT_PATH="pyproject.toml"
PKGJSON_PATH="js/package.json"
PYPROJECT_VERSION=$(awk -F'"' '/^version/ {print $2; exit}' $PYPROJECT_PATH)
JSPROJECT_VERSION=$(cat $PKGJSON_PATH | jq -r '.version')
if [ "$PYPROJECT_VERSION" != "$JSPROJECT_VERSION" ]; then
echo "❌ Version number $JSPROJECT_VERSION in $PKGJSON_PATH does not match version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
exit 1
else
echo "✅ Version number $JSPROJECT_VERSION in $PKGJSON_PATH matches version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
fi
- name: Install Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Copy current files to a temporary directory
run: |
cp -R plotly/labextension/ plotly/labextension-tmp/
mv plotly/labextension/ plotly/labextension-tmp/

- name: Install dependencies and build
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install jupyter
uv pip install jupyterlab
cd js
npm ci
npm run build
npm ls
- name: Check JupyterLab build artifacts
run: |
# 1. Hash contents of all static files, sort by content hash
find plotly/labextension/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > new_hashes.txt
find plotly/labextension-tmp/static -type f -exec sha256sum {} \; | awk '{print $1}' | sort > old_hashes.txt

# 2. Compare the sorted content hashes
diff old_hashes.txt new_hashes.txt > content_diff.txt
# Compare the plotly/labextension and plotly/labextension-tmp directories
diff -r plotly/labextension/ plotly/labextension-tmp/ > labextension_diff.txt

# Remove the "load" line from both package.json files before comparing
grep -v '"load": "static/' plotly/labextension/package.json > pkg1.json
grep -v '"load": "static/' plotly/labextension-tmp/package.json > pkg2.json
echo "checking for differences between plotly/labextension and plotly/labextension-tmp"

# Compare stripped versions
diff pkg1.json pkg2.json > package_json_diff.txt

# 5. Final check
if [ -s content_diff.txt ] || [ -s package_json_diff.txt ]; then
# Check for differences
if [ -s labextension_diff.txt ]; then
echo "❌ Build artifacts differ:"
echo "--- Unexpected diffs ---"
cat content_diff.txt
echo "--- Unexpected package.json diffs ---"
cat package_json_diff.txt
cat labextension_diff.txt
echo "Please replace the 'plotly/labextension' directory with the artifacts of this CI run."
exit 1
FAIL=0
else
echo "✅ Build artifacts match expected output (ignoring known 'load' hash in package.json)."
echo "✅ Build artifacts match expected output"
FAIL=0
fi

echo "checked for differences"
echo "FAIL: $FAIL"

sleep 5

exit $FAIL

- name: Store the build artifacts from plotly/labextension
uses: actions/upload-artifact@v4
if: failure()
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ a link to the plotly.js CHANGELOG.
- Manually update the versions to `X.Y.Z` in the files specified below:
- `pyproject.toml`
- update version
- `js/package.json`
- update version (`"version"` key at top of file)
- `CHANGELOG.md`
- update version and release date
- finalize changelog entries according to instructions above
Expand Down
9 changes: 2 additions & 7 deletions js/install.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"schemaVersion": 1,
"packageName": "jupyterlab-plotly",
"version": "6.0.1",
"packageManager": "python",
"jupyterlab": {
"mimeExtension": "lib/mimeExtension.js"
}
"packageName": "plotly",
"packageManager": "python"
}
4 changes: 2 additions & 2 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jupyterlab-plotly",
"main": "lib/mimeExtension.js",
"version": "6.0.1",
"version": "6.6.0",
"repository": {
"type": "git",
"url": "https://github.com/plotly/plotly.py"
Expand Down Expand Up @@ -30,6 +30,7 @@
},
"jupyterlab": {
"mimeExtension": true,
"outputDir": "../plotly/labextension"
"outputDir": "../plotly/labextension",
"webpackConfig": "./webpack.config.js"
}
}
10 changes: 10 additions & 0 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
// Note: This config has no effect on the lab extension functionality,
// but it helps ensure that webpack uses the same module and chunk IDs
// across platforms, which makes it easier to compare build artifacts.
optimization: {
moduleIds: 'natural',
chunkIds: 'natural',
realContentHash: true
},
};
5 changes: 3 additions & 2 deletions plotly/labextension/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jupyterlab-plotly",
"main": "lib/mimeExtension.js",
"version": "6.0.1",
"version": "6.6.0",
"repository": {
"type": "git",
"url": "https://github.com/plotly/plotly.py"
Expand Down Expand Up @@ -31,8 +31,9 @@
"jupyterlab": {
"mimeExtension": true,
"outputDir": "../plotly/labextension",
"webpackConfig": "./webpack.config.js",
"_build": {
"load": "static/remoteEntry.d9ed7f5a4589fd6764e9.js",
"load": "static/remoteEntry.a90ef69e866c18565afe.js",
"mimeExtension": "./mimeExtension"
}
}
Expand Down
2 changes: 2 additions & 0 deletions plotly/labextension/static/1.f29faa6937f75272d9d5.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions plotly/labextension/static/340.330950829c5d59eca692.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

64 changes: 19 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["setuptools>=71"]
build-backend = "setuptools.build_meta"
requires = ["hatchling >= 1.26"]
build-backend = "hatchling.build"

[project.urls]
"HomePage" = "https://plotly.com/python/"
"Homepage" = "https://plotly.com/python/"
"Documentation" = "https://plotly.com/python/"
"Github" = "https://github.com/plotly/plotly.py"
"GitHub" = "https://github.com/plotly/plotly.py"
"Changelog" = "https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md"

[project]
Expand All @@ -18,7 +18,6 @@ maintainers = [
{ name="Emily Kellison-Linn", email="emily@plot.ly" }
]
description = "An open-source interactive data visualization library for Python"
readme = {file = "README.md", content-type = "text/markdown"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3.8",
Expand All @@ -31,7 +30,8 @@ classifiers = [
"License :: OSI Approved :: MIT License"
]
requires-python = ">=3.8"
license = {file="LICENSE.txt"}
license = "MIT"
license-files = ["LICENSE.txt"]
version = "6.6.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does uv have something similar to npm version? If so, maybe they have post script hooks, also like npm?

dependencies = [
"narwhals>=1.15.1",
Expand All @@ -50,7 +50,7 @@ dev_core = [
dev_build = [
"plotly[dev_core]",
"build",
"jupyter"
"jupyterlab"
]
dev_optional = [
"plotly[dev_build]",
Expand Down Expand Up @@ -91,43 +91,17 @@ markers = [
"matplotlib: mark a test as matplotlib"
]

[tool.setuptools.packages.find]
where = ["."]
include = ["plotly*", "_plotly*"]
exclude = ["__pycache__*", "tests*"]

[tool.setuptools.package-data]
plotly = [
"package_data/*",
"package_data/templates/*",
"package_data/datasets/*",
"validators/_validators.json"
]

[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
auto_data_files = true

[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]

[tool.hatch.build.hooks.jupyter-builder]
editable-frontend = true

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
build_cmd = "build"
npm = ["jlpm"]
source_dir = "js"
build_dir = "plotly/labextension"
skip_symlink = true

[tool.setuptools.data-files]
"share/jupyter/labextensions/jupyterlab-plotly" = [
"plotly/labextension/package.json",
"js/install.json"
[tool.hatch.build]
include = [
"/plotly*",
"/_plotly*",
"js/install.json", # used by Jupyter extension
]

"share/jupyter/labextensions/jupyterlab-plotly/static" = [
"plotly/labextension/static/*.js"
]
[tool.hatch.build.targets.wheel.shared-data]
# Specify files from this package which will be copied to the user's system on install
# This is how the jupyterlab extension gets installed
# Left path is the path within this package
# Right path is the path on the user's system
"plotly/labextension" = "share/jupyter/labextensions/jupyterlab-plotly"
"js/install.json" = "share/jupyter/labextensions/jupyterlab-plotly/install.json"
Loading
Loading