Skip to content

Instantly share code, notes, and snippets.

@sebmartin
Created August 23, 2019 13:43
Show Gist options
  • Save sebmartin/0b17cc1d085b2ae77b12dd7499b7f13f to your computer and use it in GitHub Desktop.
Save sebmartin/0b17cc1d085b2ae77b12dd7499b7f13f to your computer and use it in GitHub Desktop.
Python project Makefile
VENV=.venv
PYVERSION=3.6.5
${VENV}:
@which pyenv > /dev/null 2>&1 || (echo "Install pyenv (e.g. brew install pyenv)" && exit 1)
pyenv local ${PYVERSION} || pyenv install ${PYVERSION} && pyenv local ${PYVERSION}
virtualenv --version || pip install virtualenv
virtualenv ${VENV}
${VENV}/bin/activate: ${VENV} requirements.txt
. ${VENV}/bin/activate; pip install -r requirements.txt
touch ${VENV}/bin/activate
test: ${VENV}
. ${VENV}/bin/activate; py.test -vv tests
clean:
find . -name __pycache__ | xargs rm -rf
find . -name "*.pyc" | xargs rm -f
clean-env: clean
rm -rf ${VENV}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment