Skip to content

Clean up pyproject.toml and build pipeline - #5540

Merged
emilykl merged 20 commits into
mainfrom
simplify-build-system
Mar 24, 2026
Merged

Clean up pyproject.toml and build pipeline#5540
emilykl merged 20 commits into
mainfrom
simplify-build-system

Conversation

@emilykl

@emilyklemilykl commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Link to issue

Closes#5537

Description of change

Configuration updates

  • Switch build backend from setuptools to hatch
  • Update pyproject.toml config to work with hatch, and remove unused config sections
    • Remove MANIFEST.in file, since it's only required by setuptools, not needed for hatch
  • Update js/package.json to reflect the correct version number matching plotly.py version, which we've forgotten to do for the last few releases
  • Add js/webpack.config.js to make lab extension build output identical across platforms, which fixes the false failure of the "Check JS build" workflow when committing build artifacts built locally
  • Remove keys from js/install.json file which I believe are not needed

Process updates

  • Add CI step to check that version numbers in pyproject.toml and js/package.json match
  • Add new command bumpversion to commands.py. Now, you can run python commands.py bumpversion X.Y.Z to update the version number to X.Y.Z everywhere across the package
  • Update RELEASE.md instructions to use the bumpversion command

NOTE: The python package build command remains the same: python -m build .

Demo

python-m-build.mov

When running python -m build . locally, the output should look like the above.

Testing strategy

I've added a CI step in .github/workflows/check-js-build.yml to check that the version number in pyproject.toml matches the version number in js/project.json, which should prevent the two from getting out of sync again.

Show success caseScreenshot 2026-03-17 at 12 37 12 PM
Show failure caseScreenshot 2026-03-17 at 12 32 30 PM
No additional unit testing is needed: The CI already runs `python -m build .` , so if that step fails then we know something is wrong.

However, we should verify manually that the resulting build is the same before and after these changes.

This can be done by checking out this branch, running python -m build ., and comparing the .tar.gz and .whl files to the official 6.6.0 release artifacts.

Additional information (optional)

Because we manually pre-build the assets for the JupyterLab extension (by running npm run build from the js/ directory, as documented in the CONTRIBUTING.md), we do not use any of the hatch build hooks settings in the pyproject.toml, so this PR removes them.

The existing .github/check-js-build.yml step builds the lab extension in CI and ensures that the output matches the build artifacts in plotly/labextension/.

I don't like that this setup requires updating the version number in two places. But package.json doesn't support dynamic version numbers, so the only way to set up a single source of truth would be for the package.json to be the single source of truth, and pyproject.toml to load that version number dynamically, which is weird for a Python project

To make this less painful I've added python commands.py bumpversion X.Y.Z which automatically updates the version number everywhere.

Guidelines

@emilykl
emilyklforce-pushed the simplify-build-system branch 3 times, most recently from 88e6d1a to e9d7688CompareMarch 17, 2026 16:34
@emilykl
emilykl marked this pull request as ready for review March 17, 2026 16:41
@emilykl

Copy link
Copy Markdown
ContributorAuthor

fyi @franred this is the PR I mentioned last week!

@emilykl
emilyklforce-pushed the simplify-build-system branch from ab51a17 to 3966699CompareMarch 18, 2026 14:33
@emilykl
emilyklforce-pushed the simplify-build-system branch from 3966699 to 6a70d14CompareMarch 18, 2026 14:45
@camdecostercamdecoster self-assigned this Mar 18, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes plotly.py’s packaging/build configuration by switching the Python build backend to hatchling, cleaning up legacy pyproject.toml sections, and tightening the JupyterLab extension build/versioning workflow to reduce CI drift and cross-platform build artifact differences.

Changes:

  • Switch Python build backend from setuptools to hatchling and remove legacy setuptools/jupyter-packaging config.
  • Align JupyterLab extension versions and stabilize webpack output across platforms.
  • Add CI checks to keep Python and JS version numbers in sync and improve the JS build artifact comparison workflow.

Reviewed changes

Copilot reviewed 10 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
uv.lockUpdates dev/dev-build deps away from the jupyter meta-package toward explicit jupyterlab pins.
pyproject.tomlSwitches to hatchling and replaces packaging data/sharing configuration for the labextension.
plotly/labextension/static/remoteEntry.*.jsUpdates committed prebuilt labextension artifacts (hash/version changes).
plotly/labextension/static/*.LICENSE.txtAdds/updates bundled license output from the JS build.
plotly/labextension/package.jsonUpdates extension version and build metadata (including webpack config and new remoteEntry filename).
js/webpack.config.jsForces stable webpack IDs/content hashing for cross-platform deterministic outputs.
js/package.jsonUpdates JS package version and points JupyterLab builder at the custom webpack config.
js/package-lock.jsonUpdates lockfile; currently shows a version mismatch vs js/package.json.
js/install.jsonSimplifies install metadata intended for JupyterLab extension installation UX.
RELEASE.mdAdds release step to update js/package.json version.
MANIFEST.inRemoved as part of moving away from setuptools.
.github/workflows/check-js-build.ymlAdds version-sync check and tweaks the artifact-compare workflow; still uses deprecated setup-node@v2.
Files not reviewed (1)
  • js/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadjs/package-lock.json
Comment threadpyproject.toml
Comment threadpyproject.toml
@@ -18,7 +18,6 @@ maintainers = [
{ name="Emily Kellison-Linn", email="emily@plot.ly" }
]
description = "An open-source interactive data visualization library for Python"
Comment thread.github/workflows/check-js-build.yml
Comment thread.github/workflows/check-js-build.yml
Comment threadpyproject.toml
@emilykl
emilyklforce-pushed the simplify-build-system branch 3 times, most recently from 94c6afd to 00c264fCompareMarch 18, 2026 21:59
@emilykl
emilyklforce-pushed the simplify-build-system branch 4 times, most recently from a89b4ae to 2434577CompareMarch 19, 2026 15:12
@emilykl
emilyklforce-pushed the simplify-build-system branch from 2434577 to 1a13239CompareMarch 19, 2026 15:17
@emilykl
emilyklforce-pushed the simplify-build-system branch from 8163da2 to 9717f12CompareMarch 20, 2026 14:50
@emilyklemilykl mentioned this pull request Mar 20, 2026

@camdecostercamdecoster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good.

Comment threadcommands.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be good to port some of these changes to plotly.js.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@camdecoster Sure, which parts? I'd be happy to open a PR. Most of this PR is only relevant to Python though.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some config options in pyproject.toml are unused

3 participants

@emilykl@camdecoster