The currently used subprocess.run() was only added in Python 3.5, which means the current implementation could only be added back to pip after pip had dropped Python 2.7 support (and that's unlikely to happen until some point well after CPython drops support in January 2020).
However, this utility doesn't really need the flexibility of subprocess.run, so it can just use the older subprocess.check_call API, and let the exception escape when the call to pip fails.
It would likely also make sense to avoid capturing the subprocess output, and instead let pip write directly to stdout and stderr for the parent process - that way users will get output that more closely resembles the regular pip command line behaviour without the wrapper needing to do any additional work.
The currently used
subprocess.run()
was only added in Python 3.5, which means the current implementation could only be added back topip
afterpip
had dropped Python 2.7 support (and that's unlikely to happen until some point well after CPython drops support in January 2020).However, this utility doesn't really need the flexibility of
subprocess.run
, so it can just use the oldersubprocess.check_call
API, and let the exception escape when the call topip
fails.It would likely also make sense to avoid capturing the subprocess output, and instead let
pip
write directly tostdout
andstderr
for the parent process - that way users will get output that more closely resembles the regular pip command line behaviour without the wrapper needing to do any additional work.