.PHONY: install dev test lint fmt typecheck clean reset seed build publish publish-test

PY ?= python

install:
	pip install -e .

dev:
	pip install -e ".[dev]"

test:
	pytest -q

lint:
	ruff check recall tests

fmt:
	ruff format recall tests

typecheck:
	mypy recall

clean:
	rm -rf build dist *.egg-info .pytest_cache .ruff_cache .mypy_cache .coverage htmlcov

build:
	$(PY) -m pip install -q build
	$(PY) -m build

# Upload to TestPyPI first: https://test.pypi.org/project/work-recall/
publish-test: build
	$(PY) -m pip install -q twine
	twine upload --repository testpypi dist/*

# Production PyPI: https://pypi.org/project/work-recall/
# Requires: export TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-...
publish: build
	$(PY) -m pip install -q twine
	@test -n "$$TWINE_USERNAME" || (echo "Set TWINE_USERNAME=__token__" && exit 1)
	@test -n "$$TWINE_PASSWORD" || (echo "Set TWINE_PASSWORD to your PyPI API token" && exit 1)
	twine upload dist/*

reset:
	python scripts/reset_local_db.py

seed:
	python scripts/dev_seed.py
