Breaking changes in 0.11.0: deprecated client aliases and default HTTP transport
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- aws, python
- Ambito
- documentation
Direzione di ricerca
La issue descrive gli alias del client, i transport, la pulizia e gli esempi di migrazione per 0.11.0, ma non indica alcun file del repository, test o punto di ingresso della documentazione. Innanzitutto identifica la posizione prevista per la documentazione e conferma l'ambito desiderato dai maintainer; il lavoro sarà considerato completato quando saranno definiti un obiettivo concordato e criteri di accettazione che coprano i breaking changes documentati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Breaking changes in 0.11.0 release
Starting with version 0.11.0, the aws-sdk-* client packages include breaking changes to client names and default HTTP transports. This release also adds automatic cleanup of client HTTP resources.
Async-prefixed client names
Seven clients currently expose both an Async-prefixed client name and a deprecated unprefixed alias. Starting with version 0.11.0, these deprecated aliases are removed and only the Async<ServiceId>Client names remain. All other clients already expose only an Async-prefixed name and are not affected by this change.
The following deprecated aliases are removed:
| Deprecated alias removed | Use instead |
|---|---|
BedrockRuntimeClient |
AsyncBedrockRuntimeClient |
ConnectHealthClient |
AsyncConnectHealthClient |
LexRuntimeV2Client |
AsyncLexRuntimeV2Client |
PollyClient |
AsyncPollyClient |
QBusinessClient |
AsyncQBusinessClient |
SageMakerRuntimeHTTP2Client |
AsyncSageMakerRuntimeHTTP2Client |
TranscribeStreamingClient |
AsyncTranscribeStreamingClient |
For example, for Bedrock Runtime:
# Before
from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient
must now be:
# 0.11.0 and later
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
AIOHTTPClient is now the default transport
All clients now default to the AIOHTTPClient transport, which uses the aiohttp library to send HTTP requests. This changes the default transport for the following client packages, which previously used AWSCRTHTTPClient:
aws-sdk-bedrock-agent-runtimeaws-sdk-bedrock-agentcoreaws-sdk-bedrock-runtimeaws-sdk-connecthealthaws-sdk-lambdaaws-sdk-lex-runtime-v2aws-sdk-pollyaws-sdk-qbusinessaws-sdk-sagemaker-runtime-http2aws-sdk-transcribe-streaming
[!IMPORTANT]
AIOHTTPClientdoes not support HTTP/2 or bidirectional event streams. Applications that require either must install theawscrtoptional extra and explicitly configure the CRT transport.
For example, install the Bedrock Runtime client with CRT support:
python -m pip install "aws-sdk-bedrock-runtime[awscrt]"
Then pass an AWSCRTHTTPClient to the service-specific configuration:
from smithy_http.aio.crt import AWSCRTHTTPClient
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
config = await AsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
transport=AWSCRTHTTPClient(),
)
async with AsyncBedrockRuntimeClient(config=config) as client:
...
Applications that do not require HTTP/2, bidirectional event streams, or other CRT-specific functionality do not need to override the transport.
Client resource cleanup
Clients are now asynchronous context managers. Exiting the context automatically closes the underlying transport and cleans up HTTP resources such as sessions and connection pools.
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
async with AsyncBedrockRuntimeClient() as client:
...
We recommend using clients as asynchronous context managers. Applications that manage the client lifecycle directly can instead call close():
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
client = AsyncBedrockRuntimeClient()
try:
...
finally:
await client.close()
A client cannot be reused after its context exits or after close() is called.
Migrating existing applications
Update client usage as follows:
- Replace affected unprefixed client names with the corresponding
Async<ServiceId>Clientname. - If your application requires the CRT transport, install the client package with its
awscrtoptional extra, resolve anAsync<ServiceId>Configwithtransport=AWSCRTHTTPClient(), and pass that configuration to the client. - Use the client as an asynchronous context manager or call
await client.close()when the client is no longer needed.
For example:
# Before
from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
config = await AsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
)
client = BedrockRuntimeClient(
config=config,
)
becomes:
# 0.11.0 and later
from smithy_http.aio.crt import AWSCRTHTTPClient
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
config = await AsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
transport=AWSCRTHTTPClient(),
)
async with AsyncBedrockRuntimeClient(config=config) as client:
...
The explicit CRT transport in this example is only required for applications that need HTTP/2, bidirectional event streams, or other CRT-specific functionality.
Installing the latest version
Upgrade an existing client package with pip:
python -m pip install --upgrade aws-sdk-<service-id>
For example:
python -m pip install --upgrade aws-sdk-bedrock-runtime
To install the optional CRT transport:
python -m pip install --upgrade "aws-sdk-bedrock-runtime[awscrt]"
To explicitly require version 0.11.0 or later:
python -m pip install "aws-sdk-bedrock-runtime>=0.11.0"
Pinning versions
To avoid unexpected breaking changes when installing or deploying your application, we recommend pinning aws-sdk-* client packages to a specific version or compatible version range.
To pin to an exact version:
python -m pip install "aws-sdk-bedrock-runtime==0.11.0"
To allow compatible patch releases while avoiding newer minor releases:
python -m pip install "aws-sdk-bedrock-runtime~=0.11.0"
This is important while the SDK is pre-1.0.0, when minor releases may include breaking changes.
- Lingua principale
- Python
- Stelle
- 171
- Fork
- 24
- Merge medio
- 10h 47m
- PR unite (30g)
- 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/aws-sdk-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws/aws-sdk-python#13 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
aws/aws-sdk-python#99 ·
-
Support Python 3.11 Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
aws/aws-sdk-python#92 ·
-
announcement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
aws/aws-sdk-python#84 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
aws/aws-sdk-python#18 ·
Tutte le issue di aws/aws-sdk-python
Issue simili
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Apertaarea: ci bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-connect#1057 ·