From 0fd7484c203d5f52e19b4732cccbe42787d3791e Mon Sep 17 00:00:00 2001 From: Ciaran Moran Date: Mon, 20 Jan 2025 17:59:30 +0000 Subject: [PATCH] Makefile update for python poetry --- Makefile | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 2373a08..ff5fb3a 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,34 @@ -# -# -# +_targets := setup python-version pyenv-info test cover lint run clean +.PHONY: help $(_targets) +.DEFAULT_GOAL := help -all: - echo No default target - try ve, test, lint, run - false +version-python: ## Echos the version of Python in use + python --version +help: + @echo Targets: $(_targets) + @false -# FIXME: -# - depends on python > 3.6 (bad news for RHEL7 /and/ RHEL8) -# - Add a check for correct version and fail fast +setup: + poetry install -ve: ve/pyvenv.cfg -ve/pyvenv.cfg: requirements.txt - python3 -m venv ve - . ve/bin/activate; pip install -r requirements.txt +python-version: + @which python + @python --version -test: ve - . ve/bin/activate; pytest +pyenv-info: setup + poetry env info -cover: ve - . ve/bin/activate; pytest \ +test: setup + poetry run pytest + +cover: setup + poetry run pytest \ --cov=pyth_observer \ --cov-report=html \ --cov-report=term -lint: lint.python -#lint: lint.yaml - argh, RHEL is too old to do this by default +lint: setup lint.python lint.yaml lint.python: poetry run isort pyth_observer/ @@ -37,8 +39,9 @@ lint.python: lint.yaml: yamllint . -run: ve - . ve/bin/activate; python3 ./observer.py -l debug --network devnet +run: setup + poetry run pyth-observer -l debug --network devnet clean: - rm -rf ve htmlcov + poetry env remove --all + rm -rf htmlcov