{"id":3158,"library":"mypy-boto3-transcribe","title":"mypy-boto3-transcribe","description":"mypy-boto3-transcribe provides type annotations for the boto3 Transcribe service, specifically for version 1.42.25 of boto3. These packages are automatically generated by `mypy-boto3-builder` and are released frequently to keep up with boto3 updates, offering precise type hints for clients, resources, and various TypeDefs.","status":"active","version":"1.42.25","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","stubs","transcribe","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-transcribe","lang":"bash","label":"Install specific service stubs"},{"cmd":"pip install mypy-boto3","lang":"bash","label":"Install all boto3 stubs (larger)"}],"dependencies":[{"reason":"This package provides type stubs for the `boto3` library; `boto3` itself is required for runtime functionality.","package":"boto3","optional":false}],"imports":[{"symbol":"TranscribeClient","correct":"from mypy_boto3_transcribe.client import TranscribeClient"},{"symbol":"ListTranscriptionJobsPaginator","correct":"from mypy_boto3_transcribe.paginator import ListTranscriptionJobsPaginator"},{"note":"Type definitions should be imported from `mypy_boto3_transcribe` modules, not directly from `boto3` or `botocore`.","wrong":"from boto3.transcribe.client import TranscriptionJobSummaryTypeDef","symbol":"TranscriptionJobSummaryTypeDef","correct":"from mypy_boto3_transcribe.type_defs import TranscriptionJobSummaryTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_transcribe.client import TranscribeClient\nfrom typing import TYPE_CHECKING, cast\nimport os\n\n# Boto3 client requires AWS credentials, which can be configured via\n# environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)\n# or other boto3 configuration methods.\n\nif TYPE_CHECKING:\n    # This block is only for type checking tools like mypy or pyright.\n    # It helps prevent runtime import issues and ensures correct type resolution.\n    pass\n\ndef get_typed_transcribe_client() -> TranscribeClient:\n    \"\"\"Returns a type-hinted boto3 Transcribe client.\"\"\"\n    # boto3.client returns a DynamicClient which is untyped.\n    # We cast it to the specific mypy-boto3-transcribe client type.\n    client = boto3.client(\"transcribe\", region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n    return cast(TranscribeClient, client)\n\n# --- Example Usage ---\n\ntranscribe_client = get_typed_transcribe_client()\n\nprint(\"Listing first 3 transcription jobs:\")\nresponse = transcribe_client.list_transcription_jobs(\n    MaxResults=3,\n    Status='COMPLETED' # Example filter\n)\n\njob_summaries = response.get(\"TranscriptionJobSummaries\", [])\nif job_summaries:\n    for job in job_summaries:\n        print(f\"  - Name: {job['TranscriptionJobName']}, Status: {job['TranscriptionJobStatus']}\")\nelse:\n    print(\"  No completed transcription jobs found.\")\n\n# mypy will now correctly check arguments and return types for methods of transcribe_client\n# e.g., transcribe_client.start_transcription_job(TranscriptionJobName=123) will be flagged\n# as TranscriptionJobName expects a string.","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted `TranscribeClient` using `boto3` and `typing.cast`. It then shows a simple usage example to list transcription jobs, highlighting how `mypy` can provide static analysis for `boto3` calls."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. Ensure your `pip` and `setuptools` are up-to-date for proper PEP 561 package handling.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates these stub packages), Python 3.8 is no longer supported. Additionally, all generated packages migrated to PEP 561, which might affect environments relying on older packaging patterns.","severity":"breaking","affected_versions":"mypy-boto3-transcribe >= 1.42.25 (corresponding to builder 8.12.0+)"},{"fix":"For specific service stubs, use `pip install mypy-boto3-<service-name>`. If you need stubs for all services, `pip install mypy-boto3` is sufficient.","message":"When using `mypy-boto3` for a specific service like Transcribe, you generally need to install the service-specific stub package (e.g., `mypy-boto3-transcribe`). Installing just `mypy-boto3` provides stubs for all services but can be a significantly larger dependency.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `typing.cast` (preferably within a `TYPE_CHECKING` block) to explicitly type your `boto3` client instance, like `client = cast(TranscribeClient, boto3.client('transcribe'))`.","message":"To leverage type hints, you must cast the `boto3.client()` return value to the specific `mypy-boto3` client type (e.g., `TranscribeClient`). Without the `cast`, `mypy` will only see the untyped `botocore.client.Client`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Keep your `mypy-boto3-<service>` package version as close as possible to your `boto3` runtime version. Regularly update both to ensure consistency.","message":"The `mypy-boto3-*` packages are generated based on specific `boto3` and underlying `botocore` versions. Using an older stub package with a newer `boto3` version (or vice-versa) can lead to incorrect or missing type hints, as the API might have changed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review and update your custom `TypeDef` annotations to match the new naming conventions if you are upgrading from an older `mypy-boto3` version.","message":"From `mypy-boto3-builder` version 8.9.0, there were breaking changes in `TypeDef` naming conventions. For instance, `CreateDistributionRequestRequestTypeDef` was shortened to `CreateDistributionRequestTypeDef`, and `Extra` postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-transcribe generated by builder 8.9.0+"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}