acoustic-carpenter-78188
06/17/2026, 6:25 AMwith_local_v2() (used when building a dev image from a locally-modified flyte) stopped picking up the local build. The image would install the local wheel and then immediately replace it with a stable release from PyPI:
#18 [build] Install wheel flyte ...
- flyte==2.5.1
+ flyte==2.5.2.dev1+g512b21d95.d20260617 # local wheel installed
#19 [build] Install dependencies for flyte ...
- flyte==2.5.2.dev1+g512b21d95.d20260617
+ flyte==2.5.1 # ...then silently swapped back
Root cause
PythonWheelHandler.handle emitted two uv pip install commands per PythonWheels layer:
1. Install the wheel only: uv pip install --find-links /dist --no-deps --no-index --reinstall <pkg>
2. Install dependencies: uv pip install --find-links /dist <pkg>
Once step 2 drops --no-index, uv sees the package from two sources — the local /dist wheel (a .dev pre-release) and PyPI (a stable release). Per PEP 440, uv/pip ignore pre-releases when a stable version satisfies an unconstrained requirement, and no --pre is passed (PipOption.pre defaults to False). So step 2 resolves <pkg> to the stable PyPI version, uninstalls the local dev wheel, and reinstalls the stable one. --find-links /dist doesn't help: the local wheel is available but still loses as a pre-release.
This only surfaces once a competing stable release exists on PyPI, which is why it "used to work" and then regressed.
What
Install the wheel directly by file path instead of by package name:
uv pip install <args> /dist/<package_name>-*.whl
Pointing uv at the file removes the resolution contest for the package itself (no pre-release exclusion), while its dependencies still resolve from the index. This also collapses the two commands into one.
• package_name is already the underscore-normalized distribution name (_image.py builds it via plugin.replace("-", "_")), so /dist/<package_name>-*.whl matches this package's wheel. The trailing dash anchors it (flyte-* does not match flyteplugins_*).
• The glob is expanded by the build shell (the RUN is emitted in shell form).
• Multiple-version ambiguity can't arise from the normal build: make dist runs clean (rm -rf dist/) and make dist-plugins runs clean-plugins (rm -f dist/flyteplugins_*.whl) first, so dist/ holds at most one wheel per package.
Tests
Added two unit tests in `tests/flyte/imagebuild/test_docker_builder.py`:
• test_python_wheel_handler_installs_local_wheel_by_path — asserts a single uv pip install, that it installs /dist/flyte-*.whl, that none of --no-deps/--no-index/--reinstall/--find-links remain, and that the glob doesn't match a sibling flyteplugins_* wheel.
• test_python_wheel_handler_glob_matches_normalized_plugin_name — asserts the glob matches an underscore-normalized plugin name.
Full test_docker_builder.py suite passes (37 passed, 1 skipped); ruff clean.
Verification
Reproduced the swap and confirmed the fix locally with the real flyte dev wheel:
| command | result |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| uv pip install --find-links ./dist flyte (old, fresh resolve) | installs stable PyPI build, drops local dev wheel |
| uv pip install ./dist/flyte-*.whl (new) | installs local dev wheel, all deps resolved from PyPI |
flyteorg/flyte-sdkacoustic-carpenter-78188
06/17/2026, 6:31 AM