Last active
February 19, 2021 19:23
-
-
Save marcuscaisey/973205f06c0c4559d33e0b4b420ed7ae to your computer and use it in GitHub Desktop.
Makefile for managing Python requirements.txt with pip-tools (based on https://jamescooke.info/a-successful-pip-tools-workflow-for-managing-python-package-requirements.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
objects = $(wildcard *.in) | |
outputs = $(objects:.in=.txt) | |
sync-targets = $(objects:%.in=sync-%) | |
upgrade-targets = $(objects:%.in=upgrade-%) | |
.PHONY: all check clean $(sync-targets) $(upgrade-targets) | |
all: $(outputs) | |
%.txt: %.in | |
@pip-compile -v --output-file $@ $< | |
dev.txt: main.txt | |
check: | |
@which pip-compile > /dev/null | |
clean: check | |
-@rm *.txt | |
$(sync-targets): sync-%: %.txt | |
@pip-sync $< | |
$(upgrade-targets): upgrade-%: %.in | |
@pip-compile --upgrade $< | |
upgrade-dev: upgrade-main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment