Modern, extensible Python project management tool with comprehensive environment and build system support
—
Comprehensive command-line interface providing project management operations including environment management, dependency handling, building, testing, publishing, and Python installation management.
Build project distributions including source distributions (sdist) and wheel distributions with support for custom build hooks and multiple build targets.
# Command: hatch build [options] [targets]
# Options:
# -t, --target TEXT The target to build (default: all)
# -c, --clean Clean artifacts before building
# -x, --ext Only build extension modules
# -h, --help Show help messageCreate, manage, and interact with isolated Python environments for development, testing, and execution. Supports virtual environments, custom environment types, and dependency management.
# Command: hatch env [subcommand] [options]
# Subcommands:
# create [env_name] Create environment
# remove [env_name] Remove environment
# show [env_name] Show environment info
# find [env_name] Find environment path
# run Run command in environment
# prune Remove unused environmentsUsage examples:
# Create default environment
hatch env create
# Create named environment
hatch env create test
# Show environment information
hatch env show test
# Remove environment
hatch env remove test
# Remove all unused environments
hatch env pruneCreate new Python projects from templates or initialize existing directories as hatch projects with proper structure and configuration.
# Command: hatch new [options] [name] [location]
# Options:
# --template TEXT Template to use
# --init Initialize existing directory
# --cli Add CLI support
# --no-readme Skip README creationUsage examples:
# Create new project
hatch new my-project
# Create project with CLI support
hatch new --cli my-cli-tool
# Initialize existing directory
hatch new --initManage project dependencies including installation, updates, synchronization, and dependency resolution with support for development, test, and optional dependencies.
# Command: hatch dep [subcommand] [options]
# Subcommands:
# show Show dependency tree
# hash Generate dependency hash
# freeze Output installed packagesExecute commands and scripts within project environments with proper environment activation, dependency installation, and output capture.
# Command: hatch run [options] [env:]<command>
# Options:
# -e, --env TEXT Environment to use
# --shell-spawn Spawn shell for commandUsage examples:
# Run command in default environment
hatch run python --version
# Run command in specific environment
hatch run test:pytest tests/
# Run script defined in pyproject.toml
hatch run lint:ruff checkExecute project tests with support for multiple test environments, coverage reporting, and test discovery across different Python versions.
# Command: hatch test [options] [pytest_args]
# Options:
# -c, --cover Enable coverage reporting
# -r, --randomize Randomize test order
# -p, --parallel Run tests in parallel
# --matrix-name TEXT Run specific matrix entryFormat project code using configured formatters with support for multiple formatters, custom configuration, and integration with CI/CD pipelines.
# Command: hatch fmt [options] [paths]
# Options:
# --check Check formatting without changes
# --diff Show formatting differences
# --formatter TEXT Specific formatter to usePublish packages to PyPI or custom package indices with authentication, metadata validation, and publishing hooks.
# Command: hatch publish [options] [files]
# Options:
# -r, --repo TEXT Repository to publish to
# -u, --user TEXT Username for authentication
# --skip-existing Skip files that already exist
# --no-prompt Don't prompt for missing fieldsManage Python installations including downloading, installing, and updating Python distributions with support for multiple versions and platforms.
# Command: hatch python [subcommand] [options]
# Subcommands:
# install [version] Install Python version
# remove [version] Remove Python version
# show [version] Show Python info
# find [version] Find Python path
# update [version] Update Python versionUsage examples:
# Install Python 3.11
hatch python install 3.11
# Show available Python versions
hatch python show
# Find Python 3.10 path
hatch python find 3.10
# Update all Python installations
hatch python updateManage project versioning including version bumping, tagging, and integration with version control systems.
# Command: hatch version [options] [rule]
# Options:
# --dry-run Show version without updating
# --scheme TEXT Version scheme to use
# Rules:
# major, minor, patch, dev, alpha, beta, rcManage hatch configuration including user settings, project configuration, and environment variables with support for global and project-specific settings.
# Command: hatch config [subcommand] [options]
# Subcommands:
# show [key] Show configuration value
# set [key] [value] Set configuration value
# find Find config file location
# restore Restore default configurationManage project metadata, configuration, and operations including metadata display, configuration validation, and project introspection.
# Command: hatch project [subcommand] [options]
# Subcommands:
# metadata Show project metadata
# config Show project configurationClean build artifacts and temporary files with support for custom clean patterns and selective cleaning.
# Command: hatch clean [options]
# Options:
# --all Clean all artifacts
# --builds Clean build artifacts only
# --temp Clean temporary files onlyIntegrate with shell environments for enhanced development experience including shell activation, completion, and environment detection.
# Command: hatch shell [options]
# Options:
# --name TEXT Environment name to activate
# --prompt TEXT Custom shell promptDisplay project status including environment information, dependency status, and configuration validation.
# Command: hatch status [options]
# Options:
# --env TEXT Show specific environment status
# --all Show all environment statusManage hatch installation including updates, restoration, and diagnostic reporting for troubleshooting and maintenance.
# Command: hatch self [subcommand] [options]
# Subcommands:
# update Update hatch installation
# restore Restore hatch installation
# report Generate diagnostic reportAll commands support these global options:
# Global options available for all commands:
# -e, --env TEXT Environment name
# -p, --project TEXT Project name
# -v, --verbose Increase verbosity
# -q, --quiet Decrease verbosity
# --color/--no-color Control colored output
# --interactive/--no-interactive Control interactive features
# --data-dir TEXT Custom data directory
# --cache-dir TEXT Custom cache directory
# --config TEXT Custom config fileCommands respect these environment variables:
# Application environment variables
HATCH_ENV='default' # Default environment name
HATCH_ENV_ACTIVE='env_name' # Currently active environment
HATCH_VERBOSE='1' # Verbose output level
HATCH_QUIET='1' # Quiet output level
HATCH_INTERACTIVE='true' # Interactive mode
HATCH_PYTHON='/path/to/python' # Python executable
# Configuration environment variables
HATCH_PROJECT='project_name' # Project name override
HATCH_DATA_DIR='/path/to/data' # Data directory
HATCH_CACHE_DIR='/path/to/cache' # Cache directory
HATCH_CONFIG='/path/to/config' # Configuration file
# Publishing environment variables
HATCH_INDEX_USER='username' # Package index username
HATCH_INDEX_AUTH='token' # Package index authentication
HATCH_INDEX_REPO='https://...' # Package index URLInstall with Tessl CLI
npx tessl i tessl/pypi-hatch