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

mod docs

# Lint python source code
lint:
    python -m flake8 docput/
    zuban check docput/

# Format python source code and other support files
format: && docs::format
    python -m black docput/
    python -m yaclog format
    {{ just_executable() }} --fmt --unstable

# Test
test:
    python -m pytest --doctest-modules

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
