Skip to content

pylint tox environment has false import-errors on local tox runs #32504

Open
@scbedd

Description

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

  1. Commit to temporary solution first off
  2. Add an additional PR that forces all dev_requirements.txt installs within the pylint environment to prebuilt packages. REGARDLESS of whether it is being run in CI or not.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Azure.CoreClientThis issue points to a problem in the data-plane of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions