Skip to content

In Azure CLI installed by Homebrew, azure and azure.mgmt still have __init__.py files calling pkg_resources #21910

@jiasli

Description

@jiasli

Even though #14372 migrated CLI packaging system to PEP 420 Implicit Namespace Packages, In Azure CLI installed by Homebrew, azure and azure.mgmt still have __init__.py files:

cat /opt/homebrew/Cellar/azure-cli/2.34.1/libexec/lib/python3.10/site-packages/azure/__init__.py
__import__('pkg_resources').declare_namespace(__name__)

cat /opt/homebrew/Cellar/azure-cli/2.34.1/libexec/lib/python3.10/site-packages/azure/mgmt/__init__.py
__import__('pkg_resources').declare_namespace(__name__)

This brings problems:

  1. azure namespace package installed by extensions won't work: Dataprotection ModuleNotFoundError 'azure.mgmt.resourcegraph' azure-cli-extensions#4562
  2. This defeats the purpose of migrating to PEP 420
  3. Loading time of pkg_resources is slow and this slows down the execution speed of Azure CLI

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions