Skip to content

Commit deb2713

Browse files
committed
lock: do not emit version for direct URLs
It could be dynamic, so not emitting it is a better default. In the future we could consider emitting it when we know it is not dynamic.
1 parent 4072aff commit deb2713

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/pip/_internal/models/pylock.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ def from_install_requirement(cls, ireq: InstallRequirement) -> Self:
8383
dist = ireq.get_dist()
8484
download_info = ireq.download_info
8585
assert download_info
86-
package = cls(
87-
name=dist.canonical_name,
88-
version=str(dist.version),
89-
)
86+
package = cls(name=dist.canonical_name)
9087
package.direct = ireq.is_direct if ireq.is_direct else None
9188
if package.direct:
9289
if isinstance(download_info.info, VcsInfo):
@@ -119,6 +116,7 @@ def from_install_requirement(cls, ireq: InstallRequirement) -> Self:
119116
# should never happen
120117
raise NotImplementedError()
121118
else:
119+
package.version = str(dist.version)
122120
if isinstance(download_info.info, ArchiveInfo):
123121
if not download_info.info.hashes:
124122
raise NotImplementedError()

0 commit comments

Comments
 (0)