ZipFile

Results 41 comments of ZipFile

Thanks for contribution! Unfortunately, for the time being we want to be both backward- and forward-compatible with Pydantic, so closing this PR in favor of #832.

@sparky2708 > Why do I need to specify Provider[...]. If all are wired why not just auto-wire IRegisteredClass interface to the object that is registered in some container that implements...

[Nested containers](https://github.com/ets-labs/python-dependency-injector/issues?q=is%3Aissue%20state%3Aopen%20nested) is an area we can improve. In your particular case, proper incantation would be `database: PostgresDatabase = Provide[RootContainer.main_package.utils_package.database]`. But this is sub-optimal since it may lead to recursive...

> reading code the only way for now? Unfortunately, this. Also it is worth checking the issues page, people did figure out some common use cases not outlined in the...

> I felt like that is the default way to use DI. Wiring is a monkey-patch level of sorcery, which you rarely want in your code (for sanity reasons). Think...

> Well, your approach - having even your services wired up with their dependencies in the Container in my mind now makes your API layer dependent on injects, or on...

It's a bit tricky to cook DI for testing, but here's setup that works for me for non-unit tests: https://gist.github.com/ZipFile/7b9911c3f0c57c7d112725618a596464

The recommended way aged poorly, unfortunately. It also makes `mypy` complain, and rightfully so. From my experience, the best way to avoid such kind of issues, is to avoid having...

It doesn't, mypy is right here. There is no special attribute-checking logic in python-dependency-injector neither FastAPI has `container` attribute. More idiomatic way would be something like #683.