cli.build.graph package¶
Module contents¶
Compatibility wrapper.
- This package was migrated from a flat module (graph.py) to a package layout:
graph/__main__.py contains the original implementation.
We re-export the public API so existing imports keep working.
- class cli.build.graph.Any(*args, **kwargs)¶
Bases:
objectSpecial type indicating an unconstrained type.
Any is compatible with every type.
Any assumed to have all methods.
All values assumed to be instances of Any.
Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks.
- class cli.build.graph.RoleDependencyResolver(roles_dir: str)¶
Bases:
object- get_role_dependencies(role_name: str, *, resolve_include_role: bool = True, resolve_import_role: bool = True, resolve_dependencies: bool = True, resolve_run_after: bool = False) Set[str]¶
- resolve_transitively(start_roles: Iterable[str], *, resolve_include_role: bool = True, resolve_import_role: bool = True, resolve_dependencies: bool = True, resolve_run_after: bool = False, max_depth: int | None = None) Set[str]¶
- cli.build.graph.build_mappings(start_role: str, roles_dir: str, max_depth: int) Dict[str, Any]¶
Build all 12 graph variants (6 dep types × 2 directions). Accelerated version:
One-time scan of all metadata
One-time scan of all include_role/import_role
One-time scan of include_tasks/import_tasks
Build reverse-index tables
Then generate all graphs purely from memory
- cli.build.graph.build_single_graph(start_role: str, dep_type: str, direction: str, roles_dir: str, max_depth: int, caches: Dict[str, Any]) Dict[str, Any]¶
Build a graph (nodes + links) for one role, one dep_type, one direction. Uses only precomputed in-memory caches, no filesystem access.
- caches structure:
caches[“meta”][role] -> meta information caches[“deps”][dep_type][role] -> outgoing targets caches[“rev”][dep_type][target] -> set of source roles
- cli.build.graph.find_role_meta(roles_dir: str, role: str) str¶
Return path to meta/main.yml of a role or raise FileNotFoundError.
- cli.build.graph.find_role_tasks(roles_dir: str, role: str) str¶
Return path to tasks/main.yml of a role or raise FileNotFoundError.
- cli.build.graph.load_meta(path: str) Dict[str, Any]¶
Load metadata from meta/main.yml. Returns a dict with:
galaxy_info
run_after
dependencies
- cli.build.graph.load_tasks(path: str, dep_type: str) List[str]¶
Parse include_tasks/import_tasks from tasks/main.yml. Only accepts simple, non-Jinja names.
- cli.build.graph.main()¶