Skip to content

Install the image's Python packages in one uv run - #2946

Open
ideaship wants to merge 3 commits into
mainfrom
gate-osism-pins
Open

ideaship wants to merge 3 commits into
mainfrom
gate-osism-pins

Conversation

@ideaship

Copy link
Copy Markdown
Contributor

What changes

In the image, built today: the same 206 packages, with three of them moving to the versions python-osism pins:

  • openstacksdk 4.25.0 → 4.26.0 (requirements.txt)
  • python-neutronclient 14.0.0 → 14.1.0 (requirements.openstackclient.txt)
  • pyyaml 6.0.3 → 6.0.4 (requirements.txt)

/openstack-simple-stress/.git (184 KB) is no longer left in the image.

For later images: a version that python-osism pins changes only through this repository. If two bundled tools come to pin different versions of a package that python-osism does not pin, the build fails and names both pins. It no longer ships whichever was installed last.

In CI: the image check fails when the image violates a requirement of the osism package itself. All other uv pip check findings stay report-only.

Why

The Containerfile installed Python packages in ten separate uv runs. Each run replaced what earlier runs had installed, so the last run to pin a package decided its version. openstack-project-manager and openstack-simple-stress are cloned from their default branches during the build and their requirements were installed last. That way, a dependency update merged in either repository changed this image with no change here. This is how the image came to ship openstacksdk 4.25.0 against python-osism's 4.26.0 pin. The image check listed the violation but only reports, so the build passed.

Commits

  1. Remove the git metadata of openstack-simple-stress: the rm named a path that does not exist.
  2. Install the image's Python packages in one uv run: everything, python-osism included, is installed in a single uv pip install. python-osism's requirement files are passed as --overrides. Two supporting changes:
    • The new requirements.overrides.txt pins typer, the one package the bundled tools disagree on that python-osism does not pin.
    • requirements.txt pins kombu[redis], so the override keeps the redis extra that celery[redis] requests.
  3. Fail the image check on violated osism pins: this depends on 2. On its own, it would fail every build.

Testing

I built origin/main and this branch locally at the same time:

  • Both images pass the smoke tests in playbooks/build.yml.
  • The package lists differ only in the three versions above.
  • The build log shows one resolution instead of nine.
  • The check script from playbooks/build.yml fails on the origin/main image (openstacksdk and pyyaml) and passes on this branch.

The container-image-python-osism-build check job builds the image from this PR in CI.

🤖 Generated with Claude Code

The Containerfile clones openstack-simple-stress to
/openstack-simple-stress and then means to delete the clone's .git
directory, as it does for the other clones. The rm command named
/osism/openstack-simple-stress/.git instead, a path that does not
exist, so it did nothing and the git metadata stayed in the image.

Correct the path. The image loses /openstack-simple-stress/.git, 184 KB
of the 328 KB checkout. Nothing reads it: openstack-simple-stress runs
as a script from the checkout and does not determine its version from
git.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
What changes in the image: it contains the versions that python-osism
pins. Built from the same upstream state as before, it has the same
206 packages, and three of them change version:

- openstacksdk 4.25.0 -> 4.26.0 (pinned in requirements.txt)
- python-neutronclient 14.0.0 -> 14.1.0 (pinned in
  requirements.openstackclient.txt)
- pyyaml 6.0.3 -> 6.0.4 (pinned in requirements.txt)

What changes for later images: a version that python-osism pins can
only change through this repository. Before, a dependency update in
openstack-project-manager or openstack-simple-stress, which the build
clones from their default branches, could replace one of python-osism's
versions in the next image. That is how the image came to ship
openstacksdk 4.25.0. If two bundled tools pin different versions of a
package that python-osism does not pin, the build now fails and names
both pins, instead of shipping whichever was installed last.

Why the versions differed: the Containerfile installed Python packages
in ten separate uv runs: seven requirement files, python-osism itself,
and the requirements.txt of the two clones. Each run resolved on its
own and replaced what earlier runs had installed, so the last run to
pin a package decided its version.

How: clone the two repositories first, then install everything in a
single `uv pip install`. uv's --overrides option replaces every
requirement on a package, including those declared by other packages,
with the version in the override files. python-osism's own requirement
files (requirements.txt, requirements.openstackclient.txt,
requirements.ansible.txt) are passed as overrides. One package needs a
version that none of them pins: openstack-project-manager pins typer
0.27.3 and openstack-simple-stress pins 0.29.2, which cannot resolve
together. The new requirements.overrides.txt pins typer 0.29.2, the
version the image already shipped. Renovate picks the file up like the
other requirement files.

An override replaces a requirement together with its extras. celery,
installed as celery[redis], requires kombu[redis], and requirements.txt
pinned plain kombu, so as an override it would drop the redis extra and
the requirements that come with it. requirements.txt now pins
kombu[redis], the same package that celery[redis] already requires, so
python-osism's own dependencies do not change. No other package that
the override files pin is requested with an extra they leave out
(typer 0.29 no longer has the "all" extra that two managers request).

The image check in playbooks/build.yml, which runs `uv pip check` in
the built image, is unchanged and stays report-only. It no longer
lists a violated python-osism requirement. Its remaining lines are the
bundled tools' exact pins that the overrides replace.

Tested by building origin/main and this change at the same time. Both
images pass the smoke tests in playbooks/build.yml. Apart from the
three versions above, their package lists are identical. The build log
shows one resolution instead of nine (one of the ten runs had nothing to
resolve).

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
After building the image, playbooks/build.yml runs `uv pip check`
inside it. The check lists every installed package whose declared
requirements are not met, but it only reports: conflicts (exit code 1)
never fail the build.

Report-only is right for most of what it lists. The image bundles tools
such as openstack-image-manager, openstack-flavor-manager and
netbox-manager, which declare exact versions in their package metadata.
The Containerfile installs everything in one uv run with python-osism's
requirement files as overrides, so python-osism's versions replace those
exact pins, and `uv pip check` lists each replaced pin. These lines are
expected, and there are a dozen or more of them.

A line about the osism package itself is different. It means that the
image does not contain the version python-osism pins, so python-osism
runs with dependencies it was not released with. Such a line looked
exactly like the expected ones and did not fail the build either. For
example, with python-osism pinning openstacksdk 4.26.0, an image could
contain 4.25.0, installed by a bundled tool's requirements, and the
check printed "The package `osism` requires `openstacksdk==4.26.0`, but
`4.25.0` is installed" among the other lines and passed.

Keep the report, and fail the build when it contains a line starting
with "The package `osism` requires". Everything else stays report-only.
This relies on the Containerfile installing everything in one uv run
with python-osism's pins as overrides. Built that way, the image does
not produce such a line, so this change does not make the build fail.
On an image installed with separate uv runs per requirement file, it
would fail the build every time a later run replaced a version that
python-osism pins.

The check runs in both the build job and the push job, before the push
step, so an image that violates python-osism's pins is not pushed.

Tested by running the check script from this playbook against an image
built with separate uv runs per requirement file, which contained
openstacksdk 4.25.0 against python-osism's 4.26.0 pin: it fails. An
image built with the single uv run passes.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
@ideaship ideaship self-assigned this Nov 28, 2026
@ideaship
ideaship marked this pull request as ready for review November 28, 2026 18:59
@ideaship
ideaship requested a review from berendt November 28, 2026 18:59
# Versions for packages that python-osism does not pin itself but that
# several bundled tools pin, each differently. They resolve together in a
# single uv run (see Containerfile), so one version has to be chosen here.
typer==0.29.2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this version handled by Renovate?

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

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants