Registry / type-stubs / mypy-boto3-translate

mypy-boto3-translate

JSON →
library1.43.0pypypi✓ verified 23d ago

mypy-boto3-translate provides comprehensive type annotations for the AWS boto3 Translate service, enhancing development with static type checking. It is generated by the mypy-boto3-builder, ensuring alignment with boto3's API definitions. The current version is 1.42.3, typically updated frequently to match new boto3 releases and builder improvements.

pip install mypy-boto3-translate
INSTALL
IMPORT
SIG · MYPY-BOTO3-TRANSLA
M
mypy-boto3-translate
type-stubspythonv1.43.0
Install
2.7s avg
Import
Disk
71MB
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 · 18.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.7s · import 0.000s · 19MB
71MB installed
● package 71MB
Code
Verified usage

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

TranslateClient
from mypy_boto3_translate import TranslateClient
from mypy_boto3_translate import TranslateClient
TranslateServiceResource
from mypy_boto3_translate import TranslateServiceResource
Client
from mypy_boto3_translate.client import TranslateClient

This quickstart demonstrates how to use `mypy-boto3-translate` with `boto3` to type-hint a client and its method calls for the Translate service. It includes type hints for both the client instance and the request/response payloads, ensuring static type safety.

import boto3 from typing import TYPE_CHECKING, Dict, Any # These imports are only for type checking and are typically guarded # to prevent runtime errors if the stub package is not installed. if TYPE_CHECKING: from mypy_boto3_translate.client import TranslateClient from mypy_boto3_translate.type_defs import ( TranslateTextRequestRequestTypeDef, TranslateTextResponseTypeDef ) def translate_text_example(text: str, source_language: str, target_language: str) -> Dict[str, Any]: """Translates text using AWS Translate service with type hints.""" # Create a boto3 client. The type hint helps mypy understand its methods. client: TranslateClient = boto3.client("translate") # Define the request payload with a type hint for validation. request_payload: TranslateTextRequestRequestTypeDef = { "Text": text, "SourceLanguageCode": source_language, "TargetLanguageCode": target_language # Optional parameters can also be type-hinted and added here: # 'TerminologyNames': [], # 'Settings': {'Formality': 'FORMAL'} } # Call the service method. The response is also type-hinted. response: TranslateTextResponseTypeDef = client.translate_text(**request_payload) return response if __name__ == "__main__": import os # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials) # For this example, we'll use dummy text. Boto3 will handle credential lookup. # If running locally, make sure your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY # are set as environment variables or configured in ~/.aws/credentials. try: translated_output = translate_text_example( text="Hello, world! How are you today?", source_language="en", target_language="es" ) print(f"Original text: Hello, world! How are you today?") print(f"Translated text (ES): {translated_output['TranslatedText']}") # Expected output: Translated text (ES): ¡Hola, mundo! ¿Cómo estás hoy? except Exception as e: print(f"An error occurred: {e}") print("Please ensure AWS credentials are configured and the Translate service is accessible.")
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0 (which generates `mypy-boto3-translate` packages), Python 3.8 is no longer supported. The `requires_python` metadata is now `>=3.9`.
fix
Upgrade your Python environment to 3.9 or newer. Alternatively, pin your `mypy-boto3-translate` version to an older release if Python 3.8 support is critical.
affects: mypy-boto3-translate >= 1.42.0 (aligning with builder 8.12.0)
breakingThe `mypy-boto3-builder` (version 8.9.0) introduced changes to generated TypeDef naming conventions. For instance, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and the `Extra` postfix for conflicting names moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).
fix
Update your code to use the new TypeDef names. Consult the `mypy-boto3` documentation or regenerate your stub references.
affects: mypy-boto3-translate >= 1.42.0 (aligning with builder 8.9.0)
gotchaThese packages provide only type stubs for `boto3`. You must install `boto3` itself separately for your application to run at runtime. `mypy-boto3-translate` does not automatically install `boto3`.
fix
Ensure `boto3` is included in your project's dependencies (e.g., `pip install boto3`).
affects: All versions
gotchaFor the most accurate type checking, it is crucial to align the version of `mypy-boto3-translate` with the version of `boto3` you are using at runtime. Mismatched versions can lead to incorrect type hints or undetected API discrepancies.
fix
Install `mypy-boto3-translate` with a version that matches your `boto3` installation (e.g., if `boto3` is 1.42.3, install `mypy-boto3-translate==1.42.3`).
affects: All versions
gotchaThe `mypy-boto3` ecosystem migrated to PEP 561 package format with `mypy-boto3-builder` version 8.12.0. While this is a standard for distributing type stubs, older tooling or specific `mypy` configurations might experience changes in how stubs are discovered or resolved.
fix
Ensure your `mypy` or other type checker is up-to-date. If encountering stub resolution issues, verify your `mypy` configuration (e.g., `mypy_path`).
affects: mypy-boto3-translate >= 1.42.0 (aligning with builder 8.12.0)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredProvides the runtime AWS SDK that these type stubs annotate. Must be installed separately.
mypyoptionalThe primary static type checker for which these stubs are designed.
Agent activity
22 hits · last 30 days
node
16
OpenAI (training)
1
Resources
mypy-boto3-translate — pip install mypy-boto3-translate · libregistry