{"id":3620,"library":"mypy-boto3-machinelearning","title":"mypy-boto3-machinelearning","description":"mypy-boto3-machinelearning provides type annotations for the `boto3` Machine Learning service, generated by `mypy-boto3-builder`. It enhances development experience by enabling static type checking with tools like MyPy and improving IDE autocomplete for AWS Boto3 clients, paginators, waiters, and response `TypedDict`s. The library is actively maintained with releases often mirroring `boto3` versions.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","type-hints","aws","machine-learning","stubs"],"install":[{"cmd":"pip install mypy-boto3-machinelearning boto3","lang":"bash","label":"Install library and boto3"},{"cmd":"pip install mypy","lang":"bash","label":"Install MyPy (for type checking)"}],"dependencies":[{"reason":"Provides runtime functionality for AWS SDK calls, which this library type-hints.","package":"boto3"},{"reason":"Primary static type checker used with these annotations.","package":"mypy","optional":true},{"reason":"Required for certain type-hinting features, especially on Python versions prior to 3.9, though it is included as a calculated dependency by the builder.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"MachineLearningClient","correct":"from mypy_boto3_machinelearning.client import MachineLearningClient"},{"symbol":"DescribeMLModelsPaginator","correct":"from mypy_boto3_machinelearning.paginator import DescribeMLModelsPaginator"},{"symbol":"MLModelAvailableWaiter","correct":"from mypy_boto3_machinelearning.waiter import MLModelAvailableWaiter"},{"symbol":"CreateMLModelInputRequestTypeDef","correct":"from mypy_boto3_machinelearning.type_defs import CreateMLModelInputRequestTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom mypy_boto3_machinelearning.client import MachineLearningClient\n\ndef get_ml_client(region: str) -> MachineLearningClient:\n    \"\"\"Initializes and returns a type-hinted MachineLearning client.\"\"\"\n    client: MachineLearningClient = boto3.client(\"machinelearning\", region_name=region)\n    return client\n\ndef list_all_ml_models() -> None:\n    \"\"\"Lists all ML models using the type-hinted client.\"\"\"\n    region = os.environ.get('AWS_REGION', 'us-east-1')\n    try:\n        ml_client = get_ml_client(region)\n        print(f\"Listing ML models in {region}...\")\n        response = ml_client.describe_ml_models()\n        for model in response.get('Results', []):\n            print(f\"  Model ID: {model.get('MLModelId')}, Name: {model.get('MLModelName')}\")\n        print(\"Successfully listed ML models.\")\n    except Exception as e:\n        print(f\"Error listing ML models: {e}\")\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n    # Example: export AWS_REGION='us-east-1'\n    list_all_ml_models()","lang":"python","description":"This quickstart demonstrates how to initialize a type-hinted `boto3` Machine Learning client and use it to list ML models. It leverages `mypy-boto3-machinelearning` for static type checking and improved IDE support. Ensure `boto3` and AWS credentials are configured in your environment."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and later, affecting all generated packages including `mypy-boto3-machinelearning`. Projects now require Python >= 3.9.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (corresponds to mypy-boto3-machinelearning versions after this builder release)"},{"fix":"Review and update your explicit `TypeDef` imports according to the new naming conventions, or rely on IDE auto-completion for discovery.","message":"In `mypy-boto3-builder` version 8.9.0, there were changes to `TypeDef` naming conventions. Specifically, `TypeDef`s for packed method arguments use shorter names, and conflicting `Extra` postfixes were moved to the end. This can break explicit imports of `TypeDef`s.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (corresponds to mypy-boto3-machinelearning versions after this builder release)"},{"fix":"For general `boto3` stubs, consider installing `types-boto3` or `boto3-stubs[service1,service2]` instead of the legacy `mypy-boto3` package. For service-specific stubs, continue using `mypy-boto3-<service>`.","message":"The overarching `mypy-boto3` project has been superseded by `types-boto3` and `boto3-stubs` for general `boto3` type annotations. While service-specific packages like `mypy-boto3-machinelearning` continue to be released under their current name, be aware of the shift in the main project's branding if you are looking for generic `boto3` stubs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always add explicit type annotations when initializing clients (e.g., `client: MachineLearningClient = boto3.client('machinelearning')`) for the best IDE experience, even if `mypy` works implicitly.","message":"The library migrated to PEP 561 compliance. This means type checkers should automatically discover the stubs. However, in some IDEs (e.g., VSCode), explicit type annotations for `boto3.client()` calls are still recommended to get full auto-complete and type hint benefits due to limitations in function overload support.","severity":"gotcha","affected_versions":">=8.12.0 of mypy-boto3-builder (corresponds to mypy-boto3-machinelearning versions after this builder release)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}