Azure / Azure/azure-cli

azure-cli v2.69.0 does not work with a stable release of azure-batch

Open
#30,814 4 comments 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
Customer Usage customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

The latest release of azure-cli v2.69.0 depends on a pre-release version of azure-batch https://github.com/Azure/azure-cli/blob/cf83ff0089398910a91dc40d1f8b716b4be179de/src/azure-cli/setup.py#L55, which breaks software that relies on the latest stable version of azure-batch v14.2.0

The class signature has changed significantly from `BatchServiceClient` to `BatchClient`

### Related command

Using the python SDK:
1. Install latest version of azure-batch from PyPI (https://pypi.org/project/azure-batch/)
2. Install latest version of azure-cli from PyPI (https://pypi.org/project/azure-cli/)
3. `from azure.batch import BatchServiceClient`

### Errors

`ImportError: cannot import name 'BatchServiceClient' from 'azure.batch'...`

### Issue script & Debug output

```
ImportError while importing test module '/home/vsts/work/1/s/Pipelines/RestartPools/tests/test_restart_pools.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
Pipelines/RestartPools/tests/test_restart_pools.py:11: in
import restart_pools as p
Pipelines/RestartPools/activities/python/restart_pools.py:35: in
import common.batch.pool as p
common/common/batch/pool.py:6: in
from azure.batch import BatchServiceClient
E ImportError: cannot import name 'BatchServiceClient' from 'azure.batch' (/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/azure/batch/__init__.py)
```

### Expected behavior

No discrepancy between latest stable versions of azure-batch and azure-cli

### Environment Summary

azure-cli: 2.69.0
azure-batch: 14.2.0
Python: 3.10.16
OS: Ubuntu-22.04

### Additional context

Related issue: https://github.com/Azure/azure-sdk-for-python/issues/39676

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.