Skip to content

Commit 194e854

Browse files
committed
fix(types) Eliminate runtime dependency on ConfigDict
1 parent 361bf39 commit 194e854

4 files changed

Lines changed: 11 additions & 15 deletions

File tree

src/vcspull/cli/_workspaces.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
import fnmatch
66
import pathlib
7+
import typing as t
78

89
from vcspull.config import canonicalize_workspace_path, workspace_root_label
9-
from vcspull.types import ConfigDict
10+
11+
if t.TYPE_CHECKING:
12+
from vcspull.types import ConfigDict
1013

1114

1215
def _normalize_workspace_label(

src/vcspull/cli/sync.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
from vcspull import exc
2626
from vcspull.config import filter_repos, find_config_files, load_configs
27-
from vcspull.types import ConfigDict
2827
from vcspull.util import contract_user_home
2928

3029
from ._colors import Colors, get_color_mode
@@ -48,6 +47,8 @@
4847
from libvcs._internal.types import VCSLiteral
4948
from libvcs.sync.git import GitSync
5049

50+
from vcspull.types import ConfigDict
51+
5152
log = logging.getLogger(__name__)
5253

5354
ProgressCallback = Callable[[str, datetime], None]

src/vcspull/config.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,10 @@ def load_configs(
287287
return repos
288288

289289

290-
ConfigDictTuple = tuple["ConfigDict", "ConfigDict"]
291-
292-
293290
def detect_duplicate_repos(
294291
config1: list[ConfigDict],
295292
config2: list[ConfigDict],
296-
) -> list[ConfigDictTuple]:
293+
) -> list[tuple[ConfigDict, ConfigDict]]:
297294
"""Return duplicate repos dict if repo_dir same and vcs different.
298295
299296
Parameters
@@ -304,13 +301,13 @@ def detect_duplicate_repos(
304301
305302
Returns
306303
-------
307-
list[ConfigDictTuple]
304+
list[tuple[ConfigDict, ConfigDict]]
308305
List of duplicate tuples
309306
"""
310307
if not config1:
311308
return []
312309

313-
dupes: list[ConfigDictTuple] = []
310+
dupes: list[tuple[ConfigDict, ConfigDict]] = []
314311

315312
repo_dirs = {
316313
pathlib.Path(repo["path"]).parent / repo["name"]: repo for repo in config1

tests/cli/test_status.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
check_repo_status,
1717
status_repos,
1818
)
19+
from vcspull.types import ConfigDict
1920

2021
if t.TYPE_CHECKING:
2122
from _pytest.monkeypatch import MonkeyPatch
@@ -561,8 +562,6 @@ async def test_check_repos_status_async_basic(
561562
tmp_path: pathlib.Path,
562563
) -> None:
563564
"""Test basic async concurrent status checking."""
564-
from vcspull.types import ConfigDict
565-
566565
# Create test repos
567566
repo1_path = tmp_path / "repo1"
568567
repo2_path = tmp_path / "repo2"
@@ -573,7 +572,7 @@ async def test_check_repos_status_async_basic(
573572
# repo3 intentionally not created (missing)
574573

575574
repos = t.cast(
576-
list[ConfigDict],
575+
list["ConfigDict"],
577576
[
578577
{"name": "repo1", "path": str(repo1_path)},
579578
{"name": "repo2", "path": str(repo2_path)},
@@ -601,8 +600,6 @@ async def test_check_repos_status_async_with_detailed(
601600
tmp_path: pathlib.Path,
602601
) -> None:
603602
"""Test async status checking with detailed mode."""
604-
from vcspull.types import ConfigDict
605-
606603
repo_path, _remote_path = setup_repo_with_remote(tmp_path)
607604

608605
repos = t.cast(
@@ -630,8 +627,6 @@ async def test_check_repos_status_async_concurrency_limit(
630627
monkeypatch: pytest.MonkeyPatch,
631628
) -> None:
632629
"""Test that semaphore limits concurrent operations."""
633-
from vcspull.types import ConfigDict
634-
635630
# Create multiple repos
636631
repos_list = []
637632
for i in range(10):

0 commit comments

Comments
 (0)