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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LocationServiceClient
✓ from mypy_boto3_location.client import LocationServiceClient
✗ from mypy_boto3_location.client import LocationServiceClient
This example demonstrates how to initialize a type-hinted LocationService client and use it to list geofences. It includes an explicit type annotation for the client and the response type, enabling full static analysis and autocomplete.
import os
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_location.client import LocationServiceClient
from mypy_boto3_location.type_defs import ListGeofencesResponseTypeDef
def get_location_client() -> LocationServiceClient:
"""Initializes and returns a typed LocationService client."""
# AWS credentials will be picked up from environment variables (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
# or ~/.aws/credentials. REGION_NAME is important for LocationService.
region = os.environ.get('AWS_REGION', 'us-east-1')
return boto3.client('location', region_name=region)
def list_all_geofences():
"""Lists all geofences using the LocationService client."""
client = get_location_client()
try:
response: ListGeofencesResponseTypeDef = client.list_geofences(CollectionName='my-geofence-collection')
print(f"Geofences found: {len(response['Entries'])}")
for entry in response['Entries']:
print(f" - Geofence ID: {entry['GeofenceId']}")
except client.exceptions.ResourceNotFoundException:
print("Geofence collection 'my-geofence-collection' not found or empty.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == '__main__':
# This quickstart requires an existing LocationService geofence collection.
# Replace 'my-geofence-collection' with an actual collection name in your AWS account.
list_all_geofences()
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older should upgrade their Python version.fixUpgrade Python to 3.9 or newer.
affects: mypy-boto3-builder >=8.12.0
breakingTypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Some TypeDefs for packed method arguments use shorter names, and conflicting `Extra` postfixes were moved. This could break code explicitly importing or referencing these TypeDefs.fixReview and update explicit TypeDef imports and references according to the new naming conventions.
affects: mypy-boto3-builder >=8.9.0
gotchaPyCharm users might experience slow performance or high CPU usage due to `Literal` overloads. It is recommended to use `boto3-stubs-lite` or disable PyCharm's internal type checker and rely on `mypy` or `pyright` instead.fixInstall `boto3-stubs-lite[location]` instead of `mypy-boto3-location` or `boto3-stubs[location]`, or configure PyCharm to use an external type checker.
affects: All versions with PyCharm < 2023.2
gotchaFor Pylint compatibility, if `mypy-boto3-location` is a `TYPE_CHECKING` dependency, Pylint might complain about undefined variables. A common fix is to set types to `object` in non-`TYPE_CHECKING` mode.fixWrap type imports with `if TYPE_CHECKING:` and define fallback `object` assignments for runtime, as shown in the example import section.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredProvides the AWS SDK that these type stubs annotate.