# Recursive (=) so it is re-read after `bump` rewrites pyproject.toml,
# instead of being frozen to the pre-bump version at parse time.
VERSION = $(shell uv run python -c "import pathlib, tomllib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")

.PHONY: bump build check pypi test unittest

bump:
	uv version --bump patch

build: bump
	rm -rf dist
	uv build

check:
	uvx twine check dist/pylever_dyn-$(VERSION)*

pypi: build check
	uvx twine upload --repository pypi dist/pylever_dyn-$(VERSION)*

test: build check
	uvx twine upload --repository testpypi dist/pylever_dyn-$(VERSION)*

unittest:
	uv run --with pytest python -m pytest
