-
Notifications
You must be signed in to change notification settings - Fork 3k
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 pip freeze to use modern format for git repos #9822
Conversation
We will need to figure out first how Git displays port in the scp-like format to come up with a reasonable regex. |
Quoting from here:
So yes, it looks like my regex is a bit naive. It doesn't recognise that the user is optional. I also see that both of these are valid for locally hosting repos:
Although I have no idea if they are ever likely to be used by pip users. |
I’m more concerned about how those different syntaxes would show up in |
From what I can tell, irregardless of whatever it must do internally, > git clone -q ssh://git@github.com/pypa/pip-test-package.git
> git -C pip-test-package/ remote -v
origin ssh://git@github.com/pypa/pip-test-package.git (fetch)
origin ssh://git@github.com/pypa/pip-test-package.git (push)
So as long as we can handle the various input formats I think I've absolutely no idea about ports. Could we maybe just call that bit outside the scope of this PR? If someone needs that feature then they probably know a lot more about it than I do and would be better suited to fixing it than me. |
Oh, awesome!
Yeah, I think that’s reasonable. If people want ports to work they can always use the more obvious |
I've pushed another attempt at the regex (I'll squash the commit later once were happy). It seems to me that, since For example, why isn't:
valid even though:
still works? |
I feel this may be complicating things too much; would it be easier if we just do
|
Yeah actually I think that could work. I had dismissed your point 1 because I thought that the
But this isn't and I assumed it was:
In fact what I say here is total rubbish... |
Ok I've tried as you said. I'm not wildly fond of the using PS: Can you give CI the prod its asking for? |
I’m not yet sure if I like this new “Approve and run” thing, but it’s pretty cool 🙂 |
Good point, I didn’t consider the possibility of the original remote going away (which would make us misidentify a path as scp syntax, which sounds pretty wrong). But yeah, the practical difference is pretty small (if the original remove went away, the freeze file is broken beyond repair anyway), so we can afford to wait until someone actually comes complaining. |
BTW feel free to mark this as ready when you think it is. |
Will do.... once Windows' CI is appeased... |
Actually that CI failure is more interesting than it looks. It boils down to the fact that both:
and:
and even:
are all legal to both git and pip. So really the test is being too fussy in demanding the 1st form, even though git (bizarrely) has opted for the second. Also this looks like an exception to what I said above about Edit: I misunderstood URI's when I wrote this. Whilst it's still true that neither pip nor git care how many slashes you use, the correct syntax for absolute paths on Windows is to use 3 slashes so the |
OK, provided CI doesn't unearth anything else then I deem this ready (although I'd squash the commits unless you feel that the intermediate attempts are of any historical value). |
Perhaps you could have an |
Yay! Even Windows is happy. I'm going to squash commits 3 and 4 together. Do you think commits 1 and 2 are worth keeping or shall I squash the lot into 1 commit? |
I suppose maybe the correct handling would be:
That would handle all cases I can think of but... only if step 2 works. It all boils down to can we trust an SCP regex based on guesswork given that I can't find any formal definition of the syntax anywhere. |
What you have in mind looks good to me. The scp syntax should never be present in a pip environment; it is only there for old environments (populated by old pip versions that played things too loosely), so in the worst case people can convert the environment to use the |
In the event of a case 4 (invalid/deleted repo), what should be the bail out behavior? I'm guessing some kind of |
Actually I see there is already a |
Done it. And I squashed some of the older commits together. I thought I'd have to play ping pong with Window's CI so I enabled CI on my fork so that I wouldn't have to keep prodding you to run it for me. But to my great surprise it actually worked 1st go. Here's the CI run. Run it again here if you want... I think I'm done so if both you and CI are happy then it's ready to merge. |
@uranusjr Anything else you need me to do? |
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.
Sorry for the delay, I wasn’t able to find much time for OSS work the past weekend.
One trick I do often is to send a PR to my own forked repository. GitHub will happily run checks in them. |
And the latest whirl on CI... |
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.
Assuming tests pass
Yippee. Got there eventually... 😛 |
Pip dropped support for
git+ssh@
style requirements (see #7554) in favour ofgit+ssh://
but didn't propagate the change topip freeze
which resultantly returns invalid requirements. Fix this behaviour.Fixes #9625.