mypy-boto3-gameliftstreams
mypy-boto3-gameliftstreams provides type annotations for the boto3 GameLiftStreams service. It enhances static analysis for boto3 client calls related to GameLift Streams, offering improved autocompletion and error checking in IDEs and with type checkers like Mypy. The library is actively maintained, with releases tied to upstream boto3 updates and its generator, mypy-boto3-builder.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0 (which generated this stub), support for Python 3.8 has been removed across all `mypy-boto3` packages. Users on Python 3.8 will need to upgrade to Python 3.9 or newer to use this and subsequent versions.
- breaking Type definition names (TypeDefs) for packed method arguments and those with conflicting names were changed in `mypy-boto3-builder` version 8.9.0. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `CreateDistributionExtraRequestTypeDef` changed to `CreateDistributionRequestExtraTypeDef`. This may break existing explicit type annotations.
- gotcha PyCharm users might experience slow performance with `mypy-boto3` due to its handling of Literal overloads (PyCharm issue PY-40997). For large projects or if performance is an issue, consider using the `*-lite` versions (e.g., `boto3-stubs-lite[gameliftstreams]`) which offer a more RAM-friendly experience at the cost of requiring more explicit type annotations.
- gotcha The functionality and accuracy of type annotations are tightly coupled to the underlying `boto3` library version. Ensure that your `mypy-boto3-gameliftstreams` version closely matches your installed `boto3` version to avoid inconsistencies in type hints.
Install
-
pip install mypy-boto3-gameliftstreams -
pip install 'boto3-stubs[gameliftstreams]'
Imports
- GameLiftStreamsClient
from mypy_boto3_gameliftstreams.client import GameLiftStreamsClient
- GameLiftStreamsServiceName
from mypy_boto3_gameliftstreams.literals import GameLiftStreamsServiceName
Quickstart
import os
from typing import TYPE_CHECKING
from boto3.session import Session
# These imports are for type-checking only
if TYPE_CHECKING:
from mypy_boto3_gameliftstreams.client import GameLiftStreamsClient
from mypy_boto3_gameliftstreams.type_defs import ListStreamsOutputTypeDef
# Configure AWS credentials if not using environment variables/profile
# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')
# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')
# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')
def get_gamelift_streams_client() -> "GameLiftStreamsClient":
session = Session()
client: GameLiftStreamsClient = session.client("gamelift-streams")
return client
def list_gamelift_streams():
client = get_gamelift_streams_client()
try:
# Example: List GameLift Streams (replace with actual method if 'list_streams' is not relevant or requires args)
response: ListStreamsOutputTypeDef = client.list_streams()
print("Successfully listed GameLift Streams.")
# Process response here
# For example, if there were a 'Streams' key with a list of stream data:
# for stream in response.get('Streams', []):
# print(f" Stream ARN: {stream.get('StreamArn')}")
print(response)
except client.exceptions.ClientError as e:
print(f"Error listing GameLift Streams: {e}")
if __name__ == "__main__":
list_gamelift_streams()