Registry /
type-stubs / mypy-boto3-forecastquery
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.95 runs
installs and imports cleanly · install 0.0s · import 0.584s · 51.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.9s · import 0.546s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ForecastQueryServiceClient
✓ from mypy_boto3_forecastquery.client import ForecastQueryServiceClient
✗ from boto3.client import ForecastQueryService
Boto3's native client does not provide type hints; these are in the stub package. Importing directly from `mypy_boto3_forecastquery` is also incorrect; the client is in the `client` submodule.
QueryForecastResponseTypeDef
✓ from mypy_boto3_forecastquery.type_defs import QueryForecastResponseTypeDef
Response types and other type definitions are found in the `type_defs` submodule.
ForecastQueryServiceName
✓ from mypy_boto3_forecastquery.literals import ForecastQueryServiceName
Service name literals are provided for explicit typing.
This quickstart demonstrates how to obtain a type-hinted ForecastQueryService client using `mypy-boto3-forecastquery` and perform a `query_forecast` operation. The `if TYPE_CHECKING:` block ensures that `mypy-boto3-forecastquery` remains a development-only dependency.
import boto3
from typing import TYPE_CHECKING
from mypy_boto3_forecastquery.type_defs import QueryForecastResponseTypeDef
if TYPE_CHECKING:
from mypy_boto3_forecastquery.client import ForecastQueryServiceClient
def get_forecast_query_client() -> 'ForecastQueryServiceClient':
"""Returns a typed ForecastQueryService client."""
return boto3.client("forecastquery")
def main():
client = get_forecast_query_client()
try:
response: QueryForecastResponseTypeDef = client.query_forecast(
ForecastArn='arn:aws:forecast:us-east-1:123456789012:forecast/my-forecast-name',
StartDate='2023-01-01T00:00:00Z',
EndDate='2023-01-07T00:00:00Z',
Filters={'item_id': 'item_abc'}
)
print("Forecast data retrieved:")
for item in response.get('Forecast', {}).get('Predictions', {}).get('mean', []):
print(f" Timestamp: {item['Timestamp']}, Value: {item['Value']}")
except client.exceptions.ResourceNotFoundException:
print("Forecast not found. Ensure ARN and filters are correct.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
# Replace with a valid Forecast ARN and region for actual execution
# os.environ['AWS_ACCESS_KEY_ID'] = 'YOUR_ACCESS_KEY'
# os.environ['AWS_SECRET_ACCESS_KEY'] = 'YOUR_SECRET_KEY'
# os.environ['AWS_REGION'] = 'us-east-1'
main()
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-forecastquery` 1.42.3), support for Python 3.8 has been removed. Projects using this package must use Python 3.9 or newer. This release also migrated to PEP 561 compliant packages.fixUpgrade your Python environment to 3.9 or later. Ensure your type checker (e.g., mypy) is configured to correctly discover PEP 561 type packages if using isolated environments.
affects: >=1.42.3
breakingVersion 8.9.0 of `mypy-boto3-builder` introduced breaking changes in TypeDef naming conventions (e.g., shorter names, repositioning of 'Extra' postfix). This may affect existing code that explicitly imports or refers to generated TypeDefs.fixReview and update explicit TypeDef imports and references in your code to match the new naming conventions. Consult the `mypy-boto3-builder` release notes for details.
affects: Generated by `mypy-boto3-builder` >=8.9.0
gotchaIt is crucial to install `mypy-boto3-forecastquery` alongside `boto3`. Without the stub package, IDEs and static type checkers cannot provide accurate autocompletion or type validation for `boto3`'s dynamically generated clients.fixEnsure both `boto3` and `mypy-boto3-forecastquery` are installed in your development environment. Keep their versions aligned to prevent mismatches in type hints.
affects: All versions
gotchaPyCharm may experience slow performance or high CPU usage when handling `Literal` overloads within `mypy-boto3` packages.fixFor PyCharm users, `mypy-boto3-lite` (e.g., `boto3-stubs-lite[forecastquery]`) is recommended as a lighter alternative that avoids some overloads. Alternatively, disable PyCharm's built-in type checker and rely on `mypy` or `pyright` for static analysis.
affects: All versions
gotchaUsing `if TYPE_CHECKING:` when importing types is a best practice to ensure `mypy-boto3-forecastquery` remains a development-only dependency. Without it, some linters (like Pylint) might complain about undefined variables or the type stub package could become a runtime dependency.fixWrap type-only imports within an `if TYPE_CHECKING:` block and provide runtime fallbacks (e.g., `object`) if necessary for non-type-checking environments.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for the `boto3` library; `boto3` itself is a runtime dependency.
typing-extensionsrequiredMay be required for full type hint compatibility on older Python versions (<3.9) to support modern typing features, though recent builder versions removed Python 3.8 support.