-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 grouping of extras requirements in notpip #2142
Conversation
What exactly is the goal |
Are you saying the requirement names aren’t being identified as the same name |
I suspect your fix belongs in |
Or else in |
Stepping through the changed code it seemed to completely miscategorize the items. As noted in the ticket the |
The filtering based on the I looked around but didn't find a |
I think my refactor will cause another issue. If there's actually a |
Yes. Notpip is a patched and renamed pip. The extras require syntax you mentioned is old and mostly unsupported.
|
There is a reason for the do not touch notices in the patched dir btw. There are going to be downstream consequences of a change to the modified resolver code. The issue in this case is just caused by piptools lowercasing a marker, but I couldn’t really follow what the issue was in the first place |
It's not clear that you understand the issue, but who knows, maybe the change will go elsewhere. 'twisted; platform_system != "Windows"',
'twisted[windows_platform]; platform_system == "Windows"', With those deps the basic expectation is that on Linux the dependency |
Note how the old code results in a single 'extras' grouping But, I'll take some time later and see if I can review the original source of this as well as explore the bug my modification might have. https://repl.it/@altendky/CultivatedSardonicFactor-1 ---- ['chardet', '[:platform_system != "Windows"]', 'twisted', '[:platform_system == "Windows"]', 'twisted[windows_platform]']
old
{
":platform_system != \"Windows\"": [
"twisted",
"[:platform_system == \"Windows\"]",
"twisted[windows_platform]"
]
}
new
{
":platform_system != \"Windows\"": [
"twisted"
],
":platform_system == \"Windows\"": [
"twisted[windows_platform]"
]
} |
For reference, this function doesn't seem to be present upstream, assuming I'm looking in the right place. https://github.com/pypa/pip/blob/master/src/pip/_internal/index.py |
Right this is an issue internally in our modifications to the piptools resolver which first of all doesn’t even respect the uppercased version of platform system, and then either in piptools (which is how we get the dependency graph from a |
I understand the issue. This is one part of the codebase I know pretty well which is why I know this is probably not where we want to make these changes, since I think we can fix this in our own things. |
Do note that this function isn't in the original Pip file. I am not claiming that Pip has a bug, pipenv does. It comes from another patch already in the directory you mentioned. So, I presume that you are correct that Pip handles this scenario properly. pipenv/tasks/vendoring/patches/patched/pip.patch Lines 1365 to 1384 in cbe1516
The data coming into this function seems plausibly formatted so I'm skeptical the issue lies there and the data coming out of this function seems clearly wrong before this patch but looks useful afterwards. The change also resolves the initial symptom and didn't break any tests. Of course, that's not all it takes to make a change proper, but what am I missing? How is the original output of this function that I have shared in the examples superior to the changed output? The potential bug I was concerned about earlier doesn't seem to be one. I was concerned that my implementation wouldn't handle multiple items that belong in the same group. As it turns out, that case is already handled elsewhere such that this code works. Consider the second example below. https://repl.it/@altendky/CultivatedSardonicFactor-2 Another example 'test'-------- ['chardet', '[:platform_system != "Windows"]', 'twisted', '[:platform_system == "Windows"]', 'twisted[windows_platform]']
old
{
":platform_system != \"Windows\"": [
"twisted",
"[:platform_system == \"Windows\"]",
"twisted[windows_platform]"
]
}
new
{
":platform_system != \"Windows\"": [
"twisted"
],
":platform_system == \"Windows\"": [
"twisted[windows_platform]"
]
}
-------- ['chardet', 'requests', '[:platform_system != "Windows"]', 'twisted', 'pytest', '[:platform_system == "Windows"]', 'twisted[windows_platform]']
old
{
":platform_system != \"Windows\"": [
"twisted",
"pytest",
"[:platform_system == \"Windows\"]",
"twisted[windows_platform]"
]
}
new
{
":platform_system != \"Windows\"": [
"twisted",
"pytest"
],
":platform_system == \"Windows\"": [
"twisted[windows_platform]"
]
} Perhaps it would be helpful to have another person look at this and help show me what I'm missing? |
Or, maybe you see the issue and the fix but you want it applied as a bigger improvement? This 'method' doesn't use |
Oh I see. You’re saying this is part of the resolver we already patched? I’m on mobile so not that helpful right now but if this is something we did in the first place I’d be more okay with this. Ultimately I’m just going to want to take a bit of a look at this myself and see if there is a meaningful alternative before I keep saying abstract things. This might be right. |
pipenv/pipenv/patched/notpip/req/req_set.py Line 127 in cc80d39
Looks like a typo as I can't find any other relevant reference to pipenv/pipenv/patched/notpip/index.py Line 173 in cc80d39
There is
And the pipenv/pipenv/vendor/pip9/_vendor/pkg_resources/__init__.py Lines 2772 to 2774 in cc80d39
But back to the typo. It's not just that since assigning to |
Sorry for the suuuuper long delay on this, I'll be able to take a look at it this week with luck. I'm just dreading it because it is legitimately complex |
Ok @altendky I did some testing on this and I think it actually is good to go, sorry for the back and forth and thanks a ton for all your effort tracking this down. You'll be interested to know this fixes a very specific bug parsing extras like the ones formatted in the requests |
Not that I like @classmethod but it is honest here and lets the function be tested directly.
I can't say I carefully designed these tests, but they're something. Since |
No description provided.