Justfile

This project uses Just as a command runner.

The following commands are available:

Commands

$ just --list
Available recipes:
    bootstrap
    coverage *ARGS
    lint
    lock *ARGS
    manage *COMMAND
    mypy *ARGS
    test *ARGS
    testall *ARGS
    copier ...
    docker ...
    docs ...
    project ...

bootstrap

$ just bootstrap
bootstrap:
    uv sync --locked --extra hc --extra psycopg --extra relay

coverage

$ just coverage
coverage *ARGS:
    @just nox coverage {{ ARGS }}

lint

$ just lint
lint:
    @just nox lint

lock

$ just lock
lock *ARGS:
    uv lock {{ ARGS }}

manage

$ just manage
manage *COMMAND:
    #!/usr/bin/env python
    import sys

    try:
        from django.conf import settings
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc

    settings.configure(INSTALLED_APPS=["email_relay"])
    execute_from_command_line(sys.argv + "{{ COMMAND }}".split(" "))

mypy

$ just mypy
mypy *ARGS:
    @just nox mypy {{ ARGS }}

test

$ just test
test *ARGS:
    @just nox test {{ ARGS }}

testall

$ just testall
testall *ARGS:
    @just nox tests {{ ARGS }}

copier::copy

$ just copier::copy
# Create a copier answers file
[no-cd]
copy TEMPLATE_PATH DESTINATION_PATH=".":
    uv run copier copy --trust {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }}

copier::recopy

$ just copier::recopy
# Recopy the project from the original template
[no-cd]
recopy ANSWERS_FILE *ARGS:
    uv run copier recopy --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }}

copier::recopy-all

$ just copier::recopy-all
# Loop through all answers files and recopy the project using copier
[no-cd]
@recopy-all *ARGS:
    for file in `ls .copier/`; do just copier recopy .copier/$file "{{ ARGS }}"; done

copier::update

$ just copier::update
# Update the project using a copier answers file
[no-cd]
update ANSWERS_FILE *ARGS:
    uv run copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }}

copier::update-all

$ just copier::update-all
# Loop through all answers files and update the project using copier
[no-cd]
@update-all *ARGS:
    for file in `ls .copier/`; do just copier update .copier/$file "{{ ARGS }}"; done

docker::build

$ just docker::build
[no-cd]
build:
    docker build --tag docker-email-relay:local .

docker::run

$ just docker::run
[no-cd]
run *ARGS: build
    docker run --rm docker-email-relay:local {{ ARGS }}

docker::smoke

$ just docker::smoke
[no-cd]
smoke:
    @just docker run uv run -m email_relay.service --help

docs::build

$ just docs::build
# Build documentation using Sphinx
[no-cd]
build LOCATION="docs/_build/html": cog
    uv run --group docs sphinx-build docs {{ LOCATION }}

docs::serve

$ just docs::serve
# Serve documentation locally
[no-cd]
serve PORT="8000": cog
    #!/usr/bin/env sh
    HOST="localhost"
    if [ -f "/.dockerenv" ]; then
        HOST="0.0.0.0"
    fi
    uv run --group docs sphinx-autobuild docs docs/_build/html --host "$HOST" --port {{ PORT }}

project::bump

$ just project::bump
[no-cd]
@bump *ARGS:
    {{ justfile_directory() }}/.bin/bump.py version {{ ARGS }}

project::release

$ just project::release
[no-cd]
@release *ARGS:
    {{ justfile_directory() }}/.bin/bump.py release {{ ARGS }}