.PHONY: clean-pyc clean-build docs help
.DEFAULT_GOAL := help
PYTHON=python3.11

help:
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'


test:	## Run Python tests
	@echo "--> Running Python tests"
	python3.11 -m unittest || exit 1
	@echo ""

install: ## Install package in local python
	@echo "--> Installing package in local python3.11"
	sudo python3.11 setup.py install
	@echo ""

clean:	## Clean pyc and build files
	@echo "--> Cleaning pyc and build files"
	sudo rm -fr build dist .eggs
	sudo find . -name '*.egg-info' -exec rm -fr {} +
	sudo find . -name '*.egg' -exec rm -f {} +

build:  ## Build PyPi package
	@echo "--> Build PyPi package"
	sudo python3.11 -m build
	@echo ""

release: clean ## Package and upload to Compass Pypi Server
	$(PYTHON) -m build
	twine upload --skip-existing dist/* -r compass

.PHONY: install clean build
