Skip to content

Instantly share code, notes, and snippets.

@zedr
Last active March 18, 2022 10:44
Show Gist options
  • Save zedr/69d0bade64b96ff53dc66a7c6fa7d48a to your computer and use it in GitHub Desktop.
Save zedr/69d0bade64b96ff53dc66a7c6fa7d48a to your computer and use it in GitHub Desktop.
A make file for Python projects
.PHONY: default clean deps
ENV=.env
_PYTHON=python3
PYTHON_VERSION=$(shell ${_PYTHON} -V | cut -d " " -f 2 | cut -d "." -f1-2)
SITE_PACKAGES=${ENV}/lib/python${PYTHON_VERSION}/site-packages
PYTHON=${ENV}/bin/python3
IN_ENV=source ${ENV}/bin/activate ;
default: deps
${PYTHON}:
@echo "Creating Python ${PYTHON_VERSION} environment..." >&2
@${_PYTHON} -m venv ${ENV}
deps: ${PYTHON}
@echo "Checking for updates to pip..." >&2
@${PYTHON} -m pip install -U pip
@echo "Installing dependencies..." >&2
@${PYTHON} -m pip install -r requirements.txt
clean:
@rm -rf .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment