Skip to content

Commit ccd2260

Browse files
committed
src/vcspull/types.py(refactor[typing]): remove typing_extensions dependency
why: keep runtime installs free of typing_extensions while still supporting optional fields. what: - split ConfigDict into required/optional TypedDict mixins instead of relying on NotRequired. - drop the typing_extensions import entirely.
1 parent 128ab20 commit ccd2260

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/vcspull/types.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131

3232
import pathlib
3333
import typing as t
34-
from typing import TypeAlias
35-
36-
from typing_extensions import NotRequired, TypedDict
34+
from typing import TypeAlias, TypedDict
3735

3836
if t.TYPE_CHECKING:
3937
from libvcs._internal.types import StrPath, VCSLiteral
@@ -54,16 +52,25 @@ class RawConfigDict(t.TypedDict):
5452
RawConfig = dict[str, RawConfigDir]
5553

5654

57-
class ConfigDict(TypedDict):
58-
"""Configuration map for vcspull after shorthands and variables resolved."""
55+
class _ConfigDictRequired(TypedDict):
56+
"""Required fields for resolved vcspull configuration entries."""
5957

6058
vcs: VCSLiteral | None
6159
name: str
6260
path: pathlib.Path
6361
url: str
6462
workspace_root: str
65-
remotes: NotRequired[GitSyncRemoteDict | None]
66-
shell_command_after: NotRequired[list[str] | None]
63+
64+
65+
class _ConfigDictOptional(TypedDict, total=False):
66+
"""Optional fields for resolved vcspull configuration entries."""
67+
68+
remotes: GitSyncRemoteDict | None
69+
shell_command_after: list[str] | None
70+
71+
72+
class ConfigDict(_ConfigDictRequired, _ConfigDictOptional):
73+
"""Configuration map for vcspull after shorthands and variables resolved."""
6774

6875

6976
ConfigDir = dict[str, ConfigDict]

0 commit comments

Comments
 (0)