.PHONY: build docs test

BUILD_TYPE ?= dev # set nightly to build nightly release
PYCHECKDIRS := src tests
# run checks on all files for the repo
quality:
	@echo "Running python quality checks";
	black --target-version py310 --check $(PYCHECKDIRS);
	isort --check-only $(PYCHECKDIRS);
	flake8 $(PYCHECKDIRS);

# style the code according to accepted standards for the repo
style:
	@echo "Running python styling";
	black --target-version py310 $(PYCHECKDIRS);
	isort $(PYCHECKDIRS);

# run tests for the repo
test:
	@echo "Running python tests";
	pytest -ra tests;

# creates wheel file
build:
	@echo "Building the wheel for the repository";
	BUILD_TYPE=$(BUILD_TYPE) python3 setup.py sdist bdist_wheel;

# clean package
clean:
	@echo "Cleaning up";
	rm -rf .pytest_cache;
	find $(PYCHECKDIRS) | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf;
