No longer sort generated requriements.txt file #481
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
I removed the "feature" that sorts the contents of the requirements.txt file before running pip install
Reasoning
This is a long-time coming. This feature which I originally thought was quite novel was also met with a lot of problems after merging from the general public. I added this feature when I added the ability for this plugin to cache the requirements locally to prevent unnecessary re-building of requirements when the requirements.txt file did not change. At the time, I was managing roughly 5 different serverless codebases which uses the same dependencies but their requirements.txt files differed because of some dev/internal/local/nodeploy dependencies. To solve this problem I cleansed and sorted the requirements.txt file. Unfortunately, this inevitably had a LOT of issues because of edge cases I was not aware of when I first implemented it the biggest of which is that pip resolves circular dependencies by having the first package taking priority.
Result
Because of this, and this new knowledge I firmly believe we must preserve the order of the files inside the requirements.txt file, even at the risk of a bit less of a cache-hit.
Related to and/or would have prevented:
#427
#294
#238