Skip to content

Commit 2ffdfa8

Browse files
committed
pylock: parse package size
1 parent cb865be commit 2ffdfa8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pip/_internal/models/pylock.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def from_dict(cls, d: Dict[str, Any]) -> Self:
254254
class PackageArchive:
255255
url: Optional[str]
256256
path: Optional[str]
257-
# (not supported) size: Optional[int]
257+
size: Optional[int]
258258
# (not supported) upload_time: Optional[datetime]
259259
hashes: Dict[str, str]
260260
subdirectory: Optional[str]
@@ -267,6 +267,7 @@ def from_dict(cls, d: Dict[str, Any]) -> Self:
267267
return cls(
268268
url=_get(d, str, "url"),
269269
path=_get(d, str, "path"),
270+
size=_get(d, int, "size"),
270271
hashes=_get_required(d, dict, "hashes"),
271272
subdirectory=_get(d, str, "subdirectory"),
272273
)
@@ -278,7 +279,7 @@ class PackageSdist:
278279
# (not supported) upload_time: Optional[datetime]
279280
url: Optional[str]
280281
path: Optional[str]
281-
# (not supported) size: Optional[int]
282+
size: Optional[int]
282283
hashes: Dict[str, str]
283284

284285
def __post_init__(self) -> None:
@@ -290,6 +291,7 @@ def from_dict(cls, d: Dict[str, Any]) -> Self:
290291
name=_get_required(d, str, "name"),
291292
url=_get(d, str, "url"),
292293
path=_get(d, str, "path"),
294+
size=_get(d, int, "size"),
293295
hashes=_get_required(d, dict, "hashes"),
294296
)
295297

@@ -300,7 +302,7 @@ class PackageWheel:
300302
# (not supported) upload_time: Optional[datetime]
301303
url: Optional[str]
302304
path: Optional[str]
303-
# (not supported) size: Optional[int]
305+
size: Optional[int]
304306
hashes: Dict[str, str]
305307

306308
def __post_init__(self) -> None:
@@ -312,6 +314,7 @@ def from_dict(cls, d: Dict[str, Any]) -> Self:
312314
name=_get_required(d, str, "name"),
313315
url=_get(d, str, "url"),
314316
path=_get(d, str, "path"),
317+
size=_get(d, int, "size"),
315318
hashes=_get_required(d, dict, "hashes"),
316319
)
317320
return wheel
@@ -396,6 +399,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
396399
package_archive = PackageArchive(
397400
url=download_info.url,
398401
path=None,
402+
size=None,
399403
hashes=download_info.info.hashes,
400404
subdirectory=download_info.subdirectory,
401405
)
@@ -414,6 +418,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
414418
name=link.filename,
415419
url=download_info.url,
416420
path=None,
421+
size=None,
417422
hashes=download_info.info.hashes,
418423
)
419424
]
@@ -422,6 +427,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
422427
name=link.filename,
423428
url=download_info.url,
424429
path=None,
430+
size=None,
425431
hashes=download_info.info.hashes,
426432
)
427433
else:

0 commit comments

Comments
 (0)