Standardize lock generation on Python 3.12 - #62
Conversation
|
/hold let's wait for #61 to land :) BTW it's a +1 for me, I'll give my approval + lgtm once the patch will be rebased. (I've added a nit comment, but it's a really small thing :)) |
fee44b0 to
eed4a3c
Compare
Dependency markers are evaluated by the Python interpreter running the resolver. Allowing different Python minor versions and unpinned generator tools therefore produces host-dependent lock files and noisy generator metadata. Require Python 3.12 for source and lock generation, pin the resolver tools, and normalize annotations, headers, and index configuration from generated locks. Add a pinned-source reproducibility workflow and architecture checks, then regenerate the tracked lock files with the canonical environment. Assisted-By: Pi gpt-5.6-sol Signed-off-by: Sean Mooney <work@seanmooney.info>
eed4a3c to
d28af26
Compare
|
/unhold |
| @@ -1,13 +1,13 @@ | |||
| name: Setup Python and tox | |||
| description: Install Python and tox (repository must already be checked out) | |||
| description: Install tox with the repository's canonical Python 3.12 | |||
There was a problem hiding this comment.
We have base_python = 3.12 in tox.ini . I assumed that would be enough to force using 3.12 but I guess forcing it also in this reusable action is also good.
|
|
||
| - name: Verify update-sources runs successfully | ||
| run: tox -e update-sources | ||
| - name: Regenerate from committed source pins |
There was a problem hiding this comment.
I was proposing a slighly differen approach in #71 (https://github.com/openstack-k8s-operators/s2i-openstack-containers/pull/71/changes#diff-7971d8b59d1741371c2005851444df0d33024141e386601f9f88fdefdde1bb17) :
- Run update-lockfiles only on the changed services (that was discussed in previous conversations when adding it to pre-commit).
- Note
git diff --exit-code -- containers/will not monitor added files, only modifed ones, so if someone totally forgets adding the lockfiles when adding new services, this won't catch it.
|
|
||
| ```bash | ||
| STREAM=master SKIP_HASH_UPDATE=1 ./build.sh update-sources <project-or-all> | ||
| STREAM=master uvx --python 3.12 tox -e update-lockfiles -- <project-or-all> |
There was a problem hiding this comment.
Good to add uvx usage. Won't tox force to use 3.12 as we are setting it as base_python?
There was a problem hiding this comment.
not if you run it on a sytem that does not have 3.12 aviable by default.
i do not have tox installed system wide and tend to run it via uvx which is defualting ot 3.14 (which happens to be my ststems default python as well)
but i also tell my llm to use 3.13 by default when they run things so i ended up with the legacy_cgi this is partly just for me or rather future me to be explictly told use 3.12 (becuae this nomally runs on c10s) :)
| awk ' | ||
| !seen_package && /^--(index-url|extra-index-url|trusted-host)[[:space:]]/ { | ||
| next | ||
| } | ||
| !seen_package && (/^#/ || /^$/) { next } | ||
| !/^#/ { seen_package = 1 } | ||
| { print } | ||
| ' "${lockfile}" > "${tmp}" | ||
| install -m 644 "${tmp}" "${lockfile}" | ||
| rm "${tmp}" |
There was a problem hiding this comment.
I implemented similar in #71 by removing any empty or commented line. I'm not sure if that leaves anything out.
| echo "--- Generating ${project_dir}/${lock_file} ---" | ||
| (cd "${project_dir}" && \ | ||
| pip-compile --allow-unsafe --strip-extras \ | ||
| pip-compile --allow-unsafe --no-annotate --strip-extras \ |
There was a problem hiding this comment.
i was debating this one they are potically useful but just make everything so verbose that i tought better remove them now and if we need them we can generate them as a one of to check why a depency was pulled in
There was a problem hiding this comment.
I had the exact same debate and reach the same exact conclussion :)
| pre-commit run --all-files --show-diff-on-failure {posargs} | ||
|
|
||
| [testenv:update-sources] | ||
| description = Refresh source pins and generated lockfiles |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rebtoor The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
4265d58
into
openstack-k8s-operators:split/pr14-docs
|
so this was merged into the wront brnach becase the target brnach was not deleted before and this is a stacked pr so it never updated to main |
Summary
Validation
tox -e update-lockfilestwice with identical checksumsSKIP=update-lockfiles uvx pre-commit run -abash -n build.shgit diff --checklegacy-cgiis absent fromcontainers/Dependency
Depends on #61 for the documentation layout. This PR is temporarily based on
split/pr14-docs; retarget it tomainafter #61 merges.