Motor-Types
Python stubs for Motor, a Non-Blocking MongoDB driver for Python's Tornado and AsyncIO based applications.
About
Stubs for Motor (version 3.0.0+) for substituting the missing type-hints. These stubs are meant to be used along with
pycharm and mypy to facilitate static type-checking. Installing this package adds these .pyi
files to
libs/site-packages/motor
. Currently, only the stubs for AsyncIO are supported. You can contribute to stubs for
Tornado by opening a pull request for the same.
Note: This project is currently under development and is in no way affiliated with MongoDB. This is an unofficial
stub package.
How to use?
You can either install from PyPI using pip or add files to your project directories manually.
Installing Using pip:
pip install motor-types
To install Motor (and Dnspython) alongside the package:
pip install motor-types[motor]
To add files to the project manually:
Use this command to clone the repository:
git clone "https://github.com/L0RD-ZER0/Motor-Types"
Afterwards, you can do either of the following to use stubs:
- Copy the stubs manually to either
libs/site-packages/motor
or libs/site-packages/motor-stubs
, ideally the latter. - Add these stubs manually to project directories.
- For MyPy.
- For PyCharm.
- For other static type-checking tools, consider referring to their corresponding documentation regarding stubs.
Examples:
Auto-Complete Example
Without Stubs:
With Stubs:
Type-Checking Example
Without Stubs:
With Stubs:
Dependencies
This package uses following dependencies:
How to Contribute?
The simplest contribution you can make is by opening a GitHub Issue or by forking the repository and making
a pull request on the GitHub Repository for the same. The changes can be as simple as improving the
documentation or as big as completing any incomplete section of the typings.
Note: All issues and pull-requests are subjected to a preliminary inspection.
License
This repository is licensed under MIT License. The license can be found within the repository.