PACKAGE_NAME := "sandboxa"
PACKAGE_DIR := "sandboxa"
TEST_DIR := "tests"
CURRENT_VERSION := shell("cat $1", "VERSION")

apply-style:
    hatch run dev:apply-style

lint:
    hatch run dev:lint

test:
    hatch test

build:
    python3 -m build

release part:
    #!/usr/bin/env sh
    if [ "{{part}}" != "patch" ] && [ "{{part}}" != "minor" ] && [ "{{part}}" != "major" ]; then
        echo >&2 "'part' must be patch, minor, or major"
        false
    fi
    just lint
    just test
    # Use bumpversion (in Debian Trixie) or one of its successors.
    if command=$(command -v bump-my-version); then
        "$command" bump "{{part}}"
    elif command=$(command -v bumpversion || command -v bump2version); then
        "$command" "{{part}}"
    else
        echo >&2 "Missing requirement: bumpversion, bump2version or bump-my-version"
        false
    fi
    echo "Hint: see CONTRIBUTING.md for further steps if everything looks good."

publish:
    just build
    twine upload dist/{{ PACKAGE_NAME }}-{{ CURRENT_VERSION }}*
