# SPDX-License-Identifier: 0BSD
# SPDX-FileCopyrightText: Copyright 2023 David Seaward and contributors

_default:
    @just --list

# Prepare Python development environment
bootstrap:
    uv sync --all-extras
    uv run prek install --overwrite


# Run from source
run:
    uv run carmine

# Remove all build artefacts
clean:
    rm -rf *.egg-info
    rm -rf .pytest_cache
    rm -rf dist
    rm -rf build
    rm -f .coverage
    find . -name "__pycache__" -type d -exec rm -rf {} +

# Run tests and generate coverage report
test:
    uv run coverage run -m pytest
    uv run coverage report | tee coverage.txt
    @echo
    @git diff --compact-summary --exit-code || (echo "Uncommitted changes." && exit 1)

# Fix or warn about linting errors
lint:
    uv run prek run --all-files

# Clean, test, lint, then generate new build artefacts
build: clean test lint
    uv build --clear
