TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Even the Pylint codebase uses Ruff

164 点作者 thatxliner大约 2 年前

14 条评论

muglug大约 2 年前
Context: Ruff is a Rust-based linter for Python. It’s much faster than Python-based linters for Python because Rust is much faster than Python.<p>There are a couple of drawbacks to Ruff that mean it may not be right for everyone: since it’s a compiled tool, it’s harder to add custom rules — you need to fork the project to add your own, and also you need to know some Rust.<p>When checking the Pylint codebase it makes sense to use Ruff as well as Pylint — it’s a good sanity check that Pylint’s own tooling is not letting issues through that another tool is catching.
评论 #35037127 未加载
评论 #35040086 未加载
评论 #35038610 未加载
评论 #35037876 未加载
评论 #35040150 未加载
评论 #35038241 未加载
rtpg大约 2 年前
I had started writing a 1-for-1 Pylint port in Rust (almost nowhere right now), but Ruff has gotten there way faster. Props!<p>Pylint is rough to make faster, party from the existing structure, but honestly at one point you are just paying a huge cost for traversing wide ASTs and doing all this work, and then paying extra for the Python object model.<p>In my profiling of Pylint, I&#x27;ve found some fixes, and I am curious about what something like slots or mypyc could do to it... but I&#x27;m also very partial to just having a system language implementation.<p>People talk about ease of contributing as a big advantage for these kinds of tools to be written in the language they are working on. Personally I&#x27;ve found that people who like messing with tools like the idea of learning languages to contribute.<p>My one kind of reservation about Ruff is that the code base is designed as &quot;run each checker as its own function&quot;. My suspicion is that this leads to a performance ceilings as each checker is traversing the AST looking for its flavor of thing. Visitor patterns (theoretically!) allow for us to run checkers in parallel nicely. Granted the Ruff pattern allows for parallel work as well (and you can share all of the AST data between threads anyways), so maybe its &quot;right&quot;. It definitely looks easier to maintain!
评论 #35039106 未加载
Rauchg大约 2 年前
Very excited to see the Rust-ification of Python tooling, similar to what we’re seeing in the JavaScript[1] tooling ecosystem.<p>[1] <a href="https:&#x2F;&#x2F;leerob.io&#x2F;blog&#x2F;rust" rel="nofollow">https:&#x2F;&#x2F;leerob.io&#x2F;blog&#x2F;rust</a>
评论 #35038949 未加载
评论 #35037534 未加载
评论 #35038789 未加载
zzzeek大约 2 年前
just tried it and this is immensely fast.<p>too bad it doesn&#x27;t appear to support flake8 plugins and only has a small subset hardcoded into it. if it could support arbitrary flake8 plugins I would move SQLAlchemy to this tool immediately.<p>the main reason people want to move off flake8 is not so much a speed issue but that its author refuses to allow it to use pyproject.toml files for configuration, meaning every project&#x27;s configuration has to remain half-broken using obsolete setup.cfg files. A very silly situation.
评论 #35037045 未加载
评论 #35037936 未加载
评论 #35036823 未加载
评论 #35037286 未加载
AgentOrange1234大约 2 年前
As a member of the uninitiated, it would be great if these kind of posts could include some context on what Ruff is and why this is significant?
评论 #35036885 未加载
评论 #35038161 未加载
评论 #35036686 未加载
mkl大约 2 年前
Ruff is another Python linter, written in Rust. <a href="https:&#x2F;&#x2F;github.com&#x2F;charliermarsh&#x2F;ruff">https:&#x2F;&#x2F;github.com&#x2F;charliermarsh&#x2F;ruff</a>
评论 #35036778 未加载
SuperSandro2000大约 2 年前
See <a href="https:&#x2F;&#x2F;github.com&#x2F;charliermarsh&#x2F;ruff&#x2F;issues&#x2F;970">https:&#x2F;&#x2F;github.com&#x2F;charliermarsh&#x2F;ruff&#x2F;issues&#x2F;970</a> for a comparison between pylint and ruff
评论 #35040519 未加载
galoisscobi大约 2 年前
I was excited to start using Ruff however it has quite a few ruff edges for me to use professionally. Back to pylint for now, but looking forward to adopting it once it&#x27;s ready. The difference in speed was night and day.<p>Another feature I hope to see in Ruff is to &quot;score&quot; the code. With pylint, I can have a CI rule to make the lint check pass if it scores 8&#x2F;10 or above, or even a lower score so that co-workers who resent using linters can start using them.
peefy大约 2 年前
I&#x27;m glad to see the organic combination of Python and Rust. My personal interesting experience is to rewrite a Python project using Rust [1], which has increased the speed by 40 times. Then the original Python project and the rewritten Rust code are organically combined through PyO3, which is very good. We have not only achieved performance, but also achieved ease of use and scalability. Just like PyLint and Ruff.<p>[1] We Rewrote Our Project With Rust… and It’s Almost 40X Faster. <a href="https:&#x2F;&#x2F;medium.com&#x2F;better-programming&#x2F;40x-faster-we-rewrote-our-project-with-rust-120b006c6abe" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;better-programming&#x2F;40x-faster-we-rewrote-...</a>
brigandish大约 2 年前
I clicked through, did a search for Ruff, then looked up the Github project. Okay, but… so what? Is this another case of &quot;I rebuilt X in Rust and hit the front page of HN&quot;?<p>It seems so.
评论 #35037142 未加载
评论 #35036817 未加载
BiteCode_dev大约 2 年前
Is ruff a good replacement for pylint yet ? It replaces flake8 well but since I use black and pylint, I don&#x27;t need flake8. However, pylint does a lot so if it does replace it, even without plugins, that would be amazing.
评论 #35038736 未加载
theusus大约 2 年前
I have the best experience with Pylance. And I am talking about editor extensions.
asah大约 2 年前
I wonder if ChatGPT could be used to port more rules from pylint to ruff ?
评论 #35041507 未加载
andrewshadura大约 2 年前
Does Ruff support configuration in setup.cfg?