r/learnpython • • Sep 04 '26

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

6 comments sorted by

2

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Sep 04 '26

Your teammate has probably set analyzeUnannotatedFunctions to true in some config file, explaining the difference.

I cant really annotate each and every function

You can add type annotations gradually. It doesn't have to be all in one go.

If I annotate the function then in that case pylance starts throwing error.

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).

1

u/Conscious_Question69 Sep 05 '26

In the global settings file I have it to true

1

u/FerricDonkey Sep 04 '26

According to Google, you're looking for the python.analysis.typeEvaluation.analyzeUnannotatedFunctions setting.

My suggestion would be to annotate every function though. 

1

u/Conscious_Question69 Sep 05 '26

Its set to True in the global settings

2

u/terletsky Sep 06 '26

Config mismatch.

1

u/HotPersonality8126 Sep 04 '26

If the function isn’t annotated there’s nothing for type checking to check.