-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Replace distutils #4796
Description
There's an effort underway to move the functionality of distutils into Setuptools and other libraries, with a goal to remove distutils from the standard library.
Re:
(Though replacing distutils with setuptools wherever possible is worthwhile irrespective of the distutils injection strategy.)
setuptoolswill be the canonical implementation of "distutils" in the future. Some of thedistutilshierarchy already is duplicated insetuptools(like commands), the parts that are likely to remain supported will likely move into thesetuptools(I suspect that will include things like exceptions) namespace, and some stuff that is no longer necessary will be deprecated and removed.If you need something from the
distutilsnamespace and it's not available insetuptools, continue to use it until we provide an alternative (I would say "raise an issue" but I am not sure if we're going to just do a bulk migration or not), but if there's already an equivalent insetuptools, switching over to usingsetuptoolsnow is the best thing you can do (and you should report any issues you encounter when doing this).
...
setuptoolsis not exposing its version ofdistutilsassetuptools.distutils(and to the extent that it exists under thesetuptoolsnamespace, that location is not necessarily stable).setuptoolsreplaces the top-leveldistutilsmodule with its own version ofdistutils, soimport distutilspulls the version fromsetuptools.This is one phase of an ongoing project to remove
distutilsfrom the standard library (and probably eventually retire the project entirely in favor ofsetuptools).
Here's where we're using disutils:
| File | Use | Replacement |
|---|---|---|
Tests/test_image_access.py and setup.py |
from distutils import ccompiler, sysconfig |
#4809, #4814, #4817 |
Tests/test_imagefont.py |
distutils.version.StrictVersion |
packaging.version.parse #4797 |
setup.py |
from distutils.command.build_ext import build_ext |
from setuptools.command.build_ext import build_ext #4829 |
setup.py |
from distutils import cygwinccompiler |
#4890 |