Skip to content

Commit 33e5712

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 8141fd1 commit 33e5712

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
@@ -84,10 +84,7 @@ def from_install_requirement(cls, ireq: InstallRequirement) -> Self:
8484
dist = ireq.get_dist()
8585
download_info = ireq.download_info
8686
assert download_info
87-
package = cls(
88-
name=dist.canonical_name,
89-
version=str(dist.version),
90-
)
87+
package = cls(name=dist.canonical_name)
9188
package.direct = ireq.is_direct if ireq.is_direct else None
9289
if package.direct:
9390
if isinstance(download_info.info, VcsInfo):
@@ -120,6 +117,7 @@ def from_install_requirement(cls, ireq: InstallRequirement) -> Self:
120117
# should never happen
121118
raise NotImplementedError()
122119
else:
120+
package.version = str(dist.version)
123121
if isinstance(download_info.info, ArchiveInfo):
124122
if not download_info.info.hashes:
125123
raise NotImplementedError()

0 commit comments

Comments
 (0)