Format all dependency information for a module. Args: name: Module name cpython_prefix: CPython directory prefix lib_prefix: Local Lib directory prefix max_depth: Maximum recursion depth _visited: Shared visited set for deduplication across modules R
(
name: str,
cpython_prefix: str,
lib_prefix: str,
max_depth: int = 10,
_visited: set[str] | None = None,
)
| 169 | |
| 170 | |
| 171 | def format_deps( |
| 172 | name: str, |
| 173 | cpython_prefix: str, |
| 174 | lib_prefix: str, |
| 175 | max_depth: int = 10, |
| 176 | _visited: set[str] | None = None, |
| 177 | ) -> list[str]: |
| 178 | """Format all dependency information for a module. |
| 179 | |
| 180 | Args: |
| 181 | name: Module name |
| 182 | cpython_prefix: CPython directory prefix |
| 183 | lib_prefix: Local Lib directory prefix |
| 184 | max_depth: Maximum recursion depth |
| 185 | _visited: Shared visited set for deduplication across modules |
| 186 | |
| 187 | Returns: |
| 188 | List of formatted lines |
| 189 | """ |
| 190 | from update_lib.deps import ( |
| 191 | DEPENDENCIES, |
| 192 | count_test_todos, |
| 193 | find_dependent_tests_tree, |
| 194 | get_lib_paths, |
| 195 | get_test_paths, |
| 196 | is_path_synced, |
| 197 | is_test_up_to_date, |
| 198 | resolve_hard_dep_parent, |
| 199 | ) |
| 200 | |
| 201 | if _visited is None: |
| 202 | _visited = set() |
| 203 | |
| 204 | lines = [] |
| 205 | |
| 206 | # Resolve test_ prefix to module (e.g., test_pydoc -> pydoc) |
| 207 | if name.startswith("test_"): |
| 208 | module_name = name[5:] # strip "test_" |
| 209 | lines.append(f"(redirecting {name} -> {module_name})") |
| 210 | name = module_name |
| 211 | |
| 212 | # Resolve hard_dep to parent module (e.g., pydoc_data -> pydoc) |
| 213 | parent = resolve_hard_dep_parent(name, cpython_prefix) |
| 214 | if parent: |
| 215 | lines.append(f"(redirecting {name} -> {parent})") |
| 216 | name = parent |
| 217 | |
| 218 | # lib paths (only show existing) |
| 219 | lib_paths = get_lib_paths(name, cpython_prefix) |
| 220 | existing_lib_paths = [p for p in lib_paths if p.exists()] |
| 221 | for p in existing_lib_paths: |
| 222 | synced = is_path_synced(p, cpython_prefix, lib_prefix) |
| 223 | marker = "[x]" if synced else "[ ]" |
| 224 | lines.append(f"{marker} lib: {p}") |
| 225 | |
| 226 | # test paths (only show existing) |
| 227 | test_paths = get_test_paths(name, cpython_prefix) |
| 228 | existing_test_paths = [p for p in test_paths if p.exists()] |
no test coverage detected