Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Preserve order of requirements #59

Merged
merged 2 commits into from
Jan 16, 2017
Merged

Preserve order of requirements #59

merged 2 commits into from
Jan 16, 2017

Conversation

jwg4
Copy link
Contributor

@jwg4 jwg4 commented Dec 16, 2015

The reason for this test is the following. If foo_requirement depends only on test_requirement, and both are explicitly installed from files after being mentioned from the same requirements.txt, then pip will not look for test_requirement when installing foo_requirement - it will be clever enough to realize that it's just been installed. But terrarium will complain that it can't find the dependency.

Note that this behavior of pip depends on the two packages appearing in the right order in the requirements.txt file. Doing things this way might be a misuse of undocumented pip behavior, I have no idea. In any case, it is something which pip users might depend on.

@winhamwr
Copy link
Contributor

Thanks so much for the PR with the failing test case!

A pip requirements file can rely on dependencies being listed in a specific order, if a later item depends on a previous item, and pip doesn't have any other way to find that requirement.
@jwg4
Copy link
Contributor Author

jwg4 commented Jan 1, 2016

I have made a small fix to the test, added a comment, and also made a change which sems to solve this issue. Not sorting the list of requirements in the file means that they are installed in the same order that pip would install them.

@jwg4
Copy link
Contributor Author

jwg4 commented Feb 11, 2016

I have checked with the pip project and they say that one should not depend on the order in which the files are installed. pypa/pip#3480 (comment)

Therefore I will try and set up my requirements.txt so that we are not depending on this behavior, in which case they should also work reasonably with terrarium.

However, I believe that this PR is still valid, including the test case. Pip tries to resolve dependencies if these are given in the metadata of a package, and will install in an order so that these are taken into account. Therefore, one should not rearrange the packages from the order chosen by pip.

@winhamwr
Copy link
Contributor

winhamwr commented Jan 4, 2017

I'm +1 on merging in this PR. We should update the README to make it clear that the order of your requirements affects the hash, though.

@kylegibson kylegibson merged commit b056674 into PolicyStat:master Jan 16, 2017
@kylegibson kylegibson changed the title Add an additional test to check inter-dependencies. Preserve order of requirements Jan 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants