################################################################################# # GLOBALS # ################################################################################# PYTHON_VERSION = python3.8 VIRTUALENV := .venv SPACY_MODEL := https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.4.0/en_core_web_trf-3.4.0-py3-none-any.whl ################################################################################# # COMMANDS # ################################################################################# # Set the default location for the virtualenv to be stored # Create the virtualenv by installing the requirements and test requirements $(VIRTUALENV)/.installed: requirements.txt @if [ -d $(VIRTUALENV) ]; then rm -rf $(VIRTUALENV); fi @mkdir -p $(VIRTUALENV) virtualenv --python $(PYTHON_VERSION) $(VIRTUALENV) $(VIRTUALENV)/bin/pip3 install -r requirements.txt $(VIRTUALENV)/bin/pip3 install -r requirements_dev.txt ${VIRTUALENV}/bin/pre-commit install --hook-type pre-push --hook-type post-checkout --hook-type pre-commit touch $@ # Update the requirements to latest. This is required because typically we won't # want to incldue test requirements in the requirements of the application, and # because it makes life much easier when we want to keep our dependencies up to # date. .PHONY: update-requirements-txt update-requirements-txt: unpinned_requirements.txt update-requirements-txt: VIRTUALENV := /tmp/update-requirements-virtualenv update-requirements-txt: @if [ -d $(VIRTUALENV) ]; then rm -rf $(VIRTUALENV); fi @mkdir -p $(VIRTUALENV) virtualenv --python $(PYTHON_VERSION) $(VIRTUALENV) $(VIRTUALENV)/bin/pip3 install --upgrade -r unpinned_requirements.txt echo "# Created by 'make update-requirements-txt'. DO NOT EDIT!" > requirements.txt $(VIRTUALENV)/bin/pip freeze | grep -v pkg_resources==0.0.0 >> requirements.txt echo $(SPACY_MODEL) >> requirements.txt .PHONY: virtualenv virtualenv: $(VIRTUALENV)/.installed