# pypa/pip — codebase unpack

> Canonical page: https://codevetter.com/unpack/pip

This is a deterministic Repo Unpack scan of pypa/pip — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6 (2026-09-23)
- Last upstream commit: Merge pull request #14303 from edgarrmondragon/bump-platformdirs
- Generated by codevetter 1.15.0 on 2026-10-02
- 1000 files scanned · 7.6 MB

Source inspection; upstream code and tests were not executed.

## Languages

- Python: 655 files
- Markdown: 46 files
- TOML: 35 files
- YAML: 15 files
- HTML: 14 files
- JSON: 2 files
- Shell: 2 files
- C: 1 files

## Repository structure

- src/ — 453 files
- tests/ — 364 files
- docs/ — 111 files
- news/ — 20 files
- tools/ — 16 files
- .github/ — 15 files
- build-project/ — 4 files
- .devcontainer/ — 2 files

Probable source entrypoint: `pyproject.toml` (inferred from the tree, not upstream docs)

## Package

- pyproject.toml: pip._vendor — 0 declared dependencies

## Structural health signals

Average score 6.1/10 across 96 files; 77 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- a7002c9771a6 (2026-09-23) Merge pull request #14303 from edgarrmondragon/bump-platformdirs
- f800f64e2f55 (2026-08-13) Upgrade platformdirs to 4.11.12
- 892d13b34a20 (2026-09-21) Merge pull request #14311 from pypa/update-build-project-lock
- fa079e3ba3f1 (2026-09-21) Update build-project/pylock.toml
- 2b28a816d043 (2026-09-08) Merge pull request #14302 from pypa/pre-commit-ci-update-config

## Overview

pip is a Python command-line package installer for developers and automation that resolves dependencies, obtains distributions from indexes, URLs, VCS repositories, and local projects, and installs wheels into Python environments. Its implementation combines vendored dependencies, configurable package discovery, resolvelib dependency resolution, build-backend hooks, and filesystem installation records. This brief describes commit a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6 using bounded source inspection, including CLI startup, package installation, and configuration persistence.

## System map

pip runs as a local CLI process, with additional process boundaries for alternate interpreters, build hooks, and VCS tools. Maintained implementation code lives under _internal, while dependencies are vendored under _vendor. Persistent state is spread across Python installation schemes, configuration files, and caches. Packaging and repository automation are defined separately from runtime command dispatch.
- The root project is named pip, requires Python >=3.10, and exposes pip and pip3 console scripts through pip._internal.cli.main:main; python -m pip delegates to the same function. — [pyproject.toml#L1-L4](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L1-L4) [pyproject.toml#L33-L49](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L33-L49) [src/pip/__main__.py#L21-L24](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/__main__.py#L21-L24)
- commands_dict maps command names to module paths, classes, and summaries; create_command() imports only the selected module, and Command.main() provides the execution context. — [src/pip/_internal/commands/__init__.py#L13-L27](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L13-L27) [src/pip/_internal/commands/__init__.py#L116-L125](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L116-L125) [src/pip/_internal/cli/base_command.py#L173-L189](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/base_command.py#L173-L189)
- The architecture distinguishes maintainer-written _internal code from vendored dependencies; direct use of internals is unsupported. Vendoring configuration specifies a namespace, protected files, patches, and an SBOM. — [docs/html/development/architecture/anatomy.rst#L55-L66](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/docs/html/development/architecture/anatomy.rst#L55-L66) [docs/html/development/architecture/index.rst#L15-L19](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/docs/html/development/architecture/index.rst#L15-L19) [pyproject.toml#L160-L167](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L160-L167)
- RequirementCommand constructs preparers and resolvers, while the resolvelib Resolver combines Factory, PipProvider, and a reporter before producing a RequirementSet and installation order. — [src/pip/_internal/cli/req_command.py#L251-L291](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L251-L291) [src/pip/_internal/resolution/resolvelib/resolver.py#L79-L105](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L79-L105) [src/pip/_internal/resolution/resolvelib/resolver.py#L195-L224](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L195-L224)
- Filesystem state has separate owners: wheel installation writes distribution metadata and RECORD, Cache derives artifact directories, and Configuration writes selected INI files outside the checkout. — [src/pip/_internal/operations/install/wheel.py#L695-L735](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L695-L735) [src/pip/_internal/cache.py#L44-L75](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cache.py#L44-L75) [src/pip/_internal/configuration.py#L69-L85](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L69-L85) [src/pip/_internal/configuration.py#L213-L230](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L213-L230)
- External integration boundaries include requests-based PipSession adapters, VCS subprocess execution, and BuildBackendHookCaller instances configured with source directories and build-environment interpreters. — [src/pip/_internal/network/session.py#L343-L397](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/session.py#L343-L397) [src/pip/_internal/vcs/versioncontrol.py#L635-L649](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/vcs/versioncontrol.py#L635-L649) [src/pip/_internal/req/req_install.py#L492-L504](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_install.py#L492-L504)
- Flit builds the distribution; build-project.py provisions pinned, hashed build requirements and sets SOURCE_DATE_EPOCH. Nox drives tests, while tag-triggered release automation builds artifacts and publishes through PyPI trusted publishing. — [pyproject.toml#L47-L49](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L47-L49) [build-project/build-project.py#L37-L68](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/build-project/build-project.py#L37-L68) [noxfile.py#L124-L175](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/noxfile.py#L124-L175) [.github/workflows/release.yml#L25-L52](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/release.yml#L25-L52)
- Maintenance workflows lock inactive closed threads, validate PR checklist bodies, refresh the build lock through a PR, and synchronize documentation redirects using an environment-provided RTD token. — [.github/workflows/lock-threads.yml#L15-L23](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/lock-threads.yml#L15-L23) [.github/workflows/check-pr-template.yml#L12-L28](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/check-pr-template.yml#L12-L28) [.github/workflows/update-build-project-lock.yml#L33-L64](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/update-build-project-lock.yml#L33-L64) [.github/workflows/update-rtd-redirects.yml#L22-L35](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/update-rtd-redirects.yml#L22-L35)

## Feature catalog

The command registry exposes installation, artifact preparation, environment inspection, configuration, and diagnostic tools. Installation accepts several requirement sources and destination controls, while lock generation and lock-file consumption are explicitly experimental. Commands share parsing and networking infrastructure but have distinct output and mutation boundaries. The catalog below covers all registered commands, grouping related commands into eight substantive entries.
- install accepts index requirements, VCS URLs, directories, archives, requirements files, constraints, editables, dependency groups, and script metadata; destination controls include --target, --user, --root, and --prefix. — [src/pip/_internal/commands/install.py#L143-L225](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L143-L225) [src/pip/_internal/cli/req_command.py#L331-L359](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L331-L359) [src/pip/_internal/cli/req_command.py#L398-L412](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L398-L412)
- download resolves and saves distribution artifacts; wheel resolves requirements, saves existing wheels, builds source requirements, and copies successful builds into the requested wheel directory. — [src/pip/_internal/commands/download.py#L112-L150](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/download.py#L112-L150) [src/pip/_internal/commands/wheel.py#L142-L173](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/wheel.py#L142-L173)
- lock generates experimental pylock TOML to a file or stdout, with validity guaranteed only for the current Python version and platform; requirement ingestion also accepts experimental pylock sources. — [src/pip/_internal/commands/lock.py#L26-L39](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/lock.py#L26-L39) [src/pip/_internal/commands/lock.py#L152-L171](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/lock.py#L152-L171) [src/pip/_internal/cli/req_command.py#L361-L382](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L361-L382)
- uninstall accepts package names or requirements files and supports --yes; its documented exceptions include metadata-less distutils installations and script wrappers created by setup.py develop. — [src/pip/_internal/commands/uninstall.py#L25-L61](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/uninstall.py#L25-L61) [src/pip/_internal/commands/uninstall.py#L64-L105](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/uninstall.py#L64-L105)
- freeze emits requirements-format inventory, list lists installed packages, show displays package information, and check verifies dependency compatibility; inspect emits versioned JSON containing installed metadata, origins, installer information, and environment markers. — [src/pip/_internal/commands/__init__.py#L43-L66](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L43-L66) [src/pip/_internal/commands/inspect.py#L48-L92](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/inspect.py#L48-L92)
- config dispatches list, edit, get, set, unset, and debug actions; cache dispatches dir, info, list, remove, and purge, returning an error when caching is disabled. — [src/pip/_internal/commands/configuration.py#L99-L145](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L99-L145) [src/pip/_internal/commands/cache.py#L52-L85](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/cache.py#L52-L85)
- index versions discovers available versions through PackageFinder and conditionally excludes prereleases; search uses an XML-RPC server's search method and converts XML-RPC faults into CommandError. — [src/pip/_internal/commands/index.py#L65-L87](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/index.py#L65-L87) [src/pip/_internal/commands/index.py#L123-L154](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/index.py#L123-L154) [src/pip/_internal/commands/search.py#L70-L85](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/search.py#L70-L85)
- hash computes archive hashes, debug exposes diagnostic information, and help describes commands; completion emits shell integration for bash, zsh, fish, and PowerShell. Global --python can rerun the selected command under another interpreter. — [src/pip/_internal/commands/__init__.py#L93-L112](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L93-L112) [src/pip/_internal/commands/completion.py#L86-L118](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/completion.py#L86-L118) [src/pip/_internal/commands/completion.py#L122-L131](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/completion.py#L122-L131) [src/pip/_internal/cli/main_parser.py#L83-L107](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main_parser.py#L83-L107)

## Data flow

Inputs become typed installation requirements through shared command infrastructure. Discovery supplies candidates, and resolution uses metadata and constraints to select concrete distributions. Preparation records artifact paths and provenance before installation writes into an environment scheme. Configuration and caches provide independent persistence paths with their own precedence and identity rules.
- ConfigOptionParser loads Configuration before deriving defaults, applies global, command-specific, then environment sections, and validates string defaults through each option's type checker. — [src/pip/_internal/cli/parser.py#L226-L255](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L226-L255) [src/pip/_internal/cli/parser.py#L321-L341](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L321-L341)
- get_requirements() collects constraints, converts CLI strings and editables into InstallRequirement objects, expands dependency groups, and turns parsed requirements-file entries into user-supplied requirements with config settings. — [src/pip/_internal/cli/req_command.py#L319-L359](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L319-L359) [src/pip/_internal/cli/req_command.py#L383-L396](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L383-L396)
- RequirementsFileParser recursively resolves nested -r/-c references relative to URLs or local files and rejects recursion; get_file_content() reads HTTP, HTTPS, file URLs, or bare filesystem paths. — [src/pip/_internal/req/req_file.py#L350-L398](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_file.py#L350-L398) [src/pip/_internal/req/req_file.py#L563-L593](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_file.py#L563-L593)
- PackageFinder.find_all_candidates() combines evaluated local-file candidates with page candidates and caches the result; a known locked link bypasses those sources and fails immediately if link evaluation rejects it. — [src/pip/_internal/index/package_finder.py#L879-L917](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/index/package_finder.py#L879-L917) [src/pip/_internal/index/package_finder.py#L919-L952](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/index/package_finder.py#L919-L952)
- Factory.collect_root_requirements() canonicalizes and intersects matching constraints, tracks user-requested order, and sorts extra-bearing requirements last; Resolver passes these collections into PipProvider and resolvelib. — [src/pip/_internal/resolution/resolvelib/factory.py#L544-L584](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/factory.py#L544-L584) [src/pip/_internal/resolution/resolvelib/resolver.py#L79-L105](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L79-L105)
- Preparation can fetch sidecar metadata and defer full artifacts; full preparation populates local_file_path and DirectUrl provenance, computes a missing source SHA-256, and compares wheel metadata against a previously used sidecar. — [src/pip/_internal/operations/prepare.py#L620-L637](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/prepare.py#L620-L637) [src/pip/_internal/operations/prepare.py#L727-L763](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/prepare.py#L727-L763) [src/pip/_internal/operations/prepare.py#L765-L783](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/prepare.py#L765-L783)
- InstallRequirement.install() derives an installation scheme and forwards the wheel, direct origin, and user-requested flag; wheel installation generates launchers and persists INSTALLER, optional direct_url.json and REQUESTED, and rewritten RECORD rows. — [src/pip/_internal/req/req_install.py#L782-L806](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_install.py#L782-L806) [src/pip/_internal/operations/install/wheel.py#L671-L679](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L671-L679) [src/pip/_internal/operations/install/wheel.py#L695-L735](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L695-L735)
- Wheel-cache identity includes the source URL, available hash, subdirectory, and interpreter name/version; HTTP caching uses SafeFileCache adapters, while Configuration tracks parser mutations and saves them to selected INI paths. — [src/pip/_internal/cache.py#L44-L75](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cache.py#L44-L75) [src/pip/_internal/network/session.py#L373-L388](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/session.py#L373-L388) [src/pip/_internal/configuration.py#L159-L177](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L159-L177) [src/pip/_internal/configuration.py#L213-L230](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L213-L230)

## Behavior traces

Three concrete flows were followed through their implementation: CLI startup, installation, and configuration persistence. Startup creates a command after parsing global options, and the command establishes shared runtime contexts. Installation branches after resolution for reports and dry runs, then prepares, builds, orders, and installs distributions. Configuration mutation selects a file, loads it, changes a parser, saves it, and affects subsequent option parsing.
- Startup: python -m pip removes a leading empty/current-directory sys.path entry, imports cli.main.main(), installs warning logging, invokes autocomplete(), then calls parse_command(). — [src/pip/__main__.py#L4-L24](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/__main__.py#L4-L24) [src/pip/_internal/cli/main.py#L64-L74](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main.py#L64-L74)
- Startup continuation: parse_command() validates the command or exits for help/version; main() sets locale and calls create_command(), then Command.main() enters contexts, parses options, configures logging, and dispatches through _run_wrapper(). — [src/pip/_internal/cli/main_parser.py#L109-L136](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main_parser.py#L109-L136) [src/pip/_internal/cli/main.py#L76-L86](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main.py#L76-L86) [src/pip/_internal/cli/base_command.py#L173-L204](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/base_command.py#L173-L204) [src/pip/_internal/cli/base_command.py#L242-L255](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/base_command.py#L242-L255)
- Install entry: InstallCommand.run() rejects --user with --target, conditionally checks externally managed environments, chooses user-install behavior, and creates the session, target-aware finder, build tracker, and temporary build directory. — [src/pip/_internal/commands/install.py#L372-L409](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L372-L409) [src/pip/_internal/commands/install.py#L403-L446](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L403-L446)
- Install resolution: run() calls get_requirements(), constructs WheelCache, preparer, and resolver, then calls resolve(); Resolver collects roots, creates PipProvider and a reporter, and invokes resolvelib with a 200000-round ceiling. — [src/pip/_internal/commands/install.py#L448-L480](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L448-L480) [src/pip/_internal/resolution/resolvelib/resolver.py#L79-L114](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L79-L114)
- Install branch: after resolution, --report writes InstallationReport JSON to a file or stdout; --dry-run prints the planned packages and returns before prepare_linked_requirements_more(), wheel building, and installation. — [src/pip/_internal/commands/install.py#L482-L507](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L482-L507)
- Install mutation: preparation completes, non-wheel requirements are built, get_installation_order() orders dependencies first, and install_given_reqs() replaces packages individually; each requirement calls install_wheel(), with failed replacement triggering rollback of its previous uninstall. — [src/pip/_internal/commands/install.py#L502-L565](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L502-L565) [src/pip/_internal/resolution/resolvelib/resolver.py#L195-L224](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L195-L224) [src/pip/_internal/req/__init__.py#L73-L103](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/__init__.py#L73-L103) [src/pip/_internal/req/req_install.py#L782-L806](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_install.py#L782-L806)
- Configuration mutation: config set enters ConfigurationCommand.run(), selects one explicit scope or defaults to an existing site file then user scope, loads Configuration, and calls set_name_value() → set_value() → _save_configuration() → save(). — [src/pip/_internal/commands/configuration.py#L109-L174](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L109-L174) [src/pip/_internal/commands/configuration.py#L190-L194](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L190-L194) [src/pip/_internal/commands/configuration.py#L270-L279](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L270-L279) [src/pip/_internal/configuration.py#L159-L177](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L159-L177)
- Configuration persistence continuation: save() ensures the parent directory and writes modified parsers; a later command reloads those files in get_default_values(), applies section precedence, and validates resulting defaults before dispatch. — [src/pip/_internal/configuration.py#L213-L230](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L213-L230) [src/pip/_internal/cli/parser.py#L226-L255](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L226-L255) [src/pip/_internal/cli/parser.py#L321-L341](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L321-L341)

## Testing signals

Tests and CI were inspected, not executed; no passing result or measured coverage is claimed. pytest provides unit and functional suites, with Nox provisioning distributions and test dependencies. Inspected tests assert configuration persistence, authentication parsing, dry-run behavior, dependency ordering, and wheel path containment. Platform matrices, skips, network exceptions, and vendored-code exclusions limit what any individual run can establish.
- The inspected configuration uses pytest with strict xfails, unit/integration/network/VCS markers, and socket restrictions; the test dependency group includes pytest-cov, xdist, rerunfailures, subket, and scripttest. These definitions were not executed. — [pyproject.toml#L51-L69](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L51-L69) [pyproject.toml#L323-L349](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L323-L349)
- tests/conftest.py assigns unit/integration markers, prohibits the subprocess-oriented script fixture in unit tests, skips search tests unless enabled, and permits sockets plus CI retries for network-marked tests. — [tests/conftest.py#L119-L164](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/conftest.py#L119-L164)
- Configuration tests assert ENV/SITE/USER/GLOBAL precedence; the functional modification pipeline invokes config set/get/unset through PipTestEnvironment and checks that a removed key becomes unavailable. — [tests/unit/test_configuration.py#L111-L155](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_configuration.py#L111-L155) [tests/functional/test_configuration.py#L49-L58](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/functional/test_configuration.py#L49-L58)
- Inspected install tests assert dependency-first ordering and verify that --dry-run leaves packages and optional target directories unpopulated, followed by a normal install demonstrating that the same input can install. — [tests/functional/test_install.py#L1834-L1847](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/functional/test_install.py#L1834-L1847) [tests/functional/test_install.py#L2650-L2684](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/functional/test_install.py#L2650-L2684)
- Authentication unit tests parameterize percent-encoded credentials, ordinary credentials, tokens, and credential-free URLs; they assert credential-cache behavior and reset global keyring state after each test. — [tests/unit/test_network_auth.py#L23-L74](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_network_auth.py#L23-L74) [tests/unit/test_network_auth.py#L77-L101](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_network_auth.py#L77-L101)
- Wheel tests exercise escaping console/GUI entry-point names and assert no outside file was written; additional cases cover absolute paths, doubled-slash roots, and a Windows-only different-drive case. — [tests/unit/test_wheel.py#L450-L474](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_wheel.py#L450-L474) [tests/unit/test_wheel.py#L723-L751](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_wheel.py#L723-L751)
- Inspected CI defines Linux/macOS Python 3.10–3.15 and 3.14t jobs, selected Windows versions sharded into three groups, and a zipapp functional job; PR path filters can skip test jobs. Workflow definitions establish intended checks, not their results. — [.github/workflows/ci.yml#L54-L71](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/ci.yml#L54-L71) [.github/workflows/ci.yml#L129-L155](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/ci.yml#L129-L155) [.github/workflows/ci.yml#L211-L227](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/ci.yml#L211-L227) [.github/workflows/ci.yml#L266-L310](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/ci.yml#L266-L310)
- Coverage excludes vendored libraries, and typing configuration ignores vendor errors; Nox typecheck examines source, tests, and tooling. The isolation fixture explicitly records incomplete system-configuration isolation, so inspection does not establish exhaustive coverage or hermetic execution. — [pyproject.toml#L355-L364](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L355-L364) [tests/typing/pyproject.toml#L35-L38](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/typing/pyproject.toml#L35-L38) [noxfile.py#L178-L216](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/noxfile.py#L178-L216) [tests/conftest.py#L278-L288](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/conftest.py#L278-L288)

## Risk map

These are source observations and one explicitly labeled failure hypothesis, not confirmed vulnerabilities. Sensitive boundaries include TLS policy, credential retrieval, subprocess execution, and installation outside the checkout. Existing containment checks and hash checks are meaningful protections, but their scope must be preserved. Build-dependency policy and per-package mutation deserve particular attention because they differ from assumptions users may make about the parent install.
- Trusted-host adapters intentionally call certificate verification with verify=False and may cache those responses; ordinary HTTPS uses the secure adapter. Changes to host matching or adapter mounting affect transport trust and cache contents. — [src/pip/_internal/network/session.py#L284-L303](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/session.py#L284-L303) [src/pip/_internal/network/session.py#L366-L400](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/session.py#L366-L400)
- Authentication retrieves URL/index credentials and netrc data, strips credentials from request URLs, and adds Basic Auth; 401 handling can recover redirected URL credentials, consult keyring, prompt, and resend the request. — [src/pip/_internal/network/auth.py#L355-L408](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/auth.py#L355-L408) [src/pip/_internal/network/auth.py#L460-L473](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/auth.py#L460-L473) [src/pip/_internal/network/auth.py#L499-L559](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/network/auth.py#L499-L559)
- config edit executes a shell command built from --editor, VISUAL, or EDITOR and a quoted configuration filename; the implementation rejects filenames containing a double quote but deliberately retains shell semantics for the editor command. — [src/pip/_internal/commands/configuration.py#L234-L254](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L234-L254) [src/pip/_internal/commands/configuration.py#L281-L289](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L281-L289)
- Wheel installation writes into purelib/platlib and scheme-specific destinations, enforcing archive-path containment and entry-point-name containment before writing files or generating launchers. — [src/pip/_internal/operations/install/wheel.py#L468-L473](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L468-L473) [src/pip/_internal/operations/install/wheel.py#L495-L546](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L495-L546) [src/pip/_internal/operations/install/wheel.py#L403-L438](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L403-L438) [src/pip/_internal/operations/install/wheel.py#L602-L612](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/install/wheel.py#L602-L612)
- Hash-required preparation rejects VCS URLs, existing directories, and unpinned nondirect requirements, and disables metadata-only fetching; cached built wheels are accepted against recorded source hashes rather than wheel hashes. — [src/pip/_internal/operations/prepare.py#L433-L478](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/prepare.py#L433-L478) [src/pip/_internal/operations/prepare.py#L675-L700](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/operations/prepare.py#L675-L700)
- InprocessBuildEnvironmentInstaller hard-codes require_hashes=False and records that build-dependency hash checking is deferred; it also documents imperfect interaction with venv-based build environments. — [src/pip/_internal/build_env/installer.py#L155-L171](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/build_env/installer.py#L155-L171) [src/pip/_internal/build_env/installer.py#L189-L210](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/build_env/installer.py#L189-L210)
- Build metadata invokes configured project backend hooks, and VCS operations execute external commands; call_subprocess() copies the process environment, applies explicit additions/removals, and launches arguments through Popen. — [src/pip/_internal/req/req_install.py#L492-L540](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/req_install.py#L492-L540) [src/pip/_internal/vcs/versioncontrol.py#L635-L649](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/vcs/versioncontrol.py#L635-L649) [src/pip/_internal/utils/subprocess.py#L123-L139](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/utils/subprocess.py#L123-L139)
- Failure hypothesis: an interrupted config save could truncate its INI file, and a later package failure could leave earlier packages changed. Configuration uses direct write mode, while installation rollback is scoped to the current requirement's previous uninstall. (inferred) — [src/pip/_internal/configuration.py#L213-L230](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L213-L230) [src/pip/_internal/req/__init__.py#L73-L103](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/__init__.py#L73-L103)

## Extension points

Most extension points are internal seams for maintainers rather than public plugin contracts. Commands, action maps, option groups, resolver factories, metadata backends, and VCS registries centralize particular choices. Standards-based build hooks provide an external integration boundary. New behavior should enter through the relevant seam while preserving shared parsing, preparation, and installation invariants.
- New built-in commands attach through commands_dict and a Command subclass; the registry controls help ordering, and create_command() supplies name, summary, and shared constructor arguments through lazy import. — [src/pip/_internal/commands/__init__.py#L13-L27](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L13-L27) [src/pip/_internal/commands/__init__.py#L116-L125](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L116-L125)
- Sub-actions attach through handler_map() in configuration, cache, and index commands; each run() validates the action and routes remaining arguments to a callable. — [src/pip/_internal/commands/configuration.py#L99-L145](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L99-L145) [src/pip/_internal/commands/cache.py#L52-L85](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/cache.py#L52-L85) [src/pip/_internal/commands/index.py#L65-L87](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/index.py#L65-L87)
- Command options attach through add_options() and cmdoptions helpers/groups; ConfigOptionParser gives them shared configuration loading, section precedence, and default-value validation. — [src/pip/_internal/commands/install.py#L163-L171](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L163-L171) [src/pip/_internal/commands/lock.py#L82-L94](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/lock.py#L82-L94) [src/pip/_internal/cli/parser.py#L202-L224](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L202-L224) [src/pip/_internal/cli/parser.py#L321-L341](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L321-L341)
- RequirementCommand.make_resolver() selects resolvelib or legacy implementations; PipProvider.find_matches() delegates candidate construction to Factory with constraints, incompatibilities, and installed-candidate preference. — [src/pip/_internal/cli/req_command.py#L251-L307](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L251-L307) [src/pip/_internal/resolution/resolvelib/provider.py#L259-L299](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/provider.py#L259-L299)
- PackageFinder discovery uses a LinkCollector callback plus link evaluation; its locked-link branch provides a dedicated path for exact artifact selection without querying ordinary indexes or find-links sources. — [src/pip/_internal/index/package_finder.py#L892-L917](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/index/package_finder.py#L892-L917) [src/pip/_internal/cli/req_command.py#L370-L381](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L370-L381)
- Metadata implementations conform to Backend's Distribution and Environment types; select_backend() caches the choice, with Python-version rules and _PIP_USE_IMPORTLIB_METADATA overrides below Python 3.14. — [src/pip/_internal/metadata/__init__.py#L30-L60](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/metadata/__init__.py#L30-L60) [src/pip/_internal/metadata/__init__.py#L88-L105](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/metadata/__init__.py#L88-L105)
- Build integration has two seams: BuildEnvironmentInstaller defines dependency installation, while ConfiguredBuildBackendHookCaller forwards wheel, sdist, editable, and dependency hooks using the requirement's config_settings. — [src/pip/_internal/build_env/base.py#L36-L59](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/build_env/base.py#L36-L59) [src/pip/_internal/utils/misc.py#L711-L724](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/utils/misc.py#L711-L724) [src/pip/_internal/utils/misc.py#L744-L789](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/utils/misc.py#L744-L789)
- VcsSupport.register() instantiates backend classes by name, exposes their schemes and directory markers, and supports unregistering; VersionControl.get_repository_root() is intended for backend-specific detection overrides. — [src/pip/_internal/vcs/versioncontrol.py#L180-L205](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/vcs/versioncontrol.py#L180-L205) [src/pip/_internal/vcs/versioncontrol.py#L681-L694](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/vcs/versioncontrol.py#L681-L694)

## Contributor handoff

Tests and CI were inspected, not executed, and this handoff makes no passing-result claim. Begin edits by reading the command and shared infrastructure that own the requested behavior. Use existing Nox sessions only when execution is authorized, selecting unit checks before relevant functional checks. Preserve interpreter compatibility, installation records, configuration precedence, and vendoring boundaries; historical architecture prose needs verification against source.
- For dispatch changes, read __main__.py, cli/main.py, main_parser.py, and commands/__init__.py first; public console scripts and module invocation converge on this path, while direct in-process main() use is explicitly discouraged. — [src/pip/__main__.py#L21-L24](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/__main__.py#L21-L24) [src/pip/_internal/cli/main.py#L14-L38](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main.py#L14-L38) [src/pip/_internal/cli/main.py#L64-L86](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/main.py#L64-L86) [src/pip/_internal/commands/__init__.py#L116-L125](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/__init__.py#L116-L125)
- For install changes, inspect InstallCommand.run(), RequirementCommand.make_resolver(), Resolver.resolve(), and install_given_reqs(); reporting, dry runs, preparation completion, building, and environment mutation occur at distinct stages. — [src/pip/_internal/commands/install.py#L448-L565](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/install.py#L448-L565) [src/pip/_internal/cli/req_command.py#L251-L307](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/req_command.py#L251-L307) [src/pip/_internal/resolution/resolvelib/resolver.py#L79-L114](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/resolution/resolvelib/resolver.py#L79-L114) [src/pip/_internal/req/__init__.py#L73-L103](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/req/__init__.py#L73-L103)
- For configuration edits, read the action command, Configuration, and ConfigOptionParser together; explicit scope selection, site/user defaults, PIP_CONFIG_FILE behavior, and command-section precedence are separate mechanisms. — [src/pip/_internal/commands/configuration.py#L147-L174](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/commands/configuration.py#L147-L174) [src/pip/_internal/configuration.py#L339-L369](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/configuration.py#L339-L369) [src/pip/_internal/cli/parser.py#L226-L255](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L226-L255)
- Keep Python minimum changes synchronized between pyproject.toml and __pip-runner__.py; the runner's compatibility check must remain parseable by Python 2 so unsupported interpreters receive the intended error. — [pyproject.toml#L33-L35](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L33-L35) [src/pip/__pip-runner__.py#L7-L27](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/__pip-runner__.py#L7-L27)
- Treat _vendor updates as vendoring work: its configuration names vendor.txt, patches, protected files, and the SBOM. Formatting hooks exclude the vendor tree, and user-facing changes have configured Towncrier fragment categories. — [pyproject.toml#L132-L167](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/pyproject.toml#L132-L167) [.pre-commit-config.yaml#L1-L2](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.pre-commit-config.yaml#L1-L2) [.pre-commit-config.yaml#L76-L83](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.pre-commit-config.yaml#L76-L83)
- When execution is authorized, use existing targeted sessions such as nox -s test-3.10 -- tests/unit/test_wheel.py or tests/functional/test_configuration.py; Nox provisions an sdist and dependencies before pytest. Those sessions and CI were inspected, not executed here. — [noxfile.py#L124-L175](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/noxfile.py#L124-L175) [tests/unit/test_wheel.py#L450-L474](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/unit/test_wheel.py#L450-L474) [tests/functional/test_configuration.py#L49-L58](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/functional/test_configuration.py#L49-L58) [.github/workflows/ci.yml#L189-L200](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.github/workflows/ci.yml#L189-L200)
- Use the stricter Nox typecheck session and repository formatting checks for relevant changes; its typing config excludes fixture data and ignores vendor errors. Unit tests cannot use the functional script fixture, and network-marked tests receive special socket/retry handling. — [noxfile.py#L178-L216](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/noxfile.py#L178-L216) [tests/typing/pyproject.toml#L18-L21](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/typing/pyproject.toml#L18-L21) [.pre-commit-config.yaml#L19-L40](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/.pre-commit-config.yaml#L19-L40) [tests/conftest.py#L124-L161](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/tests/conftest.py#L124-L161)
- Verify architecture prose against current code: anatomy describes argparse and a build_env.py module, while the implementation uses optparse-based ConfigOptionParser and build_env package interfaces. The architecture index itself says documentation is incomplete. — [docs/html/development/architecture/anatomy.rst#L68-L73](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/docs/html/development/architecture/anatomy.rst#L68-L73) [docs/html/development/architecture/index.rst#L7-L13](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/docs/html/development/architecture/index.rst#L7-L13) [src/pip/_internal/cli/parser.py#L180-L217](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/cli/parser.py#L180-L217) [src/pip/_internal/build_env/base.py#L36-L59](https://github.com/pypa/pip/blob/a7002c9771a6c3f0317a4e6b9fbdcd22e643f7b6/src/pip/_internal/build_env/base.py#L36-L59)

Source repository: https://github.com/pypa/pip
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/pip.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
