chore: Add basic Makefile with common commands (#9)

* chore: Add basic Makefile with default help target

Signed-off-by: James Carr <james.r.carr@gmail.com>

* chore: add missing coverage dependency

Signed-off-by: Federico Bond <federicobond@gmail.com>

* chore: add placeholder test to avoid pytest failure

Signed-off-by: Federico Bond <federicobond@gmail.com>

---------

Signed-off-by: James Carr <james.r.carr@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Co-authored-by: Federico Bond <federicobond@gmail.com>
This commit is contained in:
James Carr 2023-07-14 18:05:56 -05:00 committed by GitHub
parent e031fa2651
commit 03f48ecdfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 34 deletions

41
Makefile Normal file
View File

@ -0,0 +1,41 @@
VENV_NAME ?= venv
VENV_ACTIVATE = . $(VENV_NAME)/bin/activate
PYTHON = ${VENV_NAME}/bin/python3
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo "Targets:"
@echo " requirements Compiles requirements.in into requirements.txt"
@echo " venv Creates a virtual environment and install dependencies"
@echo " test Run pytest on the tests/ directory"
@echo " lint Check code with flake8 and black"
@echo " format Format code with black"
.PHONY: requirements
requirements: ## Compiles requirements.in into requirements.txt
$(VENV_ACTIVATE); pip install pip-tools
$(VENV_ACTIVATE); pip-compile requirements.in
.PHONY: venv
venv: $(VENV_NAME)/bin/activate ## Creates a virtual environment and install dependencies
$(VENV_NAME)/bin/activate: requirements.txt
test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME)
$(VENV_ACTIVATE); pip install -U pip setuptools
$(VENV_ACTIVATE); pip install -r requirements.txt
touch $(VENV_NAME)/bin/activate
.PHONY: test
test: venv ## Run pytest on the tests/ directory
$(VENV_ACTIVATE); pytest tests/
.PHONY: lint
lint: venv ## Check code with flake8 and black
$(VENV_ACTIVATE); flake8 src/
$(VENV_ACTIVATE); black --check src/
.PHONY: format
format: venv ## Format code with black
$(VENV_ACTIVATE); black src/

View File

@ -5,4 +5,5 @@ black
pip-tools
pre-commit
flake8
pytest-mock
pytest-mock
coverage

View File

@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile requirements-dev.in
#
@ -8,20 +8,16 @@ astroid==2.11.5
# via pylint
attrs==21.4.0
# via pytest
autopep8==1.6.0
# via -r requirements-dev.in
black==22.3.0
# via -r requirements-dev.in
certifi==2021.10.8
# via requests
cfgv==3.3.1
# via pre-commit
charset-normalizer==2.0.12
# via requests
click==8.1.3
# via
# black
# pip-tools
coverage==7.2.7
# via -r requirements-dev.in
dill==0.3.4
# via pylint
distlib==0.3.4
@ -32,8 +28,6 @@ flake8==4.0.1
# via -r requirements-dev.in
identify==2.5.0
# via pre-commit
idna==3.3
# via requests
iniconfig==1.1.1
# via pytest
isort==5.10.1
@ -54,8 +48,6 @@ pathspec==0.9.0
# via black
pep517==0.12.0
# via pip-tools
pep8==1.7.1
# via -r requirements-dev.in
pip-tools==6.6.0
# via -r requirements-dev.in
platformdirs==2.5.2
@ -70,9 +62,7 @@ pre-commit==2.19.0
py==1.11.0
# via pytest
pycodestyle==2.8.0
# via
# autopep8
# flake8
# via flake8
pyflakes==2.4.0
# via flake8
pylint==2.13.8
@ -87,31 +77,14 @@ pytest-mock==3.7.0
# via -r requirements-dev.in
pyyaml==6.0
# via pre-commit
requests==2.27.1
# via responses
responses==0.20.0
# via -r requirements-dev.in
six==1.16.0
# via virtualenv
toml==0.10.2
# via
# autopep8
# pre-commit
# via pre-commit
tomli==2.0.1
# via
# black
# pep517
# pylint
# pytest
typing-extensions==4.2.0
# via
# astroid
# black
# pylint
urllib3==1.26.9
# via
# requests
# responses
virtualenv==20.14.1
# via pre-commit
wheel==0.37.1

2
tests/test_hooks.py Normal file
View File

@ -0,0 +1,2 @@
def test_placeholder(): # remove this once we have real tests
pass