Registry / type-stubs / mypy-boto3-rekognition

mypy-boto3-rekognition

JSON →
library1.43.0pypypi✓ verified 23d ago

This library provides comprehensive type annotations for the `boto3` AWS Rekognition service, generated by `mypy-boto3-builder`. It enhances developer experience by enabling static type checking, autocompletion, and improved error detection for `boto3` users working with Rekognition, ensuring type safety in AWS SDK interactions. The current version is 1.42.3 and it is actively maintained through regular updates from the `mypy-boto3-builder` project.

pip install mypy-boto3-rekognition
INSTALL
IMPORT
SIG · MYPY-BOTO3-REKOGNI
M
mypy-boto3-rekognition
type-stubspythonv1.43.0
Install
3.4s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.4s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RekognitionClient
from mypy_boto3_rekognition import RekognitionClient
from mypy_boto3_rekognition import RekognitionClient

This quickstart demonstrates how to initialize a Rekognition client with type annotations and use it to detect labels in an image stored in an S3 bucket. It shows explicit type hints for the client object and the response, leveraging the benefits of static type checking. Ensure `boto3` is installed and AWS credentials are configured for the example to run.

import boto3 from mypy_boto3_rekognition.client import RekognitionClient from mypy_boto3_rekognition.type_defs import DetectLabelsResponseTypeDef import os # Configure AWS region from environment variable or default aws_region = os.environ.get("AWS_REGION", "us-east-1") # Create a Rekognition client with type hints # boto3 will automatically pick up credentials from environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) # or ~/.aws/credentials, or IAM roles. rekognition_client: RekognitionClient = boto3.client("rekognition", region_name=aws_region) # Example: Detect labels in an image from an S3 bucket try: # Replace with your S3 bucket and object key for testing s3_bucket_name = os.environ.get("REKOGNITION_TEST_BUCKET", "your-rekognition-test-bucket") s3_object_key = os.environ.get("REKOGNITION_TEST_OBJECT_KEY", "your-image.jpg") if s3_bucket_name == "your-rekognition-test-bucket" or s3_object_key == "your-image.jpg": print("Please set REKOGNITION_TEST_BUCKET and REKOGNITION_TEST_OBJECT_KEY environment variables or replace placeholders.") else: response: DetectLabelsResponseTypeDef = rekognition_client.detect_labels( Image={ 'S3Object': { 'Bucket': s3_bucket_name, 'Name': s3_object_key, } }, MaxLabels=10, MinConfidence=75 ) print(f"Detected labels in s3://{s3_bucket_name}/{s3_object_key}:") for label in response.get("Labels", []): print(f" {label['Name']} (Confidence: {label['Confidence']:.2f}%)") except rekognition_client.exceptions.InvalidImageFormatException: print("Error: Image format not supported by Rekognition.") except rekognition_client.exceptions.ClientError as e: print(f"AWS Client Error: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Consequently, `mypy-boto3-rekognition` versions 1.42.3 and newer require Python 3.9 or higher.
fix
Upgrade your Python environment to 3.9 or newer.
affects: >=1.42.3
breakingTypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. Specifically, argument TypeDefs were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).
fix
Update your code to use the new, shorter TypeDef names for request and response parameters.
affects: >=1.39.0 (corresponding to builder 8.9.0)
gotchaThis library provides *only* type hints (stubs). It does not include the functional `boto3` library itself. You must install `boto3` separately (`pip install boto3`) for your code to run.
fix
Ensure `boto3` is installed alongside `mypy-boto3-rekognition`.
affects: All
gotchaThe `mypy-boto3` packages are designed to be version-matched with the `boto3` library. Using `mypy-boto3-rekognition` 1.42.3 implies you should be using `boto3` version 1.42.3. Mismatched versions can lead to incorrect or missing type hints.
fix
Keep `mypy-boto3-rekognition` and `boto3` versions synchronized. For example, `pip install 'boto3==1.42.3' 'mypy-boto3-rekognition==1.42.3'`.
affects: All
gotchaUsers of PyCharm might experience slow performance with `mypy-boto3` due to issues with Literal overloads (PyCharm issue PY-40997). In such cases, it's recommended to either use `boto3-stubs-lite` (if explicit type annotations are acceptable) or disable PyCharm's internal type checker and rely on external tools like `mypy` or `pyright`.
fix
Consider `pip install boto3-stubs-lite[rekognition]` for PyCharm, or configure PyCharm to use an external type checker.
affects: All
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredProvides the underlying AWS SDK for Python. This library offers type hints for boto3, but boto3 itself must be installed separately for runtime functionality.
typing-extensionsoptionalMay be required for full typing compatibility on older Python versions, though typically less critical for Python 3.9+ environments.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
mypy-boto3-rekognition — pip install mypy-boto3-rekognition · libregistry