Remove distutils dependency from python 3 version of the check#14245
Merged
Conversation
This frees us from depending on distutils on Python 3
iliakur
approved these changes
Mar 27, 2023
iliakur
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the comment explaining why all the song and dance!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Uses
shutil.whichin place ofdistutils.spawn.find_executablefor Python 3 to remove dependency ondistutilsMotivation
AI-2974. We want to get rid of
distutilsbecause its version in the stdlib is essentially deprecated, and the replacement used bysetuptoolsincreases the agent's memory footprint. This is the only place in core integrations that usesdistutilsdirectly.Additional Notes
The reason that
distutilsis still used for Python 2 is thatshutil.whichwas added on Python 3.3. There are less concerns about the use ofdistutilsin Python 2, so missing a simple stand-in, it's fine to keep the statu quo there.I haven't found a good way to add an integration test for this, so I've done a simple manual sanity check on the e2e environment to ensure this is doing what we expect:
Review checklist (to be filled by reviewers)
changelog/andintegration/labels attachedqa/skip-qalabel.