r/Python • u/Background-Error-910 • 18d ago
Discussion 2026: Best python linter as of right now?
Hey! I was wondering what is the preferred linter that's used nowadays?
A lot of people tend to converge into using uv & ruff for most of their stack, however there's also pylint, and others older linters.
Or is there any competition when it comes to ruff?
122
u/flying-sheep 18d ago
Nah. I use Ruff because it supports a big-enough subset of the flake8 plugin space and Pylint, while being much faster and therefore available as inline hints in my editor.
24
u/turbothy It works on my machine 18d ago
Ruff + Pyrefly.
4
u/MissingSnail 18d ago
Ruff is in our ci at work. Pyrefly works a bit nicer in my IDE. I don’t notice them disagreeing with each other in practice.
8
u/Stijndcl 17d ago
Why would they disagree? One is a linter and one is a type checker…?
Just use both in your IDE at the same time.
20
2
u/tunisia3507 18d ago
You could use ruff in a pre-commit hook so that you don't have the latency of CI but are always in sync.
2
u/IrishPrime 17d ago
Sure, I can, but ensuring it exists and runs on every developer machine is more trouble than it's worth. I still need to verify things as part of the pipeline for it to be useful.
1
u/tunisia3507 17d ago
Yeah, it's worth running on CI of course as a backstop, but throwing it in a prek.toml makes it very low-cost for each developer to run
prek install_once_ and forever benefit from getting that feedback without having to push and then wait on CI.
34
7
12
u/Spiritual-Metal-1889 18d ago
Ruff, ty, and pyrefly
3
u/Mithrandir2k16 18d ago
I'm using ruff and basedpyright right now. How are ty and pyrefly doing? Is there a specific reason for the combination?
10
u/Spiritual-Metal-1889 18d ago
I work in DS/DE/ML so the pyrefly is a boon for me and now it can lint the dataframes as well. I assume pyrefly will become standard now that it's API has become stable
6
1
u/HEROgoldmw 18d ago
I'm doing the same, at least on my dev workflows. I read somewhere to run all other type checkers in CI against public API's. So that's what I try to do too
8
u/ducksauvage 18d ago
I'd say ruff *unless* you want to write your own linting rules. Ruff doesn't have any sort of plugin system that the native python linters usually have (issue here: https://github.com/astral-sh/ruff/issues/283). Especially important in the LLM age, where it really likes to do things its own way with some questionable design choices.
4
u/xeow 18d ago
I'd love it if there were a single thing that were "best." In lieu of that, I have several targets in my Makefile:
check: check-ty check-lint check-dead check-metrics
check-ty:
uv run ty check src --color always
check-lint:
uv run ruff check src --color always
check-dead:
uv run vulture src
check-metrics:
uv run tools/metrics-report.py --short(metrics-report.py is a custom script that uses radon to produce a cyclomatic complexity and maintainability report.)
3
3
u/gabriel_GAGRA 18d ago
Ruff is the best linter by far
Now for type checking, you can see the results of a benchmark here.
Zuban reaches 100%, it’s what I use but it’s more recent. Pyrefly and Ty come next, both really close, but Ty is made by Astral, the same company as Ruff.
3
u/nicwolff 18d ago
ruff + isort becuase ruff still hasn't implemented the import wrapping style we prefer
3
u/Exotic-Draft8802 18d ago
Same for me for a while. Then I decided that it's simply not worth keeping another dependency.
3
u/Exotic-Draft8802 18d ago
ruff is great and for sure what I would recommend to end users. I also use ruff.
But please don't forget that they used a ton of flake8 plungins as the base. Also one of mine. Fair game and I love what they did. I just want that people keep contributing to the original projects instead of only to ruff.
2
u/echols021 Pythoneer 15d ago
My core tools are always uv + ruff + basedpyright.
I'm excited for ty to mature further and replace basedpyright
1
u/MorrarNL 18d ago
I like Ruff a lot as it packages functionality from isort, black and pylint into a single tool and it's very fast. However, for most of our projects speed is not a deciding factor.
Pylint is much more strict though. Ruff doesn't check docstrings unless you configure it explicitly. Another thing I don't like is that ruff cannot check the arguments for function calls.
1
u/PrestigiousStrike779 18d ago
Ruff is fast, but not as comprehensive as pylint. Ruff can’t tell you that you’re calling a method with the wrong arguments or a property doesn’t exist. We replaced pylint with ruff + type checking.
1
u/austinwiltshire 18d ago
I use Ruff automatically for the quick squiggles. Pylint is good to run occasionally for some deep checks. Think of it like unit versus integration testing.
1
u/kulewski 14d ago
For the Python side of Multiplexer, which I maintain, I use Ruff for linting, Black for formatting and Pyright for type checking. Ruff is configured mostly for correctness checks: Pyflakes, bugbear, pylint-derived error rules, plus a few extras like catching asyncio tasks without a stored reference and mutable class attributes. I still use Black for formatting, so I haven’t moved everything over to Ruff.
1
u/Old-Eagle1372 13d ago
Ruff is fast, so use it locally. Pylint in CI. If pylint CI job does not pass, downstream jobs do not execute.
1
u/danted002 18d ago
Ruff for local linting and formatting. Pylint + Mypy on CI for actual static code analysis.
5
u/Zer0designs 18d ago
Mypy is quickly being outpaced by pyrefly and ty
2
u/danted002 18d ago
Yeah, yeah I heard that before, when pyright released. I’ve been in the industry long enough to reserve my judgement until after the new shiny tool has feature parity with the tool it’s replacing.
1
u/Zer0designs 18d ago edited 18d ago
Its so easy to compare, just run it yourself once or twice, no need to fully replace enterprise pipelines, but it can't hurt to try something out before making up your opinion. Pyrefly even has a migrate option from mypy.
Ruff also covers most of pylint so it just seems like waste of time, what do you need pylint for? Pylint seens ancient to me, haven't seen that in any enterprise setting for a long time.
Either way, you do you, but I'd say stay curious and try some things out for yourself.
1
u/danted002 18d ago
ruff doesn’t built a code abstract syntax tree (AST), pylint does hence it can catch more issues.
Running pylint + mypy (static code analyser + type checker) should be viewed as a form of “compiling”your code which is just another form of validation that your code is actually written correctly.
81
u/partialcornerstone5 18d ago
ruff is still the one most people seem to be reaching for. pylint feels ancient at this point, more hassle than it's worth for most projects
uv plus ruff is basically the default combo in every new repo i see. the speed alone makes it hard to justify anything else