`azdev extension remove` does not clear its corresponding source code path in `sys.path` when its package name is not its folder name
@AllyW is already working on this.
Since Mar 31, 2025.
Assessment
This issue has not been assessed yet.
Description
Reproduce step:
1. azdev extension add network-manager
2. azdev extension remove network-manager
3. python -c "import sys; print(sys.path)"
It would interfere module loading afterwards using az extension add -s virtual-network-manager.whl -y
The root cause is azdev extension add installs python package using pip install -e module-folder which added its real package name into sys.path (check easy_install.pth in venv).
While azdev extension remove calls pip uninstall module-folder to remove it and when its package name is different from its module name(folder name under azure-cli-extensions/src), azdev extension remove does not remove its package name in sys.path, it only removed the *egg-info folder under its module.
Another issues is when loading dev extensions from az extension list, this cmd reads in the *egg-info folder package info and check it with its folder name and when it's different, then metadata cannot be loaded from *egg-info, which will lost module version and preview info, as below:
What we can do has three options:
- this usage scenario is quite rare, remove the source code when loading module from
whlafter adding and removing it fromazdev - fix the
azdev extension removelogic - adjust the network-manager folder to be the same as its package name
virtual-network-manager
My suggestion is option 3. This scenario has caused too many special logic codes and breaks in execution, and we need to avoid it.
- Dominant language
- Python
- Stars
- 91
- Forks
- 134
- Avg merge
- 2h 51m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-cli-dev-tools
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Azure/azure-cli-dev-tools#310 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Azure/azure-cli-dev-tools#529 ·
-
Azure/azure-cli-dev-tools#525 · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Azure/azure-cli-dev-tools#520 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Azure/azure-cli-dev-tools#505 ·
All issues in Azure/azure-cli-dev-tools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100