@@ -412,7 +412,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
412
412
package_archive = PackageArchive (
413
413
url = download_info .url ,
414
414
path = None ,
415
- size = None ,
415
+ size = None , # not supported
416
416
hashes = download_info .info .hashes ,
417
417
subdirectory = download_info .subdirectory ,
418
418
)
@@ -431,7 +431,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
431
431
name = link .filename ,
432
432
url = download_info .url ,
433
433
path = None ,
434
- size = None ,
434
+ size = None , # not supported
435
435
hashes = download_info .info .hashes ,
436
436
)
437
437
]
@@ -440,7 +440,7 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
440
440
name = link .filename ,
441
441
url = download_info .url ,
442
442
path = None ,
443
- size = None ,
443
+ size = None , # not supported
444
444
hashes = download_info .info .hashes ,
445
445
)
446
446
else :
@@ -449,8 +449,8 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
449
449
return cls (
450
450
name = dist .canonical_name ,
451
451
version = package_version ,
452
- marker = None ,
453
- requires_python = None ,
452
+ marker = None , # not supported
453
+ requires_python = None , # not supported
454
454
vcs = package_vcs ,
455
455
directory = package_directory ,
456
456
archive = package_archive ,
@@ -461,13 +461,13 @@ def from_install_requirement(cls, ireq: InstallRequirement, base_dir: Path) -> S
461
461
462
462
@dataclass
463
463
class Pylock :
464
- lock_version : Version = Version ( "1.0" )
465
- environments : Optional [List [Marker ]] = None
466
- requires_python : Optional [SpecifierSet ] = None
464
+ lock_version : Version
465
+ environments : Optional [List [Marker ]]
466
+ requires_python : Optional [SpecifierSet ]
467
467
# (not supported) extras: List[str] = []
468
468
# (not supported) dependency_groups: List[str] = []
469
- created_by : str = "pip"
470
- packages : List [Package ] = dataclasses . field ( default_factory = list )
469
+ created_by : str
470
+ packages : List [Package ]
471
471
# (not supported) tool: Optional[Dict[str, Any]]
472
472
473
473
def __post_init__ (self ) -> None :
@@ -501,11 +501,15 @@ def from_install_requirements(
501
501
cls , install_requirements : Iterable [InstallRequirement ], base_dir : Path
502
502
) -> Self :
503
503
return cls (
504
+ lock_version = Version ("1.0" ),
505
+ environments = None , # not supported
506
+ requires_python = None , # not supported
507
+ created_by = "pip" ,
504
508
packages = sorted (
505
509
(
506
510
Package .from_install_requirement (ireq , base_dir )
507
511
for ireq in install_requirements
508
512
),
509
513
key = lambda p : p .name ,
510
- )
514
+ ),
511
515
)
0 commit comments