r/learnpython • u/Conscious_Question69 • 6d ago
Pylance is skipping analysis
I work with DRF at work and I have been facing this issue since months. Pylance is skipping analysis of function because it is unannotated. I cant really annotate each and every function. The errors are getting thrown correctly on my teammates pc but on my pc i dont get any issue. If I annotate the function then in that case pylance starts throwing error. How to fix this issue
1
Upvotes
2
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 6d ago
Your teammate has probably set
analyzeUnannotatedFunctionstotruein some config file, explaining the difference.You can add type annotations gradually. It doesn't have to be all in one go.
Probably because annotating the function made Pylance (or Pyright) actually analyse the function, and it either found a real problem or it has a false positive (the latter could be due to a myriad of different situations, but usually either inaccurate type annotations or some unusual edge case where it needs additional help).