Skip to content

Commit 48627a9

Browse files
committed
pylock: read extras, dependency_groups, default_groups
1 parent 8b227cf commit 48627a9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/pip/_internal/models/pylock.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _toml_dict_factory(data: List[Tuple[str, Any]]) -> Dict[str, Any]:
6969
return {
7070
_toml_key(key): _toml_value(key, value)
7171
for key, value in data
72-
if value is not None
72+
if value is not None and value != []
7373
}
7474

7575

@@ -392,8 +392,9 @@ class Pylock:
392392
lock_version: Version
393393
environments: Optional[List[Marker]]
394394
requires_python: Optional[SpecifierSet]
395-
# (not supported) extras: List[str] = []
396-
# (not supported) dependency_groups: List[str] = []
395+
extras: List[str]
396+
dependency_groups: List[str]
397+
default_groups: List[str]
397398
created_by: str
398399
packages: List[Package]
399400
# (not supported) tool: Optional[Dict[str, Any]]
@@ -419,6 +420,9 @@ def from_dict(cls, d: Dict[str, Any]) -> "Self":
419420
return cls(
420421
lock_version=_get_required_as(d, str, Version, "lock-version"),
421422
environments=_get_list_as(d, str, Marker, "environments"),
423+
extras=_get_list(d, str, "extras") or [],
424+
dependency_groups=_get_list(d, str, "dependency-groups") or [],
425+
default_groups=_get_list(d, str, "default-groups") or [],
422426
created_by=_get_required(d, str, "created-by"),
423427
requires_python=_get_as(d, str, SpecifierSet, "requires-python"),
424428
packages=_get_required_list_of_objects(d, Package, "packages"),

src/pip/_internal/utils/pylock.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def pylock_from_install_requirements(
114114
lock_version=Version("1.0"),
115115
environments=None, # not supported
116116
requires_python=None, # not supported
117+
extras=[], # not supported
118+
dependency_groups=[], # not supported
119+
default_groups=[], # not supported
117120
created_by="pip",
118121
packages=sorted(
119122
(

0 commit comments

Comments
 (0)