Registry / type-stubs / twilio-stubs

twilio-stubs

JSON →
library0.2.0pypypi✓ verified 89d ago

twilio-stubs is an unofficial package providing type declarations (PEP 561 stub files) for the Twilio API. Version 0.2.0 is current. The project is actively maintained, with infrequent releases.

pip install twilio-stubs
INSTALL
IMPORT
SIG · TWILIO-STUBS
T
twilio-stubs
type-stubspythonv0.2.0
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.

twilio-rest-stubs
✓ from twilio.rest import Client
twilio-stubs provides types for the public twilio.rest.Client; no special import needed.

Basic usage: type-checked Twilio client with twilio-stubs.

from twilio.rest import Client account_sid = os.environ.get('TWILIO_ACCOUNT_SID', '') auth_token = os.environ.get('TWILIO_AUTH_TOKEN', '') client = Client(account_sid, auth_token) message = client.messages.create(body='Hello from mypy!', from_='+15017122661', to='+15558675310') print(f'Message sent: {message.sid}')
Debug
Known issues
gotchatwilio-stubs provides types only for the REST API (twilio.rest). Other Twilio modules (e.g., TwiML, TaskRouter) may lack stubs.
fix
Use inline type comments or 'Any' for uncovered parts, or contribute stubs upstream.
affects: all
deprecatedTypes are based on the twilio Python helper library (version 6.x/7.x). If you use an older or newer major version, type mismatches may occur.
fix
Pin twilio to a version compatible with the stubs (check twilio-stubs PyPI classifiers).
affects: >7.0
gotchaTwilio-stubs is a third-party package, not maintained by Twilio. Updates may lag behind the official library releases.
fix
Watch for upstream twilio-stubs releases; consider contributing or using 'type: ignore' in checks.
affects: all
Errors
Common errors & fixes
Module 'twilio' has no attribute 'rest'
Missing twilio runtime dependency installed but stubs are missing types for other modules.
fix
Ensure you have twilio-stubs installed alongside twilio. Note that twilio-stubs only covers twilio.rest.
Cannot find reference 'Client' in 'twilio.rest'
Type checker may not resolve stub files if package is not in site-packages or mypy cache is stale.
fix
Run 'pip install --upgrade twilio-stubs' and clear mypy cache: 'mypy --cache-dir /dev/null .'
Unused type: ignore comment
Using '# type: ignore' in code that twilio-stubs now covers.
fix
Remove the '# type: ignore' comment and update mypy configuration if needed.
Upgrade
Version history
0.2.0latest on PyPI · released Feb 15, 2023
Audit
Dependencies
twiliorequiredRuntime dependency: the types are for the twilio package.
Agent activity
35 hits · last 30 days
node
32
OpenAI (training)
1
Resources
twilio-stubs — pip install twilio-stubs · libregistry