Environment (Python)

This guide provides Python-specific environment setup guidance for projects using the Python template toolchain. For shared baseline setup, see the environment guide.

Tooling

  1. Ensure that you have installed either pipx or uv for managing Python tools.

    Note: If installing Pipx via pip, use your system Python rather than a mutable global version managed by Asdf, Mise, or Pyenv. This reduces the risk that subsequent global version changes break pipx.

  2. Ensure that you have installed Copier and Hatch.

    If using Pipx:

    pipx install copier hatch
    

    If using uv:

    uv tool install copier
    uv tool install hatch
    

Git Hooks

Install Git pre-commit and pre-push hooks with the Python development environment:

hatch --env develop run pre-commit install --config .auxiliary/configuration/pre-commit.yaml

Refreshing Environments

Remove and rebuild Hatch virtual environments after dependency or interpreter changes:

hatch env prune

Interpreter

Run Python inside the development environment:

hatch --env develop run python

Shell

Open a shell inside the development environment:

hatch --env develop shell