define HELP_MSG
Makefile for python project
Avaliable commands:
venv - creates python virtual environment
init - create venv and install dependencies from requirements.txt
install - install this package to venv
build - build package and tar it
upload_to_pypi - build and upload to pypi repository
clean - clean all intermediate build files as well as dist tar files
autopep8 - run autopep8 linter and change files
help - prints this message
endef

venv:
	test -d venv || python3.10 -m venv venv

init: venv
	. venv/bin/activate && pip install -r requirements.txt

run: venv
	@echo "This is import only package, can't run"

install: venv init
	. venv/bin/activate && python3.10 -m pip install -e .

build: init
	. venv/bin/activate && python3.10 -m build

upload_to_pypi: build
	. venv/bin/activate && python3.10 -m twine upload --repository pypi dist/*

autopep8: init
	. venv/bin/activate && autopep8 --in-place --exclude "./venv/**" --recursive .

clean:
	rm -rf venv dist *.egg-info
	find -iname "*.pyc" -delete

export HELP_MSG
help:
	@echo "$$HELP_MSG"

.PHONY: init venv install clean run build upload_to_pypi autopep8 help