Registry / type-stubs / motor-stubs

motor-stubs

JSON →
library1.7.1pypypiunverified

Type stubs for Motor (async MongoDB driver) providing type hints for Motor classes. This package enables static type checking of Motor-based code in projects using mypy or pyright. It is maintained separately from Motor and has a version 1.7.1 as of last update, targeting Python >=3.9. Release cadence is irregular.

pip install motor-stubs
INSTALL
IMPORT
SIG · MOTOR-STUBS
M
motor-stubs
type-stubspythonv1.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AsyncIOMotorClient
from motor_stubs import AsyncIOMotorClient
from motor.motor_asyncio import AsyncIOMotorClient

Basic Motor async usage; stubs provide type checking.

import asyncio from motor.motor_asyncio import AsyncIOMotorClient async def main(): client = AsyncIOMotorClient('mongodb://localhost:27017') db = client.test_database collection = db.test_collection doc = await collection.find_one({'_id': 1}) print(doc) asyncio.run(main())
Debug
Known issues
breakingBreaking change in v1.0.0: AsyncIOMotorCursor type annotations changed; methods like .to_list() now expect Optional arguments
fix
Update code to match stubs; ensure None is handled explicitly for optional parameters
affects: >=1.0.0 (first major release)
gotchaStubs may not cover all Motor internals; mypy may report missing imports for certain attributes
fix
Use # type: ignore[attr-defined] or contribute to stubs
affects: all
deprecatedSome pymongo stubs (pymongo-stubs) are deprecated in favor of motor-stubs; motor-stubs now includes pymongo types
fix
Replace 'from pymongo_stubs import ...' with motor-stubs; ensure only motor-stubs is installed
affects: >=0.6.0
Upgrade
Version history
1.7.1latest on PyPI · released Jun 6, 2022
Audit
Dependencies
motorrequiredmotor-stubs provides type stubs for the motor package; runtime dependency required
mypyoptionalOptional: to use type checking during development
pymongo-stubsoptionalMotor internally uses pymongo types; pymongo-stubs may be needed for complete type coverage
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
motor-stubs — pip install motor-stubs · libregistry