CodeVetter · Repo Unpack · Extension points
pypa/virtualenv
Installed Python entry points form the principal extension mechanism. Each stage has a selection adapter and an implementation interface, with interpreter capabilities constraining applicable choices. Creation can extend filesystem references and layouts, while seeding can replace installation strategy. Activators pair shell-specific classes with templates, and storage/build hooks provide additional internal seams.
- Plugins register under virtualenv.discovery, virtualenv.create, virtualenv.seed, or virtualenv.activate; installed metadata supplies CLI choices, and built-in entry-point values win duplicate names.
- Discovery plugins implement Discover.run and add_parser_arguments, consume VirtualEnvOptions, and expose a lazily cached interpreter; get_discover installs their CLI options before construction.
- Creator plugins provide can_create metadata, add_parser_arguments, and create; CreatorSelector rejects the reserved builtin registration name, reports capability errors, and passes selected metadata into construction.
- Builtin creator families extend sources, setup_meta, and _executables; PathRefToDest maps host resources to destinations, while ExePathRefToDest handles executable aliases and copy/link differences.
- Describe supplies interpreter-derived layout properties and can_describe; non-Describe creators receive a compatible describer, and Venv delegates noncallable layout attributes to it.
- SeederSelector constructs selected seeders and checks cannot_seed only when enabled; BaseEmbed exposes distribution_to_versions, and FromAppData selects CopyPipInstall or SymlinkPipInstall strategies.
- Activator extensions participate through supports, add_parser_arguments, and generation; ViaTemplateActivator offers templates, quote, replacements, substitutions, and as_name overrides, illustrated by BashActivator's activate.sh → activate mapping.
- Internal factory seams include make_app_data's disk/read-only/temporary selection and the Hatch custom build hook; ReadOnlyAppData disables updates and overrides cache writes, while SbomBuildHook appends generated SBOM files only for supported wheel builds.