Repository navigation
feat: constraints mode for testing the oldest supported versions in CI - #46
omar-radwan7 wants to merge 1 commit into
Conversation
Add mode: constraints, which writes a constraints file with exact SPEC 0 minimum version pins instead of updating the project file and opening a PR. Floors are computed from all schedule entries up to a reference date. Missing floors and invalid schedule data fail with a clear message. Outputs: constraints_file, versions (JSON) and python_version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7ywk9uaZ3gLUcBP7UysV3
|
Thank you for the PR @omar-radwan7. I guess I am confused. You want to just run the floor version of dependencies on the CI? |
|
Yes. The action already raises the minimum versions, but nothing tests that the project still works with them. This mode writes the exact minimum versions so a CI job can install and test them. shap does this by hand today with |
|
I guess my answer is that you should use existing tooling either:
The last one is what I use myself to check this. Would these not be a better fit than adding a new method to this action? Or do I misunderstand something? |
|
You're right, thanks. I tried Would a short readme section on testing the floors in CI with |
|
Thanks for the advice. I followed it: shap now uses |
Constraints mode for testing the oldest supported versions in CI
The action can already raise the lower bounds in
pyproject.toml. This adds a second mode that helps projects check those lower bounds:mode: constraintswrites a constraints file with exact SPEC 0 minimum versions, so a CI job can install and test the oldest supported combination. It does not touch the project file or open a PR.Motivation: shap wants to replace a hand-maintained
numpy==2.0pin in its CI with floors taken from the SPEC 0 schedule (shap/shap#5263). That issue suggests extending this action instead of writing a separate script, so other projects can use it too. Made during the GC.OS hackathon in Ulm.Changes
spec0_action/constraints.py: computes the floors on a reference date by applying all schedule entries up to that date in order (each entry only lists the packages that change), and formats them as exact pins. With>=the installer would pick the newest release, so the minimum would never be tested. Python is left out of the file and reported as an output instead.run_spec0_constraints.py: CLI with--packages,--outputand--reference-date. Writesconstraints_file,versions(JSON) andpython_versionto$GITHUB_OUTPUT.action.yaml: new inputsmode,packages,constraints_file,reference_dateand the three outputs. In constraints mode the checkout, git setup, update and PR steps are skipped.updatestays the default, so existing users are not affected.pyproject.toml:write-constraintspixi task.test_action.yamlthat runs the action in constraints mode and checks the file and outputs.The run fails with a message naming the packages if the schedule has no floor for them on the reference date, and on invalid schedule data, instead of falling back to the newest version.
Testing
tests/test_constraints.py(floors across entries, start date boundaries, unsorted schedule, missing floors, invalid schedules, CLI outputs). Full suite: 101 passed.python_versionoutput, installed shap at those versions and the tests passed (387 passed, 0 failed): https://github.com/omar-radwan7/shap/actions/runs/41460204617/job/125326992471AI disclosure
Written with Claude Code. I chose the task and the approach with the shap maintainers at the hackathon. Claude wrote the code and tests and ran them. I reviewed the changes before opening this PR.
Generated with Claude Code
https://claude.ai/code/session_01Q7ywk9uaZ3gLUcBP7UysV3