Skip to content
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

Dependency Injector stops work after upgrade from 4.5.1 to 4.52 #331

Closed
juanmarin96 opened this issue Dec 5, 2020 · 4 comments
Closed
Assignees
Labels

Comments

@juanmarin96
Copy link

juanmarin96 commented Dec 5, 2020

I have this method router method wich resolve correctly the depency in version 4.51

import logging
from typing import Any, List
from dependency_injector.wiring import Provide, inject
from fastapi.routing import APIRouter
from app.core.containers import Containers
from app.core.product.entities.product import ProductBase
from app.core.product.services.product import ProductService


router = APIRouter()

@router.get('/', response_model=List[ProductBase])
@inject
async def read_products(
    skip: int = 0,
    limit: int = 100,
    product_service: ProductService = Depends(Provide[Containers.product]),
) -> Any:
   
    products = await product_service.get_multi(skip=skip, limit=limit)
    return products

But when I upgraded it to 4.5.2 to fixe this behavior -> #330 the Provide dependency get unresolved a throw: AttributeError: 'Provide' object has no attribute 'get_multi' and actually product_service is an instance of Provide not a ProductService as I need it.

@juanmarin96 juanmarin96 changed the title Dependency Injector stop work after update from 4.5.1 to 4.52 Dependency Injector stops work after upgrade from 4.5.1 to 4.52 Dec 5, 2020
@rmk135
Copy link
Member

rmk135 commented Dec 5, 2020

Hey @juanmarin96, I’m sorry I got it broken. Thanks for reporting the issue. I’m away from computer to debug now, but I’ll definitely take a look later today.

@rmk135 rmk135 self-assigned this Dec 5, 2020
@rmk135 rmk135 added the bug label Dec 5, 2020
@juanmarin96
Copy link
Author

@rmk135 Thanks for quickly answer!

rmk135 added a commit that referenced this issue Dec 6, 2020
@rmk135
Copy link
Member

rmk135 commented Dec 6, 2020

@juanmarin96 the issue is fixed in 4.5.3. Please, upgrade.

I'm sorry again about braking it. I've realised that there were no tests for FastAPI and added them. This will help to avoid such issues.

Thank you for reporting the issue.

@rmk135 rmk135 closed this as completed Dec 6, 2020
@juanmarin96
Copy link
Author

Thanks a lot for the fix !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants