Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tooling] Add make targets to generate requirements.txt #917

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ json-schema-lint:
.PHONY: hygiene-tests
hygiene-tests: check-hygiene

# TODO: Add dependency on requirements.txt after we are sufficiently sure most users won't encounter a circular dependency
.PHONY: image
image:
cd monitoring && make image
Expand Down Expand Up @@ -118,9 +119,20 @@ restart-all: stop-uss-mocks down-locally start-locally start-uss-mocks
.PHONY: restart-uss-mocks
restart-uss-mocks: stop-uss-mocks start-uss-mocks

# To be run locally whenever a direct dependency has been updated in requirements.in
# Legacy target To be run locally whenever a direct dependency has been updated in requirements.in
.PHONY: update-pinned-dependencies
update-pinned-dependencies:
./scripts/pip_tools/pip_compile.sh --generate-hashes --output-file=requirements.txt requirements.in
update-pinned-dependencies: requirements.txt

define finalize_requirements_txt
awk 'BEGIN { RS = ""; FS = "\n" } { gsub("# by the following command:\n#\n# pip-compile --generate-hashes --output-file=requirements.txt requirements.in\n#\n", "#\n# See requirements.in to update.\n\n"); print }' requirements.txt > requirements.txt.new && mv requirements.txt.new requirements.txt
echo The WARNING above is expected: https://github.com/jazzband/pip-tools/issues/2160
endef

requirements.txt: requirements.in
docker container run -u ${USER_GROUP} -v $(CURDIR):/app/monitoring interuss/monitoring pip-compile --cache-dir /tmp/.pip-cache --generate-hashes --output-file=requirements.txt requirements.in
$(call finalize_requirements_txt)

.PHONY: upgrade-requirements
upgrade-requirements:
docker container run -u ${USER_GROUP} -v $(CURDIR):/app/monitoring interuss/monitoring pip-compile --cache-dir /tmp/.pip-cache --upgrade --generate-hashes --output-file=requirements.txt requirements.in
$(call finalize_requirements_txt)
10 changes: 0 additions & 10 deletions build/dev/pip_tools.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion introduction_to_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ Direct dependencies are declared in `requirements.in`. This file may be modified
When `requirements.in` is updated, the pinned dependencies must be updated by running:

```bash
make update-pinned-dependencies
make requirements.txt
```
5 changes: 5 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# When adding a dependency, the version should usually be specified exactly to
# avoid breakages when new versions are released.

# To autogenerate requirements.txt from this file, run `make requirements.txt`
# from this working directory. To upgrade all dependencies, run
# `make upgrade-requirements`.

aiohttp==3.11.11
arrow==1.1.0
bc-jsonpath-ng==1.5.9 # uss_qualifier
Expand All @@ -32,6 +36,7 @@ numpy==1.26.4
oauthlib==3.2.2 # mock_uss tracer
pem==21.2.0 # deployment_manager
psycopg[binary]==3.1.18 # PostgreSQL/CockroachDB lib
pip-tools==7.4.1 # Building requirements.txt from requirements.in
pvlib==0.10.1
pyjwt==2.4.0
pykml==0.2.0
Expand Down
30 changes: 25 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
#
# See requirements.in to update.

aiohappyeyeballs==2.4.4 \
--hash=sha256:5fdd7d87889c63183afc18ce9271f9b0a7d32c2303e394468dd45d514a757745 \
--hash=sha256:a980909d50efcd44795c4afeca523296716d50cd756ddca6af8c65b996e27de8
Expand Down Expand Up @@ -195,6 +194,10 @@ brotli==1.1.0 \
--hash=sha256:fd5f17ff8f14003595ab414e45fce13d073e0762394f957182e69035c9f3d7c2 \
--hash=sha256:fdc3ff3bfccdc6b9cc7c342c03aa2400683f0cb891d46e94b64a197910dc4064
# via geventhttpclient
build==1.2.2.post1 \
--hash=sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5 \
--hash=sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7
# via pip-tools
cachetools==5.3.3 \
--hash=sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945 \
--hash=sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105
Expand Down Expand Up @@ -356,7 +359,9 @@ charset-normalizer==3.3.2 \
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
# via flask
# via
# flask
# pip-tools
configargparse==1.7 \
--hash=sha256:d249da6591465c6c26df64a9f73d2536e743be2f244eb3ebe61114af2f94f86b \
--hash=sha256:e7067471884de5478c58a511e529f0f9bd1c66bfef1dea90935438d6c23306d1
Expand Down Expand Up @@ -1125,6 +1130,7 @@ packaging==24.0 \
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
# via
# build
# gunicorn
# pytest
pandas==2.2.2 \
Expand Down Expand Up @@ -1162,6 +1168,10 @@ pem==21.2.0 \
--hash=sha256:64afb669f05502c071d0706ee66e51471718ae248ba39624919da7b4ea73506e \
--hash=sha256:c491833b092662626fd58a87375d450637d4ee94996ad9bbbd42593428e93e5a
# via -r requirements.in
pip-tools==7.4.1 \
--hash=sha256:4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9 \
--hash=sha256:864826f5073864450e24dbeeb85ce3920cdfb09848a3d69ebf537b521f14bcc9
# via -r requirements.in
pluggy==1.5.0 \
--hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \
--hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669
Expand Down Expand Up @@ -1404,6 +1414,12 @@ pyproj==3.6.1 \
--hash=sha256:fd93c1a0c6c4aedc77c0fe275a9f2aba4d59b8acf88cebfc19fe3c430cfabf4f \
--hash=sha256:fffb059ba3bced6f6725961ba758649261d85ed6ce670d3e3b0a26e81cf1aa8d
# via -r requirements.in
pyproject-hooks==1.2.0 \
--hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \
--hash=sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913
# via
# build
# pip-tools
pyrsistent==0.20.0 \
--hash=sha256:0724c506cd8b63c69c7f883cc233aac948c1ea946ea95996ad8b1380c25e1d3f \
--hash=sha256:09848306523a3aba463c4b49493a760e7a6ca52e4826aa100ee99d8d39b7ad1e \
Expand Down Expand Up @@ -1739,6 +1755,10 @@ werkzeug==3.0.2 \
# flask
# flask-login
# locust
wheel==0.45.1 \
--hash=sha256:661e1abd9198507b1409a20c02106d9670b2576e916d58f520316666abca6729 \
--hash=sha256:708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248
# via pip-tools
yarl==1.18.3 \
--hash=sha256:00e5a1fea0fd4f5bfa7440a47eff01d9822a65b4488f7cff83155a0f31a2ecba \
--hash=sha256:02ddb6756f8f4517a2d5e99d8b2f272488e18dd0bfbc802f31c16c6c20f22193 \
Expand Down Expand Up @@ -1865,8 +1885,8 @@ zope-interface==6.3 \
--hash=sha256:f83d6b4b22262d9a826c3bd4b2fbfafe1d0000f085ef8e44cd1328eea274ae6a \
--hash=sha256:f95bebd0afe86b2adc074df29edb6848fc4d474ff24075e2c263d698774e108d
# via gevent

# WARNING: The following packages were not pinned, but pip requires them to be
# pinned when the requirements file includes hashes and the requirement is not
# satisfied by a package already installed. Consider using the --allow-unsafe flag.
# pip
# setuptools
21 changes: 0 additions & 21 deletions scripts/pip_tools/pip_compile.sh

This file was deleted.

Loading