Created
March 14, 2023 03:04
-
-
Save cmcconomy/9bca20856a6a48704555bc8dcf169ba7 to your computer and use it in GitHub Desktop.
Makefile for pinning python requirements
This file contains hidden or 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
| # DOCUMENTATION NOTE: Regular comments don't print in 'help'; two #'s do. | |
| ## +------------------------------------------------------------------------------ | |
| ## | This Makefile contains targets for various python build / deploy steps. | |
| ## | | |
| ## | Key Targets to know: | |
| ## | make / make help: Display Help | |
| help: | |
| @sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST) | |
| pip_framework_setup: | |
| pip install --upgrade pip-tools pip setuptools | |
| install_local: pip_framework_setup | |
| pip install --require-hashes --upgrade -r requirements/main.txt | |
| ## | make install: Install frozen dependencies into local pip modules | |
| install: install_local | |
| update_all_deps: check_pat pip_framework_setup | |
| pip-compile --upgrade --allow-unsafe --generate-hashes --no-emit-index-url --output-file requirements/main.txt requirements/main.in | |
| ## | make update: Update frozen requirements from input specs, and install | |
| ## | into local pip modules (Only used if you have updated your input req | |
| update: update_all_deps install | |
| .PHONY: help pip_framework_setup install_local install update_all_deps update |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requires you to create a file called
./requirements/main.inwhich contains all your direct requirements.Running
make updatewill pin newest requirements according to your spec;make installwill (re)-install existing spec requirements.