mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 08:40:29 -04:00
switch from freeze reqs script to pip-tools
instead of alexey's home-grown script, pip-tools offers a quicker, more efficient and better supported way to freeze requirements. see prior art here: https://github.com/alphagov/notifications-admin/pull/3753 https://github.com/alphagov/notifications-ftp/pull/333
This commit is contained in:
20
Makefile
20
Makefile
@@ -54,29 +54,15 @@ generate-version-file: ## Generates the app version file
|
||||
@echo -e "__git_commit__ = \"${GIT_COMMIT}\"\n__time__ = \"${DATE}\"" > ${APP_VERSION_FILE}
|
||||
|
||||
.PHONY: test
|
||||
test: test-requirements ## Run tests
|
||||
test: ## Run tests
|
||||
flake8 .
|
||||
isort --check-only ./app ./tests
|
||||
pytest -n4 --maxfail=10
|
||||
|
||||
.PHONY: freeze-requirements
|
||||
freeze-requirements: ## Pin all requirements including sub dependencies into requirements.txt
|
||||
rm -rf venv-freeze
|
||||
virtualenv -p python3 venv-freeze
|
||||
$$(pwd)/venv-freeze/bin/pip install -r requirements-app.txt
|
||||
echo '# pyup: ignore file' > requirements.txt
|
||||
echo '# This file is autogenerated. Do not edit it manually.' >> requirements.txt
|
||||
cat requirements-app.txt >> requirements.txt
|
||||
echo '' >> requirements.txt
|
||||
$$(pwd)/venv-freeze/bin/pip freeze -r <(sed '/^--/d' requirements-app.txt) | sed -n '/The following requirements were added by pip freeze/,$$p' >> requirements.txt
|
||||
rm -rf venv-freeze
|
||||
|
||||
.PHONY: test-requirements
|
||||
test-requirements:
|
||||
@diff requirements-app.txt requirements.txt | grep '<' \
|
||||
&& { echo "requirements.txt doesn't match requirements-app.txt."; \
|
||||
echo "Run 'make freeze-requirements' to update."; exit 1; } \
|
||||
|| { echo "requirements.txt is up to date"; exit 0; }
|
||||
pip install --upgrade pip-tools
|
||||
pip-compile requirements.in
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
||||
Reference in New Issue
Block a user