From f31e299accc4449a32594e7dba75e7e539d274dc Mon Sep 17 00:00:00 2001 From: James Carr Date: Fri, 30 Jun 2023 11:47:57 -0500 Subject: [PATCH 1/3] chore: Add basic Makefile with default help target Signed-off-by: James Carr --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..2f3ef056 --- /dev/null +++ b/Makefile @@ -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/ From 6cd5989c6175a5853bcab448da1f226570f7d126 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Fri, 14 Jul 2023 19:35:02 -0300 Subject: [PATCH 2/3] chore: add missing coverage dependency Signed-off-by: Federico Bond --- requirements-dev.in | 3 ++- requirements-dev.txt | 39 ++++++--------------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/requirements-dev.in b/requirements-dev.in index 84463ebd..3b2327e2 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -5,4 +5,5 @@ black pip-tools pre-commit flake8 -pytest-mock \ No newline at end of file +pytest-mock +coverage diff --git a/requirements-dev.txt b/requirements-dev.txt index 9a10979d..4f5af3c9 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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 From e32719fd50e946d314f54ff6ea67a2b0ca8be28c Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Fri, 14 Jul 2023 19:55:53 -0300 Subject: [PATCH 3/3] chore: add placeholder test to avoid pytest failure Signed-off-by: Federico Bond --- tests/test_hooks.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/test_hooks.py diff --git a/tests/test_hooks.py b/tests/test_hooks.py new file mode 100644 index 00000000..c20e191d --- /dev/null +++ b/tests/test_hooks.py @@ -0,0 +1,2 @@ +def test_placeholder(): # remove this once we have real tests + pass