-
Notifications
You must be signed in to change notification settings - Fork 91
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
Overeager pip normalization #206
Conversation
internal/backends/python/python.go
Outdated
@@ -368,6 +368,12 @@ func makePythonPipBackend(python string) api.LanguageBackend { | |||
span, ctx := tracer.StartSpanFromContext(ctx, "pip install") | |||
defer span.Finish() | |||
|
|||
normalizedPkgs := make(map[api.PkgName]api.PkgName) | |||
for name := range pkgs { | |||
// Deleting this denormalizes the output of upm list, fixing Workspace bug, but breaks upm add --lang pip |
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.
fixing Workspace bug
Can we reference or describe the bug so this isn't scary to change later?
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 think that was a WIP comment, it doesn't read well. I'll fix it up, thanks
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.
Fleshed that out a bit. The underlying issue was Workspace was attempting to install discord.py
, which we were normalizing and returning as discord-py
, which would then (rightfully) confuse the workspace.
Hopefully the comment makes more sense.
python wtf moment |
pip freeze output is actually pip's internal canonicalized form, which can be different from the normalized package name format. Example: `discord.py` gets normalized into `discord-py`, but `pip show discord-py` still outputs `Name: discord.py`.
Names in requirements.txt are the package as tracked in package metadata, not necessarily the normalized name of the package. Example: pip install discord-py will add `discord.py` to the output of `pip freeze`.
4ed1ffd
to
8e129bc
Compare
Unfortunately, even normalization rules are not the end of the story when it comes to
pip freeze
!pip install discord-py
will still result inpip freeze | grep discord
==discord.py
, since that's the name tracked in the metadata.Exciting!