Skip to content

chore: pin deps to SHA256 hashes via pip-compile#4268

Open
luarss wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
luarss:topic/pin-deps-orfs
Open

chore: pin deps to SHA256 hashes via pip-compile#4268
luarss wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
luarss:topic/pin-deps-orfs

Conversation

@luarss
Copy link
Copy Markdown
Contributor

@luarss luarss commented May 30, 2026

fixes #4263

Summary

Pin all Python dependencies to SHA256 hashes using pip-compile --generate-hashes from pip-tools. This mirrors the pattern already in place for flow/util/requirements_lock.txt and extends it to every other pip install location in the repo.

Changes

Area Before After
docs/ requirements.txt (all unpinned) requirements.in + requirements_lock.txt (SHA256-pinned)
GitHub Actions (3 workflows) per-workflow inline pip install (partially/fully unpinned) single .github/requirements/requirements_lock.txt shared by all
etc/DependencyInstaller.sh 6 packages installed unpinned etc/requirements-common.in + requirements-common_lock.txt

Details

  • Each area gets a *.in source file (high-level constraints) and a generated *_lock.txt with full SHA256 hashes for every package including transitive deps.
  • docs/requirements.txtdocs/requirements.in: the git+https:// URL for sphinx-external-toc is replaced with sphinx-external-toc==0.3.1 (same release, available on PyPI, hash-verifiable).
  • .readthedocs.yaml: Python bumped from 3.7 (EOL) to 3.10; install target updated to docs/requirements_lock.txt.
  • All three CI workflows (lint-tcl, yaml-test, update-rules) now share .github/requirements/requirements.in and a single lock file. Workflows that had no explicit Python version now pin to 3.10 via actions/setup-python, consistent with update-rules.
  • Lock files are regenerated with: pip-compile --generate-hashes <file>.in -o <file>_lock.txt

@luarss luarss requested a review from vvbandeira May 30, 2026 06:34
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces lockfiles for managing Python dependencies across various configurations, including GitHub workflows, ReadtheDocs, and the dependency installer script, while also upgrading the Python build version to 3.10 on ReadtheDocs. Feedback on the changes highlights a portability issue in DependencyInstaller.sh, where the use of realpath may fail on macOS, and suggests a more robust alternative using cd and pwd.

fi
local pkgs="pandas numpy firebase_admin click pyyaml yamlfix"
local lockfile
lockfile="$(dirname "$(realpath "$0")")/requirements-common_lock.txt"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using realpath can fail on macOS and older BSD systems where it is not installed by default. Since this script explicitly supports macOS, it is safer and more portable to use cd and pwd to resolve the absolute path of the script's directory.

Suggested change
lockfile="$(dirname "$(realpath "$0")")/requirements-common_lock.txt"
lockfile="$(cd "$(dirname "$0")" && pwd)/requirements-common_lock.txt"

@luarss luarss force-pushed the topic/pin-deps-orfs branch 2 times, most recently from d565232 to 5b6cab8 Compare May 30, 2026 06:35
luarss added 7 commits May 30, 2026 07:22
Replace unpinned docs/requirements.txt with a requirements.in source
spec and a pip-compile-generated requirements_lock.txt with SHA256
hashes for all packages. Switch sphinx-external-toc from a git URL to
its PyPI release so hashes can be verified. Update .readthedocs.yaml
to use the lock file and bump Python from 3.7 (EOL) to 3.10.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
Add .github/requirements/tclint.in and a pip-compile-generated lock
file with SHA256 hashes. Update the lint-tcl workflow to install from
the lock file and pin Python to 3.10 via actions/setup-python.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
Add .github/requirements/yaml-test.in and a pip-compile-generated lock
file with SHA256 hashes. Update the yaml-test workflow to install from
the lock file, add the lock file to sparse-checkout, and pin Python to
3.10 via actions/setup-python. Also pins the previously unpinned pyyaml.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
Add .github/requirements/update-rules.in and a pip-compile-generated
lock file with SHA256 hashes. Update the update-rules workflow to
install from the lock file instead of unpinned firebase-admin.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
Add etc/requirements-common.in and a pip-compile-generated lock file
with SHA256 hashes for all packages previously installed unpinned
(pandas, numpy, firebase_admin, click, pyyaml, yamlfix). Update
_installPipCommon() to install from the lock file.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
Merge the three per-workflow requirements files (tclint, yaml-test,
update-rules) into a single .github/requirements/requirements.in and
a shared requirements_lock.txt. All CI workflows now install from one
place, reducing lock-file sprawl and making dependency updates a
single-file change.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
DependencyInstaller.sh resolves the pip lockfile relative to its own
directory, so requirements-common_lock.txt must be copied alongside it
into /tmp/installer/etc/ inside the container.

Signed-off-by: Jack Luar <jluar@precisioninno.com>
@luarss luarss force-pushed the topic/pin-deps-orfs branch from 2406b27 to 078c489 Compare May 30, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pin python requirements to sha

1 participant