Breaking changes in 0.10.0: async client configuration
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- aws, python
- Ambito
- documentation
Direzione di ricerca
Non è indicato alcun file del repository né alcun test. Inizia verificando dove vengono mantenute le note di rilascio o la documentazione sulla migrazione per la versione 0.10.0, quindi confronta con l’issue gli import documentati di AsyncConfig, l’utilizzo di resolve(), i tipi di plugin e gli esempi di blocco delle versioni; il lavoro è completato quando le indicazioni sulle breaking changes sono pubblicate nella posizione di documentazione stabilita del progetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Breaking changes in 0.10.0 release
Starting with version 0.10.0, the aws-sdk-* client packages include breaking changes to client configuration.
New configuration object
The synchronous Config class previously exported from each service package has been replaced with a service-specific asynchronous configuration class.
For example, for Bedrock Runtime:
# Before
from aws_sdk_bedrock_runtime.config import Config
is now:
# 0.10.0 and later
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
Configuration is now asynchronous
Configuration objects must now be created using the asynchronous resolve() method. Directly instantiating the configuration class is not supported and results in an error.
# Incorrect
config = AsyncBedrockRuntimeConfig(
region="us-west-2",
)
# Raises
smithy_aws_core.config.exceptions.ConfigError: AsyncBedrockRuntimeConfig cannot be constructed directly. Use `await AsyncBedrockRuntimeConfig.resolve(...)` instead.
Instead, resolve the configuration before passing it to the client:
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
config = await AsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
)
This change allows the SDK to perform configuration resolution that requires I/O, such as reading shared AWS configuration and credentials files, without blocking the event loop.
Configuration values are resolved from explicit overrides passed to resolve(), environment variables, and shared AWS configuration and credentials files. If no configuration is provided when constructing a client, the SDK automatically resolves one for you.
Plugins
Configuration plugins must now receive the service-specific asynchronous configuration type, Async<ServiceId>Config, instead of the previous Config type.
For example:
# Before
from aws_sdk_bedrock_runtime.config import Config
def my_plugin(config: Config) -> None:
...
is now:
# 0.10.0 and later
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
def my_plugin(config: AsyncBedrockRuntimeConfig) -> None:
...
Migrating existing applications
Update configuration usage as follows:
- Replace imports of
Configwith the service-specificAsync<ServiceId>Config. - Replace direct configuration construction with
await Async<ServiceId>Config.resolve(...). - Ensure explicit configuration resolution occurs within an asynchronous context.
- Update configuration plugins to accept the service-specific
Async<ServiceId>Configtype instead ofConfig.
For example:
# Before
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
from aws_sdk_bedrock_runtime.config import Config
def my_plugin(config: Config) -> None:
...
config = Config(
region="us-west-2",
)
client = AsyncBedrockRuntimeClient(
config=config,
plugins=[my_plugin],
)
becomes:
# 0.10.0 and later
from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
from aws_sdk_bedrock_runtime.config import AsyncBedrockRuntimeConfig
def my_plugin(config: AsyncBedrockRuntimeConfig) -> None:
...
config = await AsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
)
client = AsyncBedrockRuntimeClient(
config=config,
plugins=[my_plugin],
)
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 explicitly require version 0.10.0 or later:
python -m pip install "aws-sdk-bedrock-runtime>=0.10.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.10.0"
To allow compatible patch releases while avoiding newer minor releases:
python -m pip install "aws-sdk-bedrock-runtime~=0.10.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à 5/5 Più di una settimana Idoneità per principianti 25/100
aws/aws-sdk-python#90 ·
-
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
-
documentation help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
simonw/sqlite-utils#872 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100