<#1335 fix(image): Pixi: don't inject `--locked` w...
# flyte-github
a
#1335 fix(image): Pixi: don't inject
--locked
when extra_args sets
--frozen
Pull request opened by earlybard Problem
Image.with_pixi_project(..., project_install_mode="dependencies_only")
cannot build an image from a pixi manifest that declares path
pypi-dependencies
— typically editable, as in the standard pixi monorepo layout. Two behaviours combine to cause it: 1. In
dependencies_only
mode only the manifest and
pixi.lock
are copied into the build context. Unlike
UVProjectHandler
, there is no analogue of
get_uv_editable_install_mounts
, so those packages' source trees are absent at build time. 2.
--locked
is appended to
pixi install
unconditionally whenever a lock file exists, in both
PixiProjectHandler.handle
and the remote-builder lowering
pixi_project_to_primitive_layers
. It is placed ahead of
extra_args
, so
extra_args
can add flags but never remove it. This makes
PixiProjectHandler
the only project handler that injects a lock flag:
UVProjectHandler
passes
extra_args
through untouched, which is why the analogous uv invocation —
uv sync --frozen --no-install-workspace
, excluding first-party workspace members while still installing their third-party dependencies — works today with no special handling. The pixi path has no way to express the same thing. With those sources missing,
pixi install --locked
fails its up-to-date check:
Copy code
Error: lock file not up-to-date with the workspace
pixi has the right invocation for this case:
pixi install --frozen --skip <pkg>
installs every third-party dependency from the lock and skips the absent first-party ones — which, in flyte's model, arrive in the container via the code bundle anyway. But
--frozen
cannot be passed through
extra_args
today, because
--frozen
and
--locked
are mutually exclusive pixi flags and the injected
--locked
makes pixi reject the pair.
PIXI_FROZEN=true
via
with_env_vars
doesn't help either — the explicit flag wins. image = flyte.Image.from_debian_base().with_pixi_project( "pixi.toml", environment="my-workflow", extra_args="--frozen --skip my-workflow --skip my-sdk", # rejected: conflicts with injected --locked ) Fix Only inject the default
--locked
when
extra_args
does not already carry
--frozen
, in both code paths.
--locked
remains the default, so behaviour is unchanged for every existing caller, and
--frozen
still honours the lock exactly — reproducibility is preserved. Docstring updated. Two alternatives I considered and didn't take, in case you'd prefer one: • Declare the lock mode instead of inspecting
extra_args
— a
lock_mode: Literal["locked", "frozen"] = "locked"
field on
PixiProject
, surfaced through
with_pixi_project
. Same size and no string matching, at the cost of new public API surface. Happy to switch to this if you'd rather not key off
extra_args
. • Mirror
get_uv_editable_install_mounts
and copy the editable sources into the build context
, which would make
--locked
work as-is. This does work, but it's costlier for pixi than the uv equivalent: pixi's lock check is workspace-wide rather than environment-scoped, so it isn't enough to copy the path dependencies the selected environment uses — every path dependency in the manifest has to be present. On a monorepo with one environment per package that means copying all members' sources into every image's build context (20 members, ~1 MB → ~15 MB in my case) to satisfy a check for packages the code bundle delivers anyway. Keeping the default
--locked
and letting callers opt into
--frozen
leaves the context at manifest + lock. flyteorg/flyte-sdk