dry-python / returns

Make your functions return something meaningful, typed, and safe!
https://returns.rtfd.io
BSD 2-Clause "Simplified" License
3.5k stars 116 forks source link

Pylint hangs when running on a module that has type annotations from returns #792

Open dmrz opened 3 years ago

dmrz commented 3 years ago

I've noticed pylint is hanging (vscode's python plugin started to consume 100% CPU) when trying to lint a module that has type annotations from returns library.

Consider the following test.py:

from returns.maybe import Maybe, Some

x: Maybe[int] = Some(1)

Running pylint test.py will hang forever.

Not sure if the problem is with returns or pylint itself (or maybe something with my local setup, tried both with my regular pylint config and without it though). Didn't spend much time debugging it, but sometimes I noticed it hangs in astroid.decorators.raise_if_nothing_inferred generator. Does anyone experience the same?

python: 3.7.9, 3.9.0
pylint: 2.6.0
astroid: 2.4.2
returns: 0.15.0
sobolevn commented 3 years ago

Hi, @dmrz!

Hae you opened a bug in pylint? Can you please post a link here?

sobolevn commented 3 years ago

I am not a pylint user, I can shamelessy plug: https://github.com/wemake-services/wemake-python-styleguide

dmrz commented 3 years ago

Hi, @dmrz!

Hae you opened a bug in pylint? Can you please post a link here?

Hi! I didn't, since I am not sure yet what is the source of the problem, just was wondering if anyone experienced the same before. Not a pylint fan, but there're projects I work on that use it. I will check that WPS, thanks!

sobolevn commented 3 years ago

I am pretty sure that this is on pylint, bacause our annotations work with:

And since we use it to the max, possibly there's a regression in pylint's infering logic.

isratmir commented 2 years ago

Hi! Got same issue with pylint and Result, Success, Failure. Found that by commenting everywhere import and code. After that pylint runs faster.

sobolevn commented 2 years ago

Please, report this on pylints repo! And post an issue number here. 👍

I can help pylint's team, but there's nothing we can do from our side.

isratmir commented 2 years ago

Issue from pylint repo Very slow linting when using the dry-python/returns library #4750

bcb commented 1 year ago

Simply import returns.result hangs Pylint.

Edit: If left alone it does complete, after 1h 43m 30s