-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#2121Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable
Milestone
Description
Bug description
The following code:
''' Minimal reproducer for setuptools warning. '''
import setuptools
import pipproduces the following warning when scanned with pylint:
.../site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
This output is confusing as it is triggered by the code being scanned and not by anything that Pylint uses internally.
Configuration
No response
Command used
pylint --report=no --score=no --disable=unused-import bugs/pylint/distutils_warning.pyPylint output
.../site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")Expected behavior
I would expect no UserWarning for something related to Setuptools while scanning code with Pylint.
While I think that this is mostly a toxic interaction between Setuptools and Pip imports, Pylint (or Astroid) could suppress these warnings by wrapping the imports needed for AST parsing with the warnings.catch_warnings context manager or something along those lines.
Pylint version
pylint --version
pylint 2.15.7
astroid 2.12.13
Python 3.7.15 (default, Oct 15 2022, 11:29:20)
[GCC 9.4.0]OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable