CodeVetter · Repo Unpack · System map
pypa/virtualenv
The runtime is a Python CLI and library organized around a creation session. Discovery, creation, seeding, and activation are selected through installed package metadata. Persistent state lives in app-data folders, while generated environment files live under the chosen destination with a guarded adjacent redirect. Packaging supports wheels, source distributions, and a standalone zipapp.
- The console script targets virtualenv.__main__:run_with_catch; python -m virtualenv reaches the same wrapper, while the package exports cli_run and session_via_cli.
- build_parser discovers the interpreter before constructing CreatorSelector, SeederSelector, and ActivationSelector; Session.run executes create → seed → activate → final configuration write.
- Builtin discovery delegates get_interpreter to python-discovery; local PythonInfo is a compatibility re-export, and python-discovery>=1.6 is a runtime dependency.
- Creator entry points include CPython, PyPy, GraalPy, RustPython, and stdlib venv implementations; CreatorSelector filters them through can_create and aliases the first compatible VirtualenvBuiltin as builtin.
- AppDataDiskFolder separates interpreter JSON, downloaded wheel house, versioned installation images, update logs, and extracted zipapp resources; make_app_data chooses disk, read-only, or temporary storage.
- Seeding integrates distlib script generation, pip download subprocesses, and PyPI JSON metadata; FromAppData installs images directly, whereas PipInvoke runs pip under the created interpreter.
- Hatchling and hatch-vcs build the package and generate version.py; the custom SbomBuildHook conditionally embeds a CycloneDX SBOM, and tox defines interpreter tests, documentation, typing, package checks, and zipapp builds.
- make_zipapp bundles hashed, locked pure-Python wheels and a custom import loader; release CI publishes distributions to PyPI and zipapp/SBOM assets to GitHub, then updates get-virtualenv.