<#1219 fix(image): always install the local wheel ...
# flyte-github
a
#1219 fix(image): always install the local wheel for with_local_v2() Pull request opened by pingsutw Why When building an image with
Image.from_*().with_local_v2()
, the locally-built
flyte
wheel can be silently replaced by the published PyPI release. A user modifying
flyte
locally ends up running the released version in the image without any error.
PythonWheelHandler.handle
emits two
uv pip install
steps for a
PythonWheels
layer: 1. force-install the local wheel:
--no-deps --no-index --reinstall flyte
2. resolve dependencies from the index:
--find-links /dist flyte
The problem is the order: the dependency step runs last and does a full resolve of
flyte
. If the local wheel can't be fully satisfied during that resolve — most commonly when a dev wheel pins a dependency version that isn't published yet (e.g. after rebasing onto a branch that bumped an internal dep) — uv backtracks and installs the highest satisfiable version, i.e. the stable PyPI release. The result silently undoes step 1:
Copy code
#19  - flyte==2.5.2.dev1+g512b21d95.d20260617
#19  + flyte==2.5.1
Note this is not specific to the
--find-links
that was recently added to step 2 — old and new code backtrack identically. The fix is structural. What Swap the order so the dependency step runs first and the force-install step runs last. Because the force-install uses
--no-index --reinstall
, it can't be re-resolved away, so the exact local wheel is always the final state regardless of what the resolver picks for the package itself. • Dependencies still come from the index (resolved in the first step). • Packages not published to PyPI (local plugin wheels) still resolve via
--find-links /dist
in the first step. •
with_local_v2()
now always installs exactly the local wheel. Trade-off: the local wheel is force-installed with
--no-deps
, so a genuinely-missing dependency now surfaces at runtime (ImportError) instead of being masked by silently running the older published package. This is the intended behavior for
with_local_v2()
— you get your local code. Repro / verification With a local dev wheel whose declared dependency can't be satisfied, the pre-fix sequence downgrades to the PyPI release; the reordered sequence keeps the local wheel:
Copy code
[A] uv pip install --find-links /dist flyte                                  -> picks stable + deps
[B] uv pip install --no-deps --no-index --reinstall --find-links /dist flyte -> local dev wheel (final)
Tests Added
test_python_wheel_handler_forces_local_wheel_last
asserting the force-install step (
--no-index --reinstall
) is emitted after the dependency step in the generated Dockerfile. flyteorg/flyte-sdk