Skip to content

Comments

pylock: add filename property to PackageSdist and PackageWheel, more validation#1095

Open
sbidoul wants to merge 2 commits intopypa:mainfrom
sbidoul:pylock-validate-wheel
Open

pylock: add filename property to PackageSdist and PackageWheel, more validation#1095
sbidoul wants to merge 2 commits intopypa:mainfrom
sbidoul:pylock-validate-wheel

Conversation

@sbidoul
Copy link
Member

@sbidoul sbidoul commented Feb 21, 2026

To implement Pylock.select we need a way to determine the filename of a PackageWheel from its name or url or path.

So here I add a filename property to PackageWheel and PackageSdist.

I also add validation of these names in from_dict.

elif "\\" in path:
return path.rsplit("\\", 1)[-1]
else:
return path
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here this is an heuristic to determine the name from the path, as the spec does not enforce path separators.

@sbidoul
Copy link
Member Author

sbidoul commented Feb 21, 2026

@brettcannon a few questions for you on the interpretation of PEP 751.

return package_wheel

@property
def filename(self) -> str:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consider renaming this property to wheel_name. See also #1092 (comment).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or not.

- add filename property to PackageSdist and PackageWheel
- validate sdist and wheel filenames
@sbidoul sbidoul force-pushed the pylock-validate-wheel branch from 58728a0 to 27cbf4a Compare February 21, 2026 17:27
@henryiii henryiii requested a review from brettcannon February 23, 2026 17:47
@brettcannon
Copy link
Member

@brettcannon a few questions for you on the interpretation of PEP 751.

I think I answered everything, but in case I didn't just let me know!

@sbidoul
Copy link
Member Author

sbidoul commented Feb 24, 2026

Thanks Brett. So this is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants