Skip to content

Stop installing the benchmarks harness as a top-level package - #4148

Merged
T4rk1n merged 2 commits into
plotly:devfrom
M-Colley:fix/wheel-only-ships-dash
Nov 16, 2026
Merged

T4rk1n merged 2 commits into
plotly:devfrom
M-Colley:fix/wheel-only-ships-dash

Conversation

@M-Colley

Copy link
Copy Markdown
Contributor

Since 4.5.0rc0 the dash wheel installs a top-level benchmarks package next to dash (benchmarks/__init__.py, bench_app.py, run.py, scenarios.py). setup.py uses find_packages(exclude=["tests*"]), which picks up the benchmarks/ harness because it has an __init__.py.

As a regular package in site-packages, it shadows a benchmarks/ directory in any project that installs dash. A project with its own benchmarks/ folder (no __init__.py) breaks as soon as dash 4.5.0 is installed:

myproject/benchmarks/build_manifest.py

$ pip install dash==4.5.0 --no-deps
$ python -c "import benchmarks.build_manifest"
ModuleNotFoundError: No module named 'benchmarks.build_manifest'
$ python -c "import benchmarks; print(benchmarks.__file__)"
.../site-packages/benchmarks/__init__.py

The same import works with dash 4.4.1. We hit this in the CI of a downstream project that depends on dash.

This PR changes setup.py to find_packages(include=["dash", "dash.*"]), so only dash and its subpackages are packaged. The harness runs as before (python -m benchmarks.run from the repo root, as in benchmarks.yml), which does not need it installed.

  • Package list: 20 before, 19 after. The only one removed is benchmarks, none added.
  • A wheel built from this branch has the top-level entries dash, dash-4.5.0.data, dash-4.5.0.dist-info, the same set as the 4.4.1 wheel.
  • The new unit test tests/unit/test_packaging.py runs setup.py with setuptools.setup mocked. On dev it fails with assert ['benchmarks'] == [].

Contributor Checklist

  • This PR targets dev (fix or chore) or next (feature, new API, breaking change), see Which branch to target
  • I have broken down my PR scope into the following TODO tasks
    • restrict find_packages to dash and dash.*
    • add a unit test that fails if any other top-level package is packaged
    • CHANGELOG entry
  • I have run the tests locally and they passed. (refer to testing section in contributing)
    • tests/unit/test_packaging.py passes. black 22.3.0, flake8 7.3.0 and pylint 3.0.3 (the versions in requirements/ci.txt) are clean on the changed files.
    • I ran tests/unit on Windows with Python 3.12, using the generated components from the 4.5.0 wheel because I did not run the JS build. The only failures were the Windows path tests in tests/unit/pages and test_process_server_smoke, which fail the same way on unmodified dev. Two MCP background-callback tests failed once under the full run and passed on every rerun.
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md

🤖 Generated with Claude Code

M-Colley and others added 2 commits November 15, 2026 20:05
find_packages(exclude=["tests*"]) also picked up the benchmarks/ harness,
so since 4.5.0rc0 the wheel installs a top-level `benchmarks` package. As a
regular package in site-packages it shadows a benchmarks/ directory in any
project that installs dash: `import benchmarks.foo` then fails with
ModuleNotFoundError. Restrict packaging to dash and dash.*.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M-Colley added a commit to M-Colley/Monocular-OSM-Localization that referenced this pull request Nov 15, 2026
@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n T4rk1n 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.

💃 Thank you.

@T4rk1n
T4rk1n merged commit 712bd34 into plotly:dev Nov 16, 2026
111 of 113 checks passed
@T4rk1n T4rk1n mentioned this pull request Nov 18, 2026
8 tasks done
@M-Colley
M-Colley deleted the fix/wheel-only-ships-dash branch November 25, 2026 02:12
Sign up for free to 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.

2 participants