#!/usr/bin/env just --justfile

mod docs

# Lint python source code
lint:
    pyflakes docput/
    black --quiet --check docput/
    zuban check docput/

# Format python source code and other support files
format: && docs::format
    black --quiet docput/
    mdformat README.md CHANGELOG.md
    {{ just_executable() }} --fmt --unstable

# Run tests
test *args:
    pytest {{ args }}

# Build distribution
build:
    python -m build

pre-commit := f"""
  #!/bin/sh
  PATH={{`dirname "$(which python)"`}}:$PATH just lint test"""

# Install recommended git hooks. Do this after activating your virtual environment
install-hooks:
    echo '{{ pre-commit }}' > .git/hooks/pre-commit
    chmod +x .git/hooks/pre-commit
