Repository navigation
Modernize CI: uv lock file, Dependabot, lowest-dependency testing, workflow hardening - #805
Conversation
Use the versions pinned in uv.lock, the same ones as CI, instead of a separately pinned ruff hook. The hooks find the tools in .venv on Linux, macOS and Windows without an activated virtual environment.
Lock every extra and dependency group in uv.lock, which CI installs from. Ignore releases younger than 7 days (exclude-newer) as a supply-chain cooldown. Raise lower bounds that never worked, found by testing at the lowest versions: category_encoders 2.8.0, panel 1.9.0, Flask 2.3.0, plotly 5.12.0, shapely 2.0.4. Drop the requires-python and scikit-learn upper caps and the unneeded wheel build requirement. Add zizmor to the dev group.
Add a workflows target (zizmor). Build with uv build instead of setup.py. Remove dead targets (release, servedocs, install) and the Python 2 browser helper, list every target in .PHONY, keep the clean targets out of .venv.
Switch CI from pip to uv. Tests install the uv.lock versions, with CPU-only torch. Replace pandas_compat with a lowest_deps job that runs the suite with every direct dependency at its lower bound. Run code quality on Python 3.11 so mypy checks against the oldest supported version, an audit the workflows with zizmor. Pin actions to commit SHAs and restrict permissions.
Pin actions to commit SHAs, restrict permissions to contents: read and stop persisting checkout credentials. Build with uv build. Install only shapash from TestPyPI in the release-candidate smoke test and its dependencies from PyPI, to avoid dependency confusion. Skip SonarQube on Dependabot PRs, which get no secrets.
Weekly PRs targeting develop: minor and patch updates grouped in one PR, major updates in their own, with a 7-day cooldown matching exclude-newer.
Document the uv setup (pip as an alternative), the make targets CI runs, the 75% total and 90% patch coverage requirements, dependency changes, docs and tutorials, and the review process. Add a section on contributing using AI.
shap 0.49 cannot parse models from xgboost >= 3.1, so ShapBackend fell back to a generic explainer without a masker and raised "masker cannot be None". The universal lock had resolved shap 0.49.1 for Python 3.11.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #805 +/- ##
========================================
Coverage 86.08% 86.08%
========================================
Files 115 115
Lines 11825 11825
Branches 2158 2158
========================================
Hits 10180 10180
Misses 1009 1009
Partials 636 636 🚀 New features to boost your workflow:
|
| sleep 30 | ||
| done | ||
| # Already installed, so pip keeps it and installs its dependencies from PyPI. | ||
| pip install "shapash==${RELEASE_VERSION}" |
There was a problem hiding this comment.
Does this works?
You target pypi.org here where REALESE_VERSION does not exists.
How can it fetch its dependencies?
Am I misreading something?
There was a problem hiding this comment.
When shapash==X is already installed (here the release candidate from test.pypi), pip's resolver takes the installed copy ("Requirement already satisfied"). It doesn't need that version to exist on PyPI. It reads the installed package's metadata and fetches only its dependencies from PyPI.
| steps: | ||
| - name: Git checkout | ||
| uses: actions/checkout@v6 | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 |
There was a problem hiding this comment.
Is it best pratice to target a commit hash instead of a tag?
There was a problem hiding this comment.
Yes, it's the practice GitHub recommends in its security hardening guide for Actions: pinning to a full-length commit SHA is the only way to reference an action immutably.
A tag like v4 is a movable pointer. Whoever controls the action's repo (or an attacker who compromises it) can repoint the tag to different code, and our workflows would run it on the next trigger with no change on our side. A SHA, on the contrary can't be moved.
Respond to the eMudhra/emSign CA certificate security incident: certifi 2026.10.19 drops the compromised root, and uv < 0.13.4 still trusts it. certifi is let in ahead of the 7-day cooldown through a one-off exclude-newer-package cutoff, to be removed after 2026-10-27.
Dependabot rejected the config after #805: the uv ecosystem does not accept `widen`. `auto` widens for a package detected as a library, so it still raises upper caps and leaves the lower bounds tested by `lowest_deps` untouched.
Description
CI used to install the newest dependencies with pip on every run. A new release anywhere in the stack could break an unrelated PR, and nothing checked the lower bounds declared in
pyproject.toml. This PR pins CI to a committeduv.lock, adds Dependabot to keep that lock current, tests the declared lower bounds, hardens the workflows, and updates the contributing guide to match.Dependencies and lock file
uv.lockcommitted: the test and code-quality jobs install exactly these versions (uv sync --lockedfails when the lock is out of date), so CI results are reproducible.exclude-newer = "7 days"in[tool.uv]: releases younger than a week are ignored, as a supply-chain cooldown. It needs uv >= 0.9.17, enforced withrequired-version.Lower bounds raised: the new
lowest_depsjob showed that several declared lower bounds never worked:_get_tags(262 failing tests)report)label=argument (11 failing tests)Markupimport error with current Jinja2np.bool8, removed from numpyxgboost >= 3.1Caps removed:
requires-python(<3.15) and scikit-learn (<1.10). Upper caps on a library block users' installs before any problem exists. The dash, plotly and pandas caps stay, because their major releases have broken shapash before.wheelremoved frombuild-system.requires, since setuptools no longer needs it.pytest>=8.0andpytest-cov>=6.0floors added to thetestgroup;zizmoradded todev.Dependabot (
.github/dependabot.yml, new)develop:versioning-strategy: widenonly editspyproject.tomlto raise an upper cap, so a major dash, plotly or pandas release arrives as a PR that tests the new major.exclude-newer.CI (
main.yml)astral-sh/setup-uv, with the cache keyed onuv.lock.uv.lockvia a constraints file.--torch-backend cpuinstalls the same torch version as the lock, from the CPU-only index. This avoids several GB of CUDA libraries the tests never use.lowest_depsjob replacespandas_compat:pyproject.toml(--resolution lowest-direct), on Python 3.11, without NLP.make workflowsstep audits the workflows with zizmor.workflow_dispatchadded, so CI can be run manually.Workflow hardening (all workflows)
permissions: contents: readat the top of every workflow, andpersist-credentials: falseon every checkout.uv build.--extra-index-urland pulled dependencies from TestPyPI as well as PyPI. Anyone can upload to TestPyPI, so this was a dependency-confusion risk.--no-deps) and its dependencies from PyPI.Pre-commit
.venvtools thatuv.lockpins..venv/bin(Linux, macOS) and.venv/Scripts(Windows), so they work without an activated venv, from the terminal or an IDE.Makefile
workflowstarget (zizmor).distbuilds withuv buildinstead of the deprecatedpython setup.py.release(manual twine upload, replaced by the tag-triggered publish workflows),servedocs(needed watchdog, which no dependency group installs) andinstall.python -m webbrowser,.PHONYlists every target, thecleantargets skip.venv, andclean-testalso removes the mypy and ruff caches.CONTRIBUTING.md (rewritten)
The guide is restructured for external contributors: open an issue, set up the environment, make the changes, submit them. Main changes:
maketargets CI runs, with notes for contributors withoutmake.Type of change
How Has This Been Tested?
--python-version 3.11, it fails on numpy's stubs, which is why the job runs on 3.11.env -i PATH=/usr/bin:/bin), which confirms the.venvlookup works.Test Configuration:
Checklist: