CodeVetter · Repo Unpack · Behavior traces
python-poetry/poetry
The source walks cover startup/project initialization, dependency installation, and add/lock persistence from command input to output. Startup establishes options and plugins before command-event setup injects the environment and installer. Installation branches on lock existence, freshness, and re-resolution before executing operations and optionally installing the root. Persistence follows explicit success and dry-run conditions, with separate refresh and regeneration paths.
- Startup: main → Application().run → _run → _configure_global_options → working-directory context → _load_plugins → Cleo dispatch; project plugin paths are added before application entry points load and activate.
- Project initialization: Application.poetry → Factory.create_poetry → _ensure_valid_poetry_version → BaseFactory.create_poetry → Locker/Config construction → create_pool → optional generic plugin activation.
- Command setup: COMMAND listeners run configure_env → EnvManager.create_venv → command.set_env, then configure_installer_for_event → configure_installer_for_command → Installer → command.set_installer; existing injected objects are retained.
- Install selection: InstallCommand.handle ensures project plugins unless disabled, validates incompatible options, configures extras/groups/dry-run/synchronization, then calls Installer.run; missing locks force update, while stale existing locks raise an error.
- Fresh resolution: Installer._do_install → Solver.solve → Solver._solve → resolve_version → VersionSolver.solve, whose loop propagates incompatibilities and chooses package versions; Solver then aggregates transitive metadata.
- Installation output: Transaction.calculate_operations → Installer._execute → Executor.execute → source-specific _install → WheelInstaller.install; after dependency success, InstallCommand calls EditableBuilder.build unless no-root, non-package mode, or dry-run applies.
- Add persistence: AddCommand.handle reads TOML → determines requirements → Factory.create_dependency → package.add_dependency → Locker.set_pyproject_data → installer update/whitelist/run; dependency success permits lock writing, then successful non-dry add writes pyproject.toml.
- Lock persistence: LockCommand.handle → Installer.lock disables operations → run; an existing non-regenerated lock enters _do_refresh and re-solves directory dependencies, otherwise update resolution writes through _write_lock_file → Locker.set_lock_data → _write_lock_data.