Code reorg utils into utils module reduces complexity #4990
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.
The issue
The pipenv/utils.py has grown to 2338 lines of code, which makes it unwieldy and disorganized. When trying to consider larger bugs and refactors this is problematic because of the logical complexity of navigating around and understanding what kind of util you are looking at. I would like to do something similar with core.py at some point as well, but this is my first iteration of proposing reorg'ing some of the code.
#4992
The fix
Move the existing utils.py code into a utils module organized by functionality type. This is a first pass at it, and I suspect there may be some tweaking to my naming conventions to make everyone happy. The only draw back I see to doing this is loosing some of the git annotations around this code, but ultimately that would happen whenever we get around to organizing the code better and I think good code organization is more important than legacy annotations which would still ultimately be in the git history.
The only modifications to code being moved are the following methods have been dropped due to lack of use:
escape_grouped_arguments
+ unit testsparse_python_version
+ unit testsadd_to_set
sys_version
get_indexes_from_requirement
interrupt_handled_subprocess
rmtree
Also two unused code lines were removed
pipenv/core.py
because I had already run the test suite showing they were not used after my IDE tipped me off about that.The checklist
news/
directory to describe this fix with the extension.bugfix
,.feature
,.behavior
,.doc
..vendor
. or.trivial
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.