default: lint format check test

# Install dependencies
install:
    uv sync

# Run linting checks
lint:
    uv run ruff check src

# Format code
format:
    uv run ruff check --select I --fix src tests data_gen
    uv run ruff format src tests

ty:
    uv run ty check src

# Run type checking
check: format lint ty test

# Run tests
test:
    uv run pytest tests

# Run tests with coverage
test-cov:
    uv run pytest tests --cov=src/tacular --cov-branch --cov-report=term-missing --cov-report=html --cov-report=xml

codecov-tests:
    uv run pytest tests --cov --junitxml=junit.xml -o junit_family=legacy

test-docs:
    uv run pytest --doctest-modules src

# Generate Data Files
gen:
    just --justfile data_gen/justfile gen

update:
    just --justfile data_gen/justfile update

gen-jsons:
    uv run create_output_jsons.py

# Build documentation
docs:
    cd docs && uv run sphinx-build -b html . _build/html

# Run documentation tests
docs-test:
    cd docs && uv run sphinx-build -b doctest . _build/doctest

# Clean documentation build
docs-clean:
    rm -rf docs/_build

# Build and open documentation
docs-open:
    just docs
    python -c "import webbrowser; webbrowser.open('file://{{justfile_directory()}}/docs/_build/html/index.html')"


pre-release: format lint check test gen-jsons docs-test check-version

# --- release (standard tacular-omics recipes; canonical copy in the workspace templates/) ---

# Set the version everywhere and date the [Unreleased] changelog section
set-version version:
    python scripts/release_version.py sync --set {{version}}

# Copy __version__ to CITATION.cff after editing it by hand
sync-version:
    python scripts/release_version.py sync

# Fail if version metadata disagrees
check-version:
    python scripts/release_version.py check