Skip to content

Commit 5de41a8

Browse files
fix(deps): add pip-tools lockfile with hash pinning - VC-53681 [Logos] (#199)
* fix(deps): add pip-tools lockfile with hash pinning — VC-53681 Introduces requirements.in and requirements-build.in as pip-tools source manifests. requirements.txt and requirements-build.txt are now fully hash-pinned lockfiles generated with pip-compile --generate-hashes, covering all transitive dependencies with SHA-256 hashes. Generated using Python 3.9 to ensure compatibility with the project's supported Python versions (3.9, 3.10). No package versions were changed — this purely adds auditability of transitive dependencies. * deps: address review feedback and fix safety regression * deps: address follow-up review findings
1 parent c028585 commit 5de41a8

8 files changed

Lines changed: 1095 additions & 16 deletions

File tree

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
requirements.txt linguist-generated=true
2+
requirements-build.txt linguist-generated=true

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM python:3
1+
FROM python:3.9-slim
22

33
WORKDIR /usr/src/app
44

5-
COPY requirements.txt ./
65
COPY requirements-build.txt ./
76
COPY docker-entrypoint.sh ./
8-
RUN pip install --no-cache-dir -r requirements.txt
9-
RUN pip install --no-cache-dir -r requirements-build.txt
7+
RUN pip install --no-cache-dir --require-hashes -r requirements-build.txt
108

119
COPY . .
1210

13-
CMD [ "./docker-entrypoint.sh" ]
11+
CMD [ "./docker-entrypoint.sh" ]

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
.EXPORT_ALL_VARIABLES:
22
PYTHONPATH=./:$PYTHONPATH
3+
PIP_TOOLS_VERSION=7.5.3
4+
5+
.PHONY: lock test publish
6+
7+
lock:
8+
docker run --rm -v "$$(pwd)":/work -w /work python:3.9 \
9+
sh -c "pip install pip-tools==$(PIP_TOOLS_VERSION) && \
10+
pip-compile --generate-hashes --output-file requirements.txt requirements.in && \
11+
pip-compile --generate-hashes --output-file requirements-build.txt requirements-build.in && \
12+
chown $$(id -u):$$(id -g) requirements.txt requirements-build.txt"
313

414
test:
515
docker build -t vcert-tests .

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ NOTE: While developing with vcert-python, it is helpful if you are using a virtu
105105
install the vcert-python library from source in development mode with `pip install --editable`.
106106
See https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
107107

108+
### Managing dependencies
109+
110+
`requirements.txt` and `requirements-build.txt` are generated by [pip-tools](https://github.com/jazzband/pip-tools) and contain hash-pinned transitive dependencies. Do not edit them directly. To add or update a dependency:
111+
112+
1. Edit `requirements.in` (runtime) or `requirements-build.in` (build/test)
113+
2. Run `make lock` to regenerate the lockfiles (requires Docker)
114+
3. Commit both the `.in` and `.txt` files together
115+
108116
## Version History
109117

110118
[Check version history here](https://github.com/Venafi/vcert-python/blob/master/docs/version_history.md)

requirements-build.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-r requirements.in
2+
pytest==7.4.3
3+
pytest-cov==4.1.0
4+
safety==2.3.5
5+
bandit==1.7.7

requirements-build.txt

Lines changed: 688 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
requests==2.32.4
2+
python-dateutil==2.8.2
3+
cryptography==45.0.7
4+
six==1.17.0
5+
ruamel.yaml==0.18.13
6+
pynacl==1.5.0

requirements.txt

Lines changed: 373 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)