Skip to content

Add dedicated error message for direct filesystem paths in requirements#2369

Merged
charliermarsh merged 1 commit intomainfrom
charlie/p
Mar 11, 2024
Merged

Add dedicated error message for direct filesystem paths in requirements#2369
charliermarsh merged 1 commit intomainfrom
charlie/p

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

This is analogous to #669, but for cases in which the package name is a filesystem path. In such cases, we'll fail when parsing the package name, since it doesn't start with a valid character, as opposed to failing when we go to parse the remaining version specifier.

Inspired by #2356.

};

// Ex) `/bin/ls`
if first_char == '\\' || first_char == '/' || first_char == '.' {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this support pip install path/to/my.whl? I suspect that this is a big fraction of the cases

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, that already works on main, because “path” is parsed as the package name, then we fail on the slash. The case covered in this PR is when there’s no leasing alpha character (like “./path”).

@charliermarsh charliermarsh merged commit ebca319 into main Mar 11, 2024
@charliermarsh charliermarsh deleted the charlie/p branch March 11, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants