pylint
tox environment has false import-errors on local tox
runs #32504
Open
Description
opened on Oct 13, 2023
Context
Thanks @pvaneck for repro and investigation!
# install eng/ci_tools.txt
cd sdk/monitor/azure-monitor-query
tox -v -c ../../../eng/tox/tox.ini --root . -e pylint
results in bunches of:
azure\monitor\query\aio\_metrics_query_client_async.py:14: [E0401(import-error), ] Unable to import 'azure.core.tracing.decorator_async'
azure\monitor\query\aio\_metrics_query_client_async.py:14: [E0611(no-name-in-module), ] No name 'core' in module 'azure'
This started occurring with the python 3.12
upgrade. The origin of the new behavior is the new pip
version interacting with pylint
erroneously.
Specifically, when a dependency of the package being pylinted is editable installed, import error
s are thrown when they really shouldn't be. See this pylint issue for the discussion. These aren't real import errors, they are caused by how pylint
is interacting with a new setuptools
required by py 3.12.
This can be bypassed temporarily by setting env variable:
SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
We don't see this in CI because in CI, no editable requirements are installed. They're all pre-built!
Solutions
- Commit to temporary solution first off
- Add an additional PR that forces all
dev_requirements.txt
installs within thepylint
environment to prebuilt packages. REGARDLESS of whether it is being run in CI or not.
Activity