Justfile

This project uses Just as a command runner.

The following commands are available:

Commands

$ just --list
Available recipes:
    bootstrap
    copier-copy TEMPLATE_PATH DESTINATION_PATH="." # apply a copier template to project
    copier-update ANSWERS_FILE *ARGS               # update the project using a copier answers file
    copier-update-all *ARGS                        # loop through all answers files and update the project using copier
    coverage
    docs-build LOCATION="docs/_build/html"
    docs-install
    docs-serve
    fmt                                            # format justfile
    install
    lint                                           # run pre-commit on all files
    makemigrations *APPS
    mm *APPS                                       # alias for `makemigrations`
    manage *COMMAND
    migrate *ARGS
    pup
    test *ARGS
    testall *ARGS
    types

bootstrap

$ just bootstrap
bootstrap:
    @just pup
    @just install

copier-copy

$ just copier-copy
# apply a copier template to project
copier-copy TEMPLATE_PATH DESTINATION_PATH=".":
    copier copy {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }}

copier-update

$ just copier-update
# update the project using a copier answers file
copier-update ANSWERS_FILE *ARGS:
    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
@copier-update-all *ARGS:
    for file in `ls .copier/`; do just copier-update .copier/$file "{{ ARGS }}"; done

coverage

$ just coverage
coverage:
    python -m nox --session "coverage"

docs-build

$ just docs-build
@docs-build LOCATION="docs/_build/html":
    just _cog
    sphinx-build docs {{ LOCATION }}

docs-install

$ just docs-install
@docs-install:
    @just pup
    python -m uv pip install 'django-opfield[docs] @ .'

docs-serve

$ just docs-serve
@docs-serve:
    #!/usr/bin/env sh
    just _cog
    if [ -f "/.dockerenv" ]; then
        sphinx-autobuild docs docs/_build/html --host "0.0.0.0"
    else
        sphinx-autobuild docs docs/_build/html --host "localhost"
    fi

fmt

$ just fmt
# format justfile
fmt:
    just --fmt --unstable

install

$ just install
install:
    python -m uv pip install --editable '.[dev]'

lint

$ just lint
# run pre-commit on all files
lint:
    python -m nox --session "lint"

makemigrations

$ just makemigrations
makemigrations *APPS:
    @just manage makemigrations {{ APPS }}

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=["django_opfield"])
    execute_from_command_line(sys.argv + "{{ COMMAND }}".split(" "))

migrate

$ just migrate
migrate *ARGS:
    @just manage migrate {{ ARGS }}

pup

$ just pup
pup:
    python -m pip install --upgrade pip uv

test

$ just test
test *ARGS:
    python -m nox --session "test" -- "{{ ARGS }}"

testall

$ just testall
testall *ARGS:
    python -m nox --session "tests" -- "{{ ARGS }}"

types

$ just types
types:
    python -m nox --session "mypy"