CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

pypa/hatch

Scanned commit 7c26ebeaf8 dated 2026-09-20 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/pypa/hatch ↗ · 526 files · 2.9 MB

Hatch | | | | --- | --- | | CI/CD | | | Docs | | | Package | | | Meta | | ----- Hatch is a modern, extensible Python project manager.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (418s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

Hatch is a Python developer CLI for creating projects, managing interpreters and environments, running scripts and quality checks, building distributions, and publishing packages. Its separately packaged Hatchling backend implements standard and editable builds, with shared metadata and pluggy-based extension machinery. At commit 7c26ebeaf8b83f5f0374a2545bb15e36c87db0d0, distinctive capabilities include workspace builds, environment matrices, dependency-source overrides, and pluggable PEP 751 lockfile handling.

System map

The repository ships a project-management frontend and an independently packaged build backend. Hatch coordinates configuration, environments, subprocesses, and publishing, while Hatchling owns distribution construction and packaging metadata. Runtime state resides in configured filesystem locations, and integrations include installers, package indices, keyring, and downloaded Python distributions. Release workflows produce Python packages, standalone executables, installers, and documentation.

Feature catalog

Hatch exposes developer workflows through commands rather than application routes or screens. Its main capabilities cover project generation, environment execution, dependency management, interpreter installation, packaging, and publishing. Quality commands add pytest-based testing, Ruff checks, and Pyrefly type checking. Configuration and diagnostic commands support local operation and troubleshooting.

Data flow

CLI arguments and environment variables first select application configuration, project location, and execution environment. Project metadata and environment settings are evaluated lazily and transformed into installer requirements or shell commands. Filesystem state records configuration, dependency hashes, interpreter installations, and build artifacts. Build helpers exchange JSON across subprocess boundaries, while publishing transforms archive metadata into authenticated HTTP requests.

Behavior traces

The source supports ordered walkthroughs of startup, command execution, environment persistence, artifact builds, and publishing. Conditions such as existing environments, skip-install, backend selection, and already-uploaded artifacts materially change the sequence. Environment execution is driven by a generator that prepares and runs work after the command handler populates its context. These are source traces, not observed execution results.

Testing signals

Tests and CI were inspected, not executed; no passing result or measured coverage is asserted. The inspected suite uses pytest, Click testing helpers, isolated storage, mocks, and capability-dependent integration tests. It exercises environment creation, signals, builds, credentials, and locking, but some tests deliberately replace process or activation boundaries. This inventory is bounded and does not establish exhaustive coverage.

Risk map

The main sensitive boundaries are executable project configuration, plugin loading, credentials, downloads, and filesystem operations beyond the checkout. These findings describe source behavior and review priorities, not confirmed vulnerabilities. Error handling and persistence choices also affect operational reliability. Tests provide useful signals, but mocks and conditional skips limit what their existence proves.

Extension points

The principal extension mechanism is pluggy registration of named classes. Hatch adds environment, collector, publisher, template, and locker registries to Hatchling's build and version registries. Builders expose artifact-version functions and ordered hooks, while environments and lockers expose lifecycle contracts. CLI command lists and dependency-source parser tables provide additional explicit dispatch points.

Contributor handoff

Begin with the two package manifests and hatch.toml, then follow the relevant command through Application and Project before changing a backend or plugin contract. Preserve lazy evaluation, cross-platform filesystem behavior, lifecycle ordering, and backend-specific branches. Tests and CI were inspected, not executed; use their definitions to plan separately authorized validation without treating them as passing evidence. The investigation is bounded, and upstream contribution rules require disclosed AI assistance and informed human review.

Languages

LanguageFilesShare of source
Python39798%
Markdown86docs/config
YAML15docs/config
TOML72%
JSON3docs/config
CSS1docs/config
HTML1docs/config
Shell10%

Start reading here

Probable source entrypoint: pyproject.toml — inferred from the directory tree and manifest, not the upstream docs.

Source roots

src/ (136 files)

Repository structure

Top-level pathFiles
tests/180
src/136
docs/95
backend/76
.github/12
scripts/9
release/5

Docs found: README.mddocs/blog/index.mddocs/blog/posts/release-hatch-1100.mddocs/blog/posts/release-hatch-1160.mddocs/blog/posts/release-hatch-1170.mddocs/blog/posts/release-hatch-1180.mddocs/blog/posts/release-hatch-160.mddocs/blog/posts/release-hatch-180.mddocs/blog/posts/release-hatch-190.mddocs/build.md

Package

pyproject.toml — hatch vsrc/hatch/_version.py, 0 declared dependencies.

CI & config entrypoints

Structural health signals

Average score 7.4/10 across 96 analyzed source files; 12 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history