-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy error: "FastAPI" has no attribute "container" #626
Comments
I mean, is that really a work around? You needed to add a new property to the FastAPI class so you extended it. Seems like a normal solution. |
You are right that this is a fairly good solution, I'm just mostly surprised that this was not mentioned anywhere and I wasn't able to find any issues or anything else about it. For a lib that claims to be mypy friendly I'd expect it to mention something instead of just giving an example that doesn't actually work with mypy |
FastAPI is a third party package though, I think 'mypy fiendly' means that the lib provides it's own types. |
I'm curious how/why setting |
It doesn't, mypy is right here. There is no special attribute-checking logic in python-dependency-injector neither FastAPI has |
dependecy-injector version: "^4.40.0"
FastAPI version: "^0.79.1"
Hello, following the example for FastAPI, mypy complains with the error on the title when I do
app.container = container
.The only way I found to work around it (other than
type: ignore
) was to create a custom class that inherits from FastAPI:Is there any other way to do this?
I'm a little surprised that I couldn't find any other issue about this so I'm wondering if I missed something.
The text was updated successfully, but these errors were encountered: