maldoinc / wireup

Performant, concise, and easy-to-use dependency injection container for Python 3.8+.
https://maldoinc.github.io/wireup/
MIT License
97 stars 2 forks source link

FastAPI integration raises deprecation warning #24

Closed brnosouza closed 5 months ago

brnosouza commented 5 months ago

A deprecation warning is being raised when calling the FastApi integration.

PATH/lib/python3.12/site-packages/wireup/integration/fastapi_integration.py:34: UserWarning: Using warmup_container is deprecated. Use 'initialize_container' instead
  warmup_container(dependency_container, service_modules or [])
maldoinc commented 5 months ago

Version 0.8 includes some deprecations. Among them the one you listed. Existing code will continue to work as expected.

You should be able to just replace in your code the warmup_container call with initialize_container. Same thing for Wire which has been replaced in favor of Inject.

Docs getting started page has some more info on the new recommended functions to use.

brnosouza commented 5 months ago

@maldoinc This warning is coming from the integration code directly inside the library because it is still using the old warmup_container function there: https://github.com/maldoinc/wireup/blob/master/wireup/integration/fastapi_integration.py#L34

maldoinc commented 5 months ago

Right! That's on me then, missed the trace filename :)

Fixed in b6706160, thanks for flagging.