AnandInguva commented on code in PR #21968:
URL: https://github.com/apache/beam/pull/21968#discussion_r905284124


##########
sdks/python/apache_beam/runners/portability/stager.py:
##########
@@ -54,14 +54,14 @@
 import shutil
 import sys
 import tempfile
-from distutils.version import StrictVersion
 from typing import Callable
 from typing import List
 from typing import Optional
 from typing import Tuple
 from urllib.parse import urlparse
 
 import pkg_resources
+from pkg_resources import parse_version

Review Comment:
   I read more about the integration of distutils with setuptools.  Setuptools 
has been maintaining a copy of disutils. If we import setuptools, it also 
imports `setuptools/distutils` or replaces(if already imported) 
`stdlib/distutils` with `setuptools/distutils`. 
   
   In this PR, i made changes to reflect
   1. setuptools to be imported before distutils. 
[[1](https://github.com/pypa/setuptools/blob/669be5ef1d93e2fa088cc5d1dfd999e0db61abcf/_distutils_hack/__init__.py#L18)]
   2. Replace the usage of distutils with alternatives. For example, for 
StricVersion, we can replace it with `pkg_resources.parse_version` since both 
follow [PEP-440](https://peps.python.org/pep-0440/)
   3. Update setuptools while building wheels and building python containers 
since these images use old version of setuptools



-- 
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]

Reply via email to