⚡ Solution Summary
- Users unable to reproduce the issue with the same versions of pyright and stripe-python.
- Ensure correct configuration of Pylance in VSCode.
- Verify that the correct types are being recognized for stripe.Price.list().
- Consider updating pyright or checking for conflicting configurations.
### Describe the bug
While following the stripe documentation examples I get several type errors with pyright. I read in the documentation the sdk provides precise type annotations but that doesn't seem to be the case for many of the documentation examples. Am I doing something wrong? Is there a solution to this besides muting pyright or writing my own stubs?
### To Reproduce
1. With pyright configured list prices with `prices = stripe.Prices.list()`
2. Accessing `prices.data[0].id` show type error
### Expected behavior
No pyright type checking errors
### Code snippets
```Python
prices = stripe.Price.list()
price_id = prices.data[0].id # <- type error
checkout_session = stripe.checkout.Session.create(
line_items=[
{
'price': price_id,
'quantity': 1,
},
],
mode='subscription',
success_url=current_app.config["STRIPE_SUCCESS_REDIRECT_URL"] +
'?session_id={CHECKOUT_SESSION_ID}',
cancel_url=current_app.config["STRIPE_FAILURE_REDIRECT_URL"],
metadata={ "user_id": user_id},
)
checkout_session.url # <- type error
```
### OS
macOS
### Language version
Python 3.11.11
### Library version
stripe-python 11.6.0
### API version
2025-02-24.acacia
### Additional context
_No response_
Discussion & Fixes