Skip to content

Azure Devops import fails due to setuptools 82.0.0 incompatibility #2207

@AieatAssam

Description

@AieatAssam

Git provider

Azure

System Info

GPT-5.2, Azure DevOps pipeline, building from source (main)

Bug details

When running pr agent from source (checkout main branch, pip install .), latest setuptools (82.0.0) gets pulled. This has made pkg_resources completely obsolete as per https://setuptools.pypa.io/en/stable/history.html

End result is that imports in

try:
# noinspection PyUnresolvedReferences
from azure.devops.connection import Connection
# noinspection PyUnresolvedReferences
from azure.devops.released.git import (Comment, CommentThread, GitPullRequest, GitVersionDescriptor, GitClient, CommentThreadContext, CommentPosition)
from azure.devops.released.work_item_tracking import WorkItemTrackingClient
# noinspection PyUnresolvedReferences
from azure.identity import DefaultAzureCredential
from msrest.authentication import BasicAuthentication
except ImportError:
AZURE_DEVOPS_AVAILABLE = False
all fail silently.

azure-devops package still relies on pkg_resources, if you pull it locally, you will see:

  File "<SNIP>/.venv/lib/python3.12/site-packages/azure/__init__.py", line 5, in <module>
    import pkg_resources
  File "<SNIP>/Applications/PyCharm Professional Edition.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pkg_resources'

Since upstream azure package is stuck in limbo the only recourse is to pin setuptools version to 81.0.0 and make it an explicit import.
EDIT: Upstream fix is available, see comment below and linked PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions