PYTHON ?= python3
PYTEST ?= $(PYTHON) -m pytest

USERNAME = __token__
PASSWORD = pypi-AgEIcHlwaS5vcmcCJGQ2Zjc0OGQ0LTU5MTgtNDMzYy1iYjhiLWFiMjc5YjdjMzI5YQACKlszLCJkNjY5NTBlYS1kYWFkLTRhMGQtYjVkNC1iZWRiMTQxNjZjNjEiXQAABiDfWbhpK3-u1L1LknuuOvig0tJg1KaQrbWRa2fSf25w1g
TEST_PASSWORD = pypi-AgENdGVzdC5weXBpLm9yZwIkZDEzZmZlYjItZTZhYi00YzZlLWIxYzQtZTM1MTYzYjYyNzA5AAIqWzMsImM1NWQ5MGM0LTE0ZjAtNGIzNi1hZTZiLTg3MWZiN2NhN2YwYSJdAAAGIEOdmWShsj2TqEUpyzUs2_QHY91BFNLIMoieNX78nK75

.PHONY: setup lint typecheck test unit integration adversarial docker-build docker-test clean build publish publish-test

setup:
	$(PYTHON) -m pip install -e ".[dev]"

lint:
	$(PYTHON) -m ruff check .

typecheck:
	$(PYTHON) -m mypy sandy

test:
	$(PYTEST) -v --tb=short

unit:
	$(PYTEST) -v --tb=short -m "not integration and not adversarial"

integration:
	$(PYTEST) -v --tb=short -m integration

adversarial:
	$(PYTEST) -v --tb=short -m adversarial

docker-build:
	docker build -t sandy-test .

docker-test:
	docker run --rm --privileged --cgroupns=private sandy-test

clean:
	rm -rf build/*
	rm -rf dist/*
	rm -rf src/*.egg-info

build: clean
	uv build

publish: build
	uv publish --username $(USERNAME) --password $(PASSWORD)

publish-test: build
	uv publish \
	  --publish-url https://test.pypi.org/legacy/ \
	  --token $(TEST_PASSWORD)
