Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.35k stars 2.71k forks source link

Missing websocket-client dependency for azure-servicebus #36256

Open green-digger opened 5 days ago

green-digger commented 5 days ago

Describe the bug

Missing websocket-client dependency cause azure service bus to throw an exception when using the azure-servicebus sdk

To Reproduce

Assuming a fresh virtual env


pip install azure-servicebus==7.11.4

python -c 'from azure.servicebus._pyamqp._transport import WebSocketTransport; test_websocket_transport = WebSocketTransport("test_host"); test_websocket_transport.connect()'

Returns


Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<path to env>\.venv\Lib\site-packages\azure\servicebus\_pyamqp\_transport.py", line 731, in connect    
    raise ImportError(
ImportError: Please install websocket-client library to use sync websocket transport

The environment contains

pip freeze

Returns

azure-core==1.30.2
azure-servicebus==7.11.4
certifi==2024.6.2
charset-normalizer==3.3.2
idna==3.7
isodate==0.6.1
requests==2.32.3
six==1.16.0
typing_extensions==4.12.2
urllib3==2.2.2

Expected behavior

Expect no import error exception to be returned

I would expect the dependency to be defined as part of the package dependencies and installed when installing the azure-servicebus package.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

The workaround is simple as can just add the dependency directly. I would just expect this to be defined as part of the package dependencies, either required or as an extra.

kristapratico commented 4 days ago

@green-digger thanks for your issue, the team will take a look and get back to you as soon as possible.