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

Keep second-level requirements for editable reqs after round one #476

Merged
merged 3 commits into from
Mar 29, 2017

Conversation

mattlong
Copy link

This is a straw-man proposal to address #466 based on my comments there.

session=self.session)
dependencies = reqset._prepare_file(self.finder, ireq)
return set(dependencies)
if ireq not in self._dependencies_cache:
Copy link
Author

Choose a reason for hiding this comment

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

It might be better to key this cache off some derived key of ireq rather than using ireq itself, but I was unclear what would be the optimal key to use. Open to suggestions!

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a problem for this right now, but I am not the authority on pip-tools code either.

@davidovich
Copy link
Contributor

I like the relatively simple approach of caching the dependency, and it fixes in an unobtrusive manner the dependencies of an editable.

Can you put up a test case so we can catch this in the future (preferably in a commit of the failing situation and then the commit fix)?

For the test case, you could probably use -e on the fake_package in tests/fixtures.

@davidovich
Copy link
Contributor

@mattlong For your info, I would like to make a 1.8.2 release to fix this regression. The only thing missing is tests. :-)

@davidovich davidovich mentioned this pull request Mar 28, 2017
@mattlong
Copy link
Author

@davidovich Great! Will try to get a test case in today!

@@ -93,16 +93,7 @@ def cli(verbose, dry_run, pre, rebuild, find_links, index_url, extra_index_url,
# Setup
###

# Use pip's parser for pip.conf management and defaults.
Copy link
Author

Choose a reason for hiding this comment

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

Extracted this bit of code into a separate function to facilitate testing

Matt Long added 2 commits March 28, 2017 16:22
Addresses Issue jazzband#446

Besides generally speeding up repetitive requests for secondary
dependencies, this avoids an edge case where getting dependencies for
editable requirements will return an empty list after the first
invocation due to the internals of
pip.req.req_set.RequirementSet._prepare_file. In particular, it marks
InstallRequirements already visited by the method by setting
ireq.parsed = True and short-circuiting on repeated calls with the same
input.
@mattlong
Copy link
Author

@davidovich Added some tests! It wasn't as straightforward as I think either of us thought it might be since tests.conftest.FakeRepository fakes the very function that I would need to be testing: get_dependencies. I'm of course open to any suggestsions you might have; but it should be good to go as is.

@davidovich davidovich merged commit f945f6b into jazzband:master Mar 29, 2017
@davidovich
Copy link
Contributor

@mattlong outstanding! thank you!
fixes #466

@majuscule
Copy link
Contributor

Awesome! Thanks from me also @mattlong, started working on adding the tests myself and was getting very confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants