Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix is_url from splitting the scheme incorrectly when using PEP 440's direct references #6203
Fix is_url from splitting the scheme incorrectly when using PEP 440's direct references #6203
Changes from all commits
5b93c09
16af35c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realised this
if
does not work as intended, and probably should be removed. A./whatever
string would’ve been caught in previous checks. This only matters for strings like.whatever
, which I guess still does look like a path…? (but then the docstring is not accurate)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uranusjr that's exactly it. I don't really know why some package would start with
.
, but I'll add a test case for it and add it to the docstring.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packages can’t start with a dot, so this check doesn’t really matter either way :p But it’s better to remove it since its mere existence can be confusing to future readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I have removed it then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uranusjr oops, actually you can use
.
to install a package. You can use it to install the current directory as a package if it has asetup.py
file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have a problem, though: the Windows tests might fail with the
==
since the path separator is different. I'll go withname.startswith
then (I could make separate test cases for Windows, but that doesn't sound so good).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the sep and altsep parts cover the different separators (if my memory of implementation from other projects serves).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understood from the docs, it appears to be only available on Windows (the altsep on Windows would be the forward-slash)
https://docs.python.org/3/library/os.html#os.altsep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct, hence the first test would detect
\
on Windows and/
on POSIX; the second test detects/
on Windows (always false on POSIX).You could add a simple Windows-only test like this, if you’re inclined to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uranusjr I could also skip this test if
not sys.platform.startswith("win")