# Makefile for Session4

# Handy macros
PDOC = pydoctor --make-html --docformat="plaintext" --disable-intersphinx-cache --project-name "Session4" --html-output
# PYCCO needs re-writing!
# PYCCO := pycco --generate_index --paths --skip-bad-files  --directory

# Sync .venv with the locked deps and an editable install (session4)
setup:
	uv sync

# Run from top-level directory. Creates a pytest html report and a coverage report (in htmlcov)
test:
	uv run pytest -s  --html PyTest_Report.html --cov=./ --cov-report html --log-cli-level=DEBUG

# Run the manual session-testing demo
altdemo:
	cd src/session4; uv run python -m quixote run --app modified_quix_demo.altdemo

.PHONY: documentation
documentation:
	uv run $(PDOC) docs/api src/session4
	# uv run $(PYCCO) docs/literate src/session4/*.py src/session4/*.py tests/*.py

# Call 'make clean' to get rid of the documentation directory's html entries
# No directory or file will be called 'clean' so mark it as a phony
.PHONY: clean
clean:
	rm -rf docs/api/*
	rm -rf docs/literate/*
	rm -rf dist/*

build:	clean documentation
	uv build --clear

# NOTE the trailing slash on legacy/...  failure to include will likely give
# a 400 error about 'duplicate key'
# Password will by the api key
publish_to_test:
	uv publish --publish-url https://test.pypi.org/legacy/ --verbose
