.PHONY: all build install typing lint test

all: format build install typing lint test


format:
	black -l 99 nagini tests
	isort -rc --atomic .

build:
	python3 -m pip install -r requirements.txt

benchmark:
	pytest -v -s -m benchmark tests

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
	rm -rf reference/
	rm -fr build/
	rm -fr dist/
	rm -fr .eggs/
	find . -name '*.egg-info' -exec rm -fr {} +
	find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +
	find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
	rm -fr .tox/
	rm -f .coverage
	rm -fr htmlcov/
	rm -fr .pytest_cache
	find . -name '.ipynb_checkpoints' -exec rm -fr {} +

install:
	python3 -m pip install -e .

typing:
	pytest -v -s --mypy nagini

lint:
	flake8 -v --statistics --count nagini tests
	isort --check -rc --diff nagini tests
	black -l 99 --diff --check nagini tests

test:
	pytest -v -s --cov=nagini tests

test_examples:
	python3 scripts/run_notebooks.py --cell-timeout 120 --ignore-pattern "[wW][iI][pP]_.*\.ipynb" tutorials_unpublished
	python3 scripts/run_notebooks.py --cell-timeout 600 --nb-timeout 1200 --ignore-pattern "[wW][iI][pP]_.*\.ipynb" tutorials_published

test_china_examples:
	python3 scripts/run_notebooks.py --cell-timeout 600 --nb-timeout 1200 --ignore-pattern "[wW][iI][pP]_.*\.ipynb" tutorials_china
