Problem
The Bootstrapper class has an inconsistent public interface that forces callers to manage two separate loops: a pre-resolution loop calling resolve_and_add_top_level() and a bootstrap loop calling bootstrap(req, req_type). The caller also manages requirement_ctxvar context and tracks which requirements resolved successfully.
Proposed Change
Merge the two loops into a single public method bootstrap(requirements: list[Requirement]) -> None that handles resolution, graph population, and iterative DFS internally. The caller becomes:
bt.bootstrap(to_build)
exit_code = bt.finalize()
Implementation Notes
- Rename
resolve_and_add_top_level() to _resolve_and_add_top_level() (private)
- Rename
bootstrap(req, req_type) to _bootstrap_one(req, req_type) (private, for internal git-URL path only)
- Add
bootstrap(requirements: list[Requirement]) -> None as the new public entry point
- Update
commands/bootstrap.py to use the new interface
- Update affected tests
Problem
The
Bootstrapperclass has an inconsistent public interface that forces callers to manage two separate loops: a pre-resolution loop callingresolve_and_add_top_level()and a bootstrap loop callingbootstrap(req, req_type). The caller also managesrequirement_ctxvarcontext and tracks which requirements resolved successfully.Proposed Change
Merge the two loops into a single public method
bootstrap(requirements: list[Requirement]) -> Nonethat handles resolution, graph population, and iterative DFS internally. The caller becomes:Implementation Notes
resolve_and_add_top_level()to_resolve_and_add_top_level()(private)bootstrap(req, req_type)to_bootstrap_one(req, req_type)(private, for internal git-URL path only)bootstrap(requirements: list[Requirement]) -> Noneas the new public entry pointcommands/bootstrap.pyto use the new interface