Closed Ignacio-Freire closed 3 weeks ago
@ItayTheDar Created PR that addresses this issue, let me know what you think
@Ignacio-Freire Hi!
I just saw your pr now and I'm super excited! I will go through it more deeply to see if there any side effects to this change, but overall seems perfectly fine, it is passes all the unit and integration tests. I must say that i can't say why i chose to assign the cls input to string. This was So thank you for drill down into the codebase and fix things from source. I'm sure that there are many other things to do to optimize pynest and make it follows best practices.
@Ignacio-Freire I've added 2 comment on the pr
@Ignacio-Freire I've added 2 comment on the pr
@ItayTheDar Addressed! Thank you!
@Ignacio-Freire feel free to merge the pr
@Ignacio-Freire feel free to merge the pr
@ItayTheDar Cannot merge it myself 😁
"Only those with write access to this repository can merge pull requests."
Ohhh 😧 So i will merge your pr, and this is another chance to thank you for noticed this broken logic and fix it. You are more than welcome to share your ideas and thoughts about PyNest, this is extremely helpful!
Code merge and is available in pynest 0.2.3 and greater! I'm closing this issue. Thanks!
Problem
When trying to use basic type checking (PyLance language server) with PyNest on custom injectable classes I keep getting the following warning:
The application still works as expected but this results in autocompletion not being able to work properly. This is becoming an issue when working even in the beginning of an app with already 5 modules.
Tested various approaches but ended up realizing that for some reason the
@dataclass
decorator is incompatible with the@Injectable
one. If I remove the latter (which of course defeats the porpoise of the lib) then PyLance recognizes the class as a type properly.One extra thing I noticed, which may or may not be related, is an argument error on the
@Injectable
decoractorSteps to Reproduce
1. Install Pynest and create app
2. Create empty environment and activate
3. Install requirements
4. Create example as shown on Blank Application Tutorial
4. Install latest version of PyLance extension for VSCode and add config
or add to
settings.json
Expected
The expected behavior is for the classes being properly recognized as Types as well as
@Injectable
decorator being properly recognized.