Skip to content
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

[ServiceBus] prep release 7.10.0b1 #29815

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sdk/servicebus/azure-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 7.9.0b2 (Unreleased)
## 7.10.0b1 (2023-04-11)
swathipil marked this conversation as resolved.
Show resolved Hide resolved

### Features Added

Expand All @@ -18,7 +18,7 @@
- Removed uAMQP from required dependencies.
- Adding `uamqp >= 1.6.3` as an optional dependency for use with the `uamqp_transport` keyword.

## 7.9.0 (Unreleased)
## 7.9.0 (2023-04-11)

### Breaking Changes

Expand All @@ -30,6 +30,7 @@

### Other Changes

- All pure Python AMQP stack related changes have been removed and will be added back in the next version.
- Updated minimum `azure-core` version to 1.24.0.
- Removed `msrest` dependency.
- Removed `azure-common` dependency.
Expand Down
31 changes: 30 additions & 1 deletion sdk/servicebus/azure-servicebus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _Azure SDK Python packages support for Python 2.7 ended 01 January 2022. For mor
Install the Azure Service Bus client library for Python with [pip][pip]:

```Bash
pip install azure-servicebus==7.9.0b1
pip install azure-servicebus==7.10.0b1
```

### Prerequisites:
Expand Down Expand Up @@ -480,12 +480,41 @@ For users seeking to perform management operations against ServiceBus (Creating
please see the [azure-mgmt-servicebus documentation][service_bus_mgmt_docs] for API documentation. Terse usage examples can be found
[here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-mgmt-servicebus/tests) as well.

### Pure Python AMQP Transport and Backward Compatibility Support

The Azure Service Bus client library is now based on a pure Python AMQP implementation. `uAMQP` has been removed as required dependency.

To use `uAMQP` as the underlying transport:

1. Install `uamqp` with pip.

```
$ pip install uamqp
```

2. Pass `uamqp_transport=True` during client construction.

```python
from azure.servicebus import ServiceBusClient
connection_str = '<< CONNECTION STRING FOR THE SERVICE BUS NAMESPACE >>'
queue_name = '<< NAME OF THE QUEUE >>'
client = ServiceBusClient.from_connection_string(
connection_str, uamqp_transport=True
)
```

Note: The `message` attribute on `ServiceBusMessage`/`ServiceBusMessageBatch`/`ServiceBusReceivedMessage`, which previously exposed the `uamqp.Message`, has been deprecated.
The "Legacy" objects returned by `message` attribute have been introduced to help facilitate the transition.

### Building uAMQP wheel from source

`azure-servicebus` depends on the [uAMQP](https://pypi.org/project/uamqp/) for the AMQP protocol implementation.
uAMQP wheels are provided for most major operating systems and will be installed automatically when installing `azure-servicebus`.
If [uAMQP](https://pypi.org/project/uamqp/) is intended to be used as the underlying AMQP protocol implementation for `azure-servicebus`,
uAMQP wheels can be found for most major operating systems.

If you're running on a platform for which uAMQP wheels are not provided, please follow
If you intend to use `uAMQP` and you're running on a platform for which uAMQP wheels are not provided, please follow
the [uAMQP Installation](https://github.com/Azure/azure-uamqp-python#installation) guidance to install from source.

## Contributing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@

if TYPE_CHECKING:
from .exceptions import ServiceBusError
from uamqp import AMQPClient as uamqp_AMQPClientSync
try:
# pylint:disable=unused-import
from uamqp import AMQPClient as uamqp_AMQPClientSync
except ImportError:
pass

from ._pyamqp.message import Message as pyamqp_Message
from ._pyamqp.client import AMQPClient as pyamqp_AMQPClientSync
from azure.core.credentials import TokenCredential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@
)

if TYPE_CHECKING:
from uamqp import (
Message,
BatchMessage
)
try:
# pylint:disable=unused-import
from uamqp import (
Message,
BatchMessage
)
except ImportError:
pass
from .._pyamqp.performatives import TransferFrame
from azure.core.tracing import AbstractSpan
from ..aio._servicebus_receiver_async import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@
from ..amqp import AmqpAnnotatedMessage

if TYPE_CHECKING:
from uamqp import (
Message as uamqp_Message,
types as uamqp_types
)
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
try:
# pylint:disable=unused-import
from uamqp import (
Message as uamqp_Message,
types as uamqp_types
)
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
except ImportError:
pass
from .._pyamqp.message import Message as pyamqp_Message
from .._pyamqp.authentication import JWTTokenAuth as pyamqp_JWTTokenAuth
from .message import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class ServiceBusClient(object): # pylint: disable=client-accepts-api-version-key
:keyword str connection_verify: Path to the custom CA_BUNDLE file of the SSL certificate which is used to
authenticate the identity of the connection endpoint.
Default is None in which case `certifi.where()` will be used.
:keyword uamqp_transport: Whether to use the `uamqp` library as the underlying transport. The default value is
False and the Pure Python AMQP library will be used as the underlying transport.
:paramtype uamqp_transport: bool

.. admonition:: Example:

Expand Down Expand Up @@ -231,6 +234,9 @@ def from_connection_string(
:keyword str connection_verify: Path to the custom CA_BUNDLE file of the SSL certificate which is used to
authenticate the identity of the connection endpoint.
Default is None in which case `certifi.where()` will be used.
:keyword uamqp_transport: Whether to use the `uamqp` library as the underlying transport. The default value is
False and the Pure Python AMQP library will be used as the underlying transport.
:paramtype uamqp_transport: bool
:rtype: ~azure.servicebus.ServiceBusClient

.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@
from ._servicebus_session import ServiceBusSession

if TYPE_CHECKING:
from uamqp import ReceiveClient as uamqp_ReceiveClientSync, Message as uamqp_Message
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
try:
# pylint:disable=unused-import
from uamqp import ReceiveClient as uamqp_ReceiveClientSync, Message as uamqp_Message
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
except ImportError:
pass
from ._transport._base import AmqpTransport
from ._pyamqp.client import ReceiveClient as pyamqp_ReceiveClientSync
from ._pyamqp.message import Message as pyamqp_Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@
AzureSasCredential,
AzureNamedKeyCredential,
)
from uamqp import SendClient as uamqp_SendClientSync
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
try:
# pylint:disable=unused-import
from uamqp import SendClient as uamqp_SendClientSync
from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth
except ImportError:
pass

from ._transport._base import AmqpTransport
from ._pyamqp.authentication import JWTTokenAuth as pyamqp_JWTTokenAuth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ def to_outgoing_amqp_message(annotated_message: "AmqpAnnotatedMessage") -> "Mess
annotations[key] = amqp_long_value(annotated_message.annotations[key])

if annotated_message.application_properties:
for key, val in annotated_message.application_properties.items():
for app_key, app_val in annotated_message.application_properties.items():
# This is being done to bring parity with uamqp. uamqp will decode bytes to str in
# application properties and this will match that behavior
if isinstance(val, bytes):
annotated_message.application_properties[key] = val.decode("utf-8")
if isinstance(app_val, bytes):
annotated_message.application_properties[app_key] = app_val.decode("utf-8")

message_dict = {
"header": message_header,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Licensed under the MIT License.
# ------------------------------------

VERSION = "7.9.0b2"
VERSION = "7.10.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
)

if TYPE_CHECKING:
from uamqp.async_ops.client_async import AMQPClientAsync as uamqp_AMQPClientAsync
try:
# pylint:disable=unused-import
from uamqp.async_ops.client_async import AMQPClientAsync as uamqp_AMQPClientAsync
except ImportError:
pass
from .._pyamqp.aio._client_async import AMQPClientAsync as pyamqp_AMQPClientAsync
from .._pyamqp.message import Message as pyamqp_Message
from azure.core.credentials_async import AsyncTokenCredential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class ServiceBusClient(object): # pylint: disable=client-accepts-api-version-key
:keyword str connection_verify: Path to the custom CA_BUNDLE file of the SSL certificate which is used to
authenticate the identity of the connection endpoint.
Default is None in which case `certifi.where()` will be used.
:keyword uamqp_transport: Whether to use the `uamqp` library as the underlying transport. The default value is
False and the Pure Python AMQP library will be used as the underlying transport.
:paramtype uamqp_transport: bool

.. admonition:: Example:

Expand Down Expand Up @@ -198,6 +201,9 @@ def from_connection_string(
:keyword str connection_verify: Path to the custom CA_BUNDLE file of the SSL certificate which is used to
authenticate the identity of the connection endpoint.
Default is None in which case `certifi.where()` will be used.
:keyword uamqp_transport: Whether to use the `uamqp` library as the underlying transport. The default value is
False and the Pure Python AMQP library will be used as the underlying transport.
:paramtype uamqp_transport: bool
:rtype: ~azure.servicebus.aio.ServiceBusClient

.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@
from ._async_utils import create_authentication

if TYPE_CHECKING:
from uamqp.async_ops.client_async import ReceiveClientAsync as uamqp_ReceiveClientAsync
from uamqp.authentication import JWTTokenAsync as uamqp_JWTTokenAuthAsync
from uamqp.message import Message as uamqp_Message
try:
# pylint:disable=unused-import
from uamqp.async_ops.client_async import ReceiveClientAsync as uamqp_ReceiveClientAsync
from uamqp.authentication import JWTTokenAsync as uamqp_JWTTokenAuthAsync
from uamqp.message import Message as uamqp_Message
except ImportError:
pass
from ._transport._base_async import AmqpTransportAsync
from .._pyamqp.message import Message as pyamqp_Message
from .._pyamqp.aio import ReceiveClientAsync as pyamqp_ReceiveClientAsync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
from uamqp.async_ops.client_async import SendClientAsync as uamqp_SendClientAsync
from uamqp.authentication import JWTTokenAsync as uamqp_JWTTokenAuthAsync
try:
# pylint:disable=unused-import
from uamqp.async_ops.client_async import SendClientAsync as uamqp_SendClientAsync
from uamqp.authentication import JWTTokenAsync as uamqp_JWTTokenAuthAsync
except ImportError:
pass
from .._pyamqp.aio import SendClientAsync as pyamqp_SendClientAsync
from .._pyamqp.aio._authentication_async import JWTTokenAuthAsync as pyamqp_JWTTokenAuthAsync
from ._transport._base_async import AmqpTransportAsync
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/azure-servicebus/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ If you do not have an existing Azure account, you may sign up for a free trial o

1. Install the Azure Service Bus client library for Python with [pip](https://pypi.org/project/pip/):
```bash
pip install azure-servicebus==7.9.0b1
pip install azure-servicebus==7.10.0b1
```
To run samples that utilize the Azure Active Directory for authentication, please install the `azure-identity` library:
```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


async def main():
servicebus_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR, uamqp_transport=True)
servicebus_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR)

async with servicebus_client:
receiver = servicebus_client.get_queue_receiver(queue_name=QUEUE_NAME)
Expand Down