Skip to content

Instantly share code, notes, and snippets.

@jonathantito
Forked from Flushot/Makefile
Created March 23, 2022 18:35
Show Gist options
  • Save jonathantito/c381eeef53ffd9651c869eac8e6e2606 to your computer and use it in GitHub Desktop.
Save jonathantito/c381eeef53ffd9651c869eac8e6e2606 to your computer and use it in GitHub Desktop.
Makefile for Python virtualenv and pip dependency manifest. Assumes virtual environment will be created in a 'venv' subdirectory.
.PHONY: init_venv deps freeze clean_venv
all: init_venv deps
PYTHONPATH=venv ; . venv/bin/activate
init_venv:
if [ ! -e "venv/bin/activate_this.py" ] ; then PYTHONPATH=venv ; virtualenv --clear venv ; fi
deps:
PYTHONPATH=venv ; . venv/bin/activate && venv/bin/pip install -U -r requirements.txt && if [ "$(ls requirements)" ] ; then venv/bin/pip install -U -r requirements/* ; fi
freeze:
. venv/bin/activate && venv/bin/pip freeze > requirements.txt
clean_venv:
rm -rf venv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment