@@ -6,10 +6,10 @@ Various scripts for CI/CD, release automation, and development tasks.
66
77### Setup
88
9- Install dependencies (all pinned and CVE- free ):
9+ Install direct dependencies (hashed, no transitive deps ):
1010
1111``` bash
12- pip install -r requirements.txt
12+ python3 -m pip install --require-hashes --no-deps -r scripts/ requirements.txt
1313```
1414
1515### Available Scripts
@@ -29,7 +29,7 @@ It's recommended to use a virtual environment:
2929``` bash
3030python3 -m venv venv
3131source venv/bin/activate # On macOS/Linux
32- pip install -r requirements.txt
32+ python3 -m pip install --require-hashes --no-deps -r scripts/ requirements.txt
3333```
3434
3535To deactivate: ` deactivate `
@@ -39,7 +39,7 @@ To deactivate: `deactivate`
3939To verify everything works:
4040
4141``` bash
42- ./test_python_scripts.sh
42+ ./scripts/ test_python_scripts.sh
4343```
4444
4545This creates a temporary environment, installs dependencies, runs tests, and cleans up automatically.
@@ -52,3 +52,27 @@ The `requirements.txt` includes **4 direct dependencies** (all pinned to specifi
5252- ** PyYAML** - YAML parsing for release notes
5353- ** Jinja2** - Template rendering for changelog files
5454- ** requests** - HTTP client for GitHub API interactions
55+
56+ ## Updating requirements.txt hashes
57+
58+ If ` ./scripts/test_python_scripts.sh ` fails with a ` --require-hashes ` error, regenerate hashes using a temporary no-hash file:
59+
60+ ``` bash
61+ cp scripts/requirements.txt /tmp/requirements-no-hash.txt
62+ python3 - << 'PY '
63+ import re, pathlib
64+ path = pathlib.Path('/tmp/requirements-no-hash.txt')
65+ text = path.read_text()
66+ text = re.sub(r"\s+--hash=sha256:[a-f0-9]+", "", text)
67+ path.write_text(text)
68+ print("Wrote", path)
69+ PY
70+
71+ mkdir -p /tmp/pip-hashes
72+ python3 -m pip download --no-deps -r /tmp/requirements-no-hash.txt -d /tmp/pip-hashes --quiet
73+ python3 -m pip hash /tmp/pip-hashes/* | sed ' s/^.*--hash=/--hash=/'
74+ rm -rf /tmp/pip-hashes
75+ rm /tmp/requirements-no-hash.txt
76+ ```
77+
78+ Add the pinned versions and hashes from the output to ` scripts/requirements.txt ` (direct dependencies only).
0 commit comments