This Rust-based Python Linting Tool is Quick as Lightning

Marsh’s need to make Ruff was born out of his own frustrations with tools in the Python ecosystem

Code quality tools like linters and test frameworks are an important bit of the machine for developers. Linters play the part of keeping the code error free and ensure that it conforms to the rules implemented in the team. Conversely, when these tools are slow and sluggish, they can slow down development to a great degree. A new tool from this space called Ruff has been making noise in the community of late. 

Comparative study in speed between Ruff and other linting tools

Origin of Ruff

Charlie Marsh, a Khan Academy alum released the tool last year on August 30 but in the five months that have gone by, Ruff has gained a lot of ground. Marsh admits that Ruff’s sudden popularity has taken him by surprise, and that is why he called it ‘Ruff’ (rough). “I don’t consider it production-ready, it’s only a proof-of-concept,” he said on a thread posted on Hacker News

Last month, Marsh wrote a blog post discussing where he wanted to take Ruff in the future. ‘I meant to write this post after the first 100 releases, but now (v0.0.226) seems as good a time as any to recap the progress we’ve made over the last few months, and share more on where we’re headed,’ he stated. 

AIM Daily XO

Join our editors every weekday evening as they steer you through the most significant news of the day, introduce you to fresh perspectives, and provide unexpected moments of joy
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Need for speed in Python tools

Marsh’s need to make Ruff was born out of his own frustrations with tools in the Python ecosystem. JavaScript has been on the beneficial side as its tools have evolved and grown faster with time. Since projects have become heavier and more complicated, new packages emerged based on languages which were faster and consumed lesser energy. 

Marsh calls this the ‘Rustification’ of the JavaScript toolkit. A bunch of these new tools are all built on new programming languages like SWC and Rome are built on Rust, esbuild is built on Go and Bun is built on Zig. 


Download our Mobile App



And there’s good reason to have more Rust-based tools. Karthik Devaraj, a full-stack developer with MachineHack explains, “While Rust is an object-oriented language like C++, it combines less energy consumption with faster speed. Earlier, it used to take me around 21 seconds, but once I switched to the Rust-based SWC, it took me between 2 to 3 seconds.” 

Marsh felt that the Python environment too could gain from similar faster tools. Ruff has been found to be over 150X faster than Flake8, a popular Python lint wrapper; 75X faster than pycodestyle, the official linter to check Python for the PEP8 Python style; and 50X faster than pylint. 

Why is it popular?

Ruff now has become the primary linter for some of the most important Python-based projects like Pandas, FastAPI, Apache Airflow and Jupyter on GitHub even as it gets high praise from the community. 

A developer listed the advantages of Ruff – “I love Ruff. These are reasons it ended up being better than simply touching a ‘standard of excellence’. First off, it has a second-mover advantage. It has learned from all the existing tools. Secondly, it is deduplicated work which means it pretty much is a ‘do everything’ and does it all at once. (Using three separate linters meeting different needs would mean it parses through the code three times). And thirdly, Rust is faster than Python.” 

Just yesterday, Marsh tweeted the happy news that open-source platform Hugging Face had adopted Ruff already. Sayak Paul, a developer at the company spoke about the tool saying, “It’s bloody fast and actually takes actions instead of just plain erroring out that you didn’t use a particular import.” 

Sylvain Gugger, a senior ML engineer at the company, in fact, lauded Marsh saying, “Thank you so much for writing Ruff! With Transformers having so many files, you’re saving us a loooooot [sic] of time on formatting.” 

Marsh, however, has always been transparent about what he thinks are Ruff’s limitations, “It supports only a small set of rules till now and isn’t extensible in any way, it’s missing edge-case handling and is significantly under-tested compared to existing tools.” 

Since then Marsh has worked on improving the tool. There’s an official VS Code extension released to support Quick Fix actions to autofix lint errors, flake8-to-ruff which automates migration from Flake8 to Ruff as well as Conda and Homebrew distributions for easy installation of the tool.

Sign up for The Deep Learning Podcast

by Vijayalakshmi Anandan

The Deep Learning Curve is a technology-based podcast hosted by Vijayalakshmi Anandan - Video Presenter and Podcaster at Analytics India Magazine. This podcast is the narrator's journey of curiosity and discovery in the world of technology.

Poulomi Chatterjee
Poulomi is a Technology Journalist with Analytics India Magazine. Her fascination with tech and eagerness to dive into new areas led her to the dynamic world of AI and data analytics.

Our Upcoming Events

24th Mar, 2023 | Webinar
Women-in-Tech: Are you ready for the Techade

27-28th Apr, 2023 I Bangalore
Data Engineering Summit (DES) 2023

23 Jun, 2023 | Bangalore
MachineCon India 2023 [AI100 Awards]

21 Jul, 2023 | New York
MachineCon USA 2023 [AI100 Awards]

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
MOST POPULAR

Council Post: The Rise of Generative AI and Living Content

In this era of content, the use of technology, such as AI and data analytics, is becoming increasingly important as it can help content creators personalise their content, improve its quality, and reach their target audience with greater efficacy. AI writing has arrived and is here to stay. Once we overcome the initial need to cling to our conventional methods, we can begin to be more receptive to the tremendous opportunities that these technologies present.