commit adbcdcb06aa850df64536777b030a641c672aef0
parent 220b89a088306e533b8d7c917b9b90bc8d8f86c6
Author: Jan Pobrislo <ccx@te2000.cz>
Date: Wed, 25 Jun 2025 02:06:12 +0000
Add README with example usage
Diffstat:
A | README | | | 48 | ++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 48 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -0,0 +1,48 @@
+This is set of make rules to ease maintenance of python projects.
+It's expected to live in "gmake_python_helpers" subdirectory besides your main makefile.
+Add it as git submodule as follows:
+
+% git submodule add https://ccx.te2000.cz/git/gmake_python_helpers ./gmake_python_helpers
+
+--------------------------
+Example makefile contents:
+--------------------------
+
+default: py-requirements venv-dev test
+
+# for use with git submodules, automatically checks out this repo
+gmake_python_helpers/pip-tools.mk gmake_python_helpers/pycodestyle.mk:
+ git submodule update --init gmake_python_helpers
+
+# define which python interpreter to use, defaults to "python3"
+# PYTHON_EXE:=python3.11
+
+include gmake_python_helpers/pip-tools.mk
+
+# -- pip-compile / requirements specification
+
+# create "release" environment from "release-requirements.in" file
+$(eval $(call PIP_COMPILE_RULE,release,release-requirements.in))
+
+# create "dev" environment from both "release-requirements.in" and "dev-requirements.in" files
+$(eval $(call PIP_COMPILE_RULE,dev,release-requirements.in dev-requirements.in))
+
+# -- formatting & linting
+
+# all python files to be formatted and checked
+PY_SRC:=$(wildcard *.py) $(wildcard my_module/*.py)
+
+# use `make pycodestyle` to reformat and lint python source code
+# see pycodestyle.mk for details
+include gmake_python_helpers/pycodestyle.mk
+
+# -- test runner example
+
+PYTEST_ARGS?=-vsx --strict-config --ff
+test: $(venv_dev)/.done
+ '$(venv_dev)/bin/pytest' $(PYTEST_ARGS)
+
+# -- application run example
+
+run: $(venv_release)/.done
+ '$(venv_release)/bin/python' -m my_module.run