{"id":3586,"library":"mypy-boto3-geo-routes","title":"mypy-boto3-geo-routes Type Annotations","description":"This library provides comprehensive type annotations for the AWS Boto3 LocationServiceRoutesV2 service. It is part of the mypy-boto3 project, which offers extensive stub packages for all boto3 services, generated by `mypy-boto3-builder`. The project is actively maintained, with new versions (currently 1.42.81) released frequently to align with upstream boto3 updates and AWS API changes.","status":"active","version":"1.42.81","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","type-hints","mypy","stubs","location-service","geo-routes"],"install":[{"cmd":"pip install mypy-boto3-geo-routes","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"Provides the runtime functionality for which these are type stubs. For accurate type checking and runtime behavior, the stub version should ideally match the installed boto3 version.","package":"boto3","optional":false}],"imports":[{"note":"Type stubs are provided by `mypy_boto3_*` packages. Direct import of type hints from `boto3` modules is incorrect for static analysis.","wrong":"from boto3.client import LocationServiceRoutesV2Client","symbol":"LocationServiceRoutesV2Client","correct":"from mypy_boto3_location_service_routes_v2 import LocationServiceRoutesV2Client"},{"note":"All generated TypeDefs for a specific service reside within its dedicated `mypy_boto3_SERVICE_NAME.type_defs` module.","wrong":"from boto3.location_service_routes_v2.type_defs import CalculateRouteRequestRequestTypeDef","symbol":"Service Type Definitions","correct":"from mypy_boto3_location_service_routes_v2.type_defs import CalculateRouteRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_location_service_routes_v2 import LocationServiceRoutesV2Client\nfrom mypy_boto3_location_service_routes_v2.type_defs import CalculateRouteRequestRequestTypeDef\n\n# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n\n# Initialize the boto3 client with type annotations\nclient: LocationServiceRoutesV2Client = boto3.client(\"location-service-routes-v2\")\n\n# Example: Calculate a route. Replace with actual data and coordinates.\n# For a full list of parameters, refer to AWS Boto3 documentation.\nrequest_params: CalculateRouteRequestRequestTypeDef = {\n    \"CalculatorName\": \"ExampleRouteCalculator\", # Must be an existing calculator name in your AWS account\n    \"DeparturePosition\": [10.0, 20.0], # Example: [longitude, latitude]\n    \"DestinationPosition\": [11.0, 21.0], # Example: [longitude, latitude]\n    \"TravelMode\": \"Car\",\n    \"DepartureTime\": \"2024-01-01T00:00:00Z\" # ISO 8601 format\n}\n\ntry:\n    response = client.calculate_route(**request_params)\n    print(f\"Calculated Route Summary: {response['Summary']}\")\n    # Example output: Calculated Route Summary: {'DataSource': 'Esri', 'Distance': 1.23, 'DurationSeconds': 60.0}\nexcept client.exceptions.ResourceNotFoundException as e:\n    print(f\"Error: {e}. Ensure 'ExampleRouteCalculator' exists and is correctly configured in AWS Location Service.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"Demonstrates initializing a type-hinted AWS LocationServiceRoutesV2 client and performing a basic `calculate_route` operation. Note that `mypy-boto3-geo-routes` provides only type stubs; the actual `boto3` library must be installed and configured for runtime execution with valid AWS credentials."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later.","message":"Python 3.8 support was removed for `mypy-boto3` packages with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade to Python 3.9 or newer to use current versions of these stubs.","severity":"breaking","affected_versions":">=8.12.0 (builder)"},{"fix":"Review and update explicit TypeDef annotations in your code to match the new shorter names, if affected.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. Some TypeDef names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This can break explicit type annotations in existing code.","severity":"breaking","affected_versions":">=8.9.0 (builder)"},{"fix":"Ensure `pip install boto3` is run. Ideally, `mypy-boto3-geo-routes` version (e.g., 1.42.81) should correspond to your `boto3` version (e.g., `boto3==1.42.81`).","message":"This package provides type stubs only. It requires the actual `boto3` library to be installed and configured for runtime execution. For optimal type checking and to avoid potential runtime issues, ensure your `mypy-boto3-geo-routes` stub version is compatible with your installed `boto3` version.","severity":"gotcha","affected_versions":"*"},{"fix":"If type checking issues occur after upgrading, consult `mypy` documentation and `mypy-boto3` GitHub for potential configuration changes, especially regarding `py.typed` files.","message":"The `mypy-boto3` packages migrated to PEP 561 standard distribution in builder version 8.12.0. While this is generally an improvement, some `mypy` configurations or build environments might require adjustments if issues with stub discovery arise after upgrading.","severity":"gotcha","affected_versions":">=8.12.0 (builder)"},{"fix":"Adjust import statements to explicitly use the `mypy_boto3_SERVICE_NAME` package structure for all type annotations related to AWS services.","message":"When importing specific client or resource types, always import from the dedicated `mypy_boto3_SERVICE_NAME` package (e.g., `from mypy_boto3_location_service_routes_v2 import LocationServiceRoutesV2Client`). Do not attempt to import type hints directly from `boto3` modules, as they lack full type fidelity.","severity":"gotcha","affected_versions":"*"},{"fix":"Regularly check AWS documentation for service name changes or deprecations. If a service is renamed, search for the corresponding `mypy-boto3` package with the new name.","message":"AWS service names and their APIs can change or be deprecated over time (e.g., `sms-voice` service was renamed). While this package reflects the current state, always verify the service name used in `boto3.client()` and its corresponding `mypy-boto3` stub package name against the latest AWS documentation.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}