Skip to content
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

New Resolver: Add support for direct URLs with extras #8291

Merged
merged 6 commits into from
May 22, 2020

Conversation

pradyunsg
Copy link
Member

Fixes #8289

Waiting on #8276 prior to updating the tests' markers. A quick manual test and local test run confirms that this should fix the issue. :)

@pradyunsg pradyunsg added C: extras Handling optional dependencies type: bugfix labels May 21, 2020
@@ -417,20 +417,16 @@ def iter_dependencies(self):
extra
)

# Add a dependency on the exact base.
yield factory.make_requirement_from_candidate(self.base)
Copy link
Member

Choose a reason for hiding this comment

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

This would clone a pkg>=1.0 without pinning the version if base is not pinned. I think we need to introduce some kind of abstraction to BaseCandidate to handle this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I follow. self.base is a candidate.

Copy link
Member

Choose a reason for hiding this comment

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

I sort of recall there’s a thing that may go wrong with this, but I forgot what that is now :( Maybe it’s no longer a problem with the new find_matches() implementation.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, there is a different problem if constraints are involved. We don’t allow constraints to filter direct requirements, so given the following scenario:

# constraints.txt
foo>=1.0
# requirements.txt
foo[add]==1.0

This will fail with installation from path or url cannot be constrained to a version because we are adding a URL requirement to represent the base.

I’m thinking maybe we should get rid of the check altogether, since constraining a URL requirement by checking the version the URL points to kind of still makes sense? @pfmoore

Copy link
Member

Choose a reason for hiding this comment

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

I think that's probably true. I suspect the limitation was there because the old resolver couldn't cope with that situation.

But if we relax that restriction, we'll get additional test failures, and I think we should start being much stricter about not allowing regressions like that (I've just submitted #8297 which should help a bit here, and the fact that the new markers mean that the test suite now succeeds on the new resolver will help as well) so we'd need to fix those tests at the same time (and not by just adding the "fails with the new resolver" flag 🙂 - maybe an xfail on the new resolver?).

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it’s no longer a problem with the new find_matches() implementation.

I think it was a much bigger problem before we had the new implementation, but maybe not so much now. Let's assume it works for the moment, and then when stuff breaks, we'll have a better idea of where there's still an issue (and we can blame @pradyunsg 🙂)

Copy link
Member Author

Choose a reason for hiding this comment

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

we can blame @pradyunsg

Oh no. 😮

@pradyunsg pradyunsg added the skip news Does not need a NEWS file entry (eg: trivial changes) label May 21, 2020
@pradyunsg pradyunsg marked this pull request as ready for review May 21, 2020 22:21
ireq.link, extras=set(ireq.extras), parent=ireq,
)
return ExplicitRequirement(cand)
return self.make_requirement_from_candidate(candidate)
Copy link
Member

Choose a reason for hiding this comment

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

Not really related, but this might read better if we flip the conditionals (if not ireq.link:)

Copy link
Member

Choose a reason for hiding this comment

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

Didn't I see exactly that change in a different PR I was reviewing a few minutes ago? There may be merge conflicts in our future... But yes, I agree switching the order reads better.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, #8066

Copy link
Member

Choose a reason for hiding this comment

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

Seems like my coding style is fairly consistent 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to make the same change, but resisted the urge in favor of keeping the PR smaller. :)

Having this come in via #8066 works well for me.

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: extras Handling optional dependencies skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip resolver searches for target itself and fails New resolver: Extras on direct install does not work
3 participants