types-pynamodb
raw JSON → 0.1 verified Fri May 01 auth: no python
A dummy package (version 0.1) providing type stubs for PynamoDB. The actual type hints are under development; this stub package is not yet stable and has limited functionality. Release cadence is unknown.
pip install types-pynamodb Common errors
error Cannot find reference 'Model' in 'types_pynamodb' ↓
cause Importing from the stub package instead of the actual library.
fix
Use 'from pynamodb.models import Model' instead.
error ImportError: No module named 'types_pynamodb' ↓
cause Package not installed or wrong Python environment.
fix
Run 'pip install types-pynamodb' in the correct environment.
Warnings
gotcha types-pynamodb 0.1 is a dummy package; it may not contain complete stubs. Rely on pynamodb's own type hints where possible. ↓
fix Use pynamodb directly with type checking (mypy, pyright). If stubs are missing, consider generating them with stubgen.
deprecated This stub package may be deprecated if PynamoDB ships its own type annotations in the future. ↓
fix Watch for pynamodb 7.x which may include inline type hints.
Imports
- Model wrong
from types_pynamodb import Modelcorrectfrom pynamodb.models import Model
Quickstart
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
class MyModel(Model):
class Meta:
table_name = 'my-table'
host = os.environ.get('DYNAMODB_HOST', 'http://localhost:8000')
name = UnicodeAttribute(hash_key=True)
model = MyModel('test')
print(model.name)