Skip to content

Deprecation warning for azure-eventhub pyamqp async transport in socket time #40429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
erewok opened this issue Apr 8, 2025 · 7 comments · Fixed by #40441
Closed

Deprecation warning for azure-eventhub pyamqp async transport in socket time #40429

erewok opened this issue Apr 8, 2025 · 7 comments · Fixed by #40441
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@erewok
Copy link

erewok commented Apr 8, 2025

We upgraded aiohttp this week in our apps and started seeing this deprecation warning in our Eventhub Consumers:

 "/app/.venv/lib/python3.12/site-packages/azure/eventhub/_pyamqp/aio/_transport_async.py:467: DeprecationWarning:parameter 'timeout' of type 'float' is deprecated, please use 'timeout=ClientWSTimeout(ws_close=...)'\n"

Versions

  • Python: 3.12 (from base Docker image python:3.12-slim)
  • azure-eventhub: 5.14.0
  • aiohttp: 3.11.16

It looks like the websocket timeout param is a number, but aiohttp wants this wrapped up in an ClientWSTimeout object instead: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L891

        if timeout is not sentinel:
            if isinstance(timeout, ClientWSTimeout):
                ws_timeout = timeout
            else:
                warnings.warn(  # type: ignore[unreachable]
                    "parameter 'timeout' of type 'float' "
                    "is deprecated, please use "
                    "'timeout=ClientWSTimeout(ws_close=...)'",
                    DeprecationWarning,
                    stacklevel=2,
                )
                ws_timeout = ClientWSTimeout(ws_close=timeout)

Also, this change looks pretty tiny. I'm happy to submit a PR for this small change if you would like.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs labels Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

Hello @erewok. I'm an AI assistant for the azure-sdk-for-python repository. I have some suggestions that you can try out while the team gets back to you.

• The deprecation warning indicates that passing a raw float value for the websocket timeout is deprecated. Instead, the SDK should construct a ClientWSTimeout object as suggested by aiohttp (see aiohttp client docs).

• The change is localized in the _pyamqp async transport (see source).

• Your proposed change to wrap the timeout in ClientWSTimeout is aligned with the dependency's requirements. We welcome a PR to address this deprecation warning.

• Please ensure that any related tests are updated to validate the new behavior, so that the transition is smooth for users on Python 3.12 with the specified versions.

The team will get back to you shortly, hopefully this helps in the meantime.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 8, 2025
@erewok
Copy link
Author

erewok commented Apr 8, 2025

Well, the robot says a PR would be welcome 😁. I guess I'd like to hear from a human instead on that question.

@kashifkhan
Copy link
Member

Hi @erewok,

The robot is right, PRs are always welcome. In this particular case it would also involve an update to the vendored code inside ServiceBus, so up to you if you'd like to send us a PR (neither the team or the bot will complain 🙂) or the team can handle it.

Just another bit of shameless advertising, we are also beta testing a new websocket library and it can be found here pip install azure-eventhub==5.15.0b2. If yall would like to give it a trial that would be great, any feedback is appreciated.

@kashifkhan
Copy link
Member

@erewok We have patched the fix in, will update this thread once the changes reach pypi

@kashifkhan kashifkhan added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Apr 9, 2025
@erewok
Copy link
Author

erewok commented Apr 9, 2025

Thanks for the quick turnaround @kashifkhan! I'll try to give the new websocket library a test next week (if the feedback is useful).

@kashifkhan
Copy link
Member

@erewok no worries :)...yes please let me know if something comes up in yalls testing, would really appreciate the feedback with a customer testing in their environment. I can have further betas and higher confidence when gearing it for a full release.

@swathipil
Copy link
Member

@erewok - Just released azure-eventhub 5.15.0 with the change. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants