AnandInguva commented on code in PR #21968: URL: https://github.com/apache/beam/pull/21968#discussion_r905462760
########## sdks/python/setup.py: ########## @@ -30,9 +28,15 @@ from pkg_resources import DistributionNotFound from pkg_resources import get_distribution from pkg_resources import normalize_path +from pkg_resources import parse_version from pkg_resources import to_filename from setuptools import Command +# distutils from stdlib is deprecated from python 3.10. +# setuptools has been maintaining a copy of distutils and importing +# setuptools will replace stdlib/distutils with setuptools/distutils. +from distutils.errors import DistutilsError # pylint: disable=wrong-import-order Review Comment: So the `distutils` is present in two places. In Python standard library and also in setuptools. `setuptools` adopted `stdlib` implementation of `distutils` and the `stdlib distutils` is marked for deprecation in Python 3.10 and removal for Python 3.12. Now, in order to use `distutils`, we can just import `setuptools`, which implicitly imports its version of `distutils`. it is recommended to import `distutils` after `setuptools`, otherwise we might use `stdlib distutils` which is deprecated and no longer maintained I read a bit and found the information above. Now we don't need the `BaseError` which requires `setuptools>=60.0.0`. We just need to reorder the imports wrt `setuptools` and `distutils`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
