Skip to content

refactor(bootstrapper): simplify top-level requirement interface #1211

Description

@dhellmann

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions