langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Clean up code and format with PyLint

Open MarkusSagen opened this issue 2 years ago • 5 comments

MarkusSagen avatar Apr 26 '23 07:04 MarkusSagen

Hi, @MarkusSagen. Is pylint better than mypy?

We have a github workflow that runs mypy.

ogabrielluiz avatar Apr 26 '23 15:04 ogabrielluiz

Hi @ogabrielluiz

Good question, mypy and pylint serve complementary purposes

mypy is used to ensure that the type hints are correct

pylint will ensure that the quality of the code is correct, check that the code conforms to PEP8. pylint allows one to catch things like:

  • If a variable is defined in a global scope with a name as a local variable
  • If we do unneeded calls to the inherited classes methods when it is not needed, or if we are overriding a classes method when it is not needed, etc

If it would be of interest, I think this blog post is a fairly good explanation on their respective differences: https://lynn-kwong.medium.com/use-black-mypy-and-pylint-to-make-your-python-code-more-professional-b594512f4362

MarkusSagen avatar Apr 26 '23 15:04 MarkusSagen

Sure thing! 👍

MarkusSagen avatar Apr 27 '23 16:04 MarkusSagen

why not use ruff instead?

ngmisl avatar Apr 28 '23 13:04 ngmisl

@ngmisl We are. It looks like they do the same things, is that correct?

ogabrielluiz avatar Apr 28 '23 13:04 ogabrielluiz

@ngmisl We are. It looks like they do the same things, is that correct?

Yes it is. In fact, ruff is rust based and supposed to be a lot faster than pylint: https://github.com/charliermarsh/ruff#ruff

deshetti avatar May 04 '23 21:05 deshetti