MITB Banner

Ruff Emerges as the Fastest-Growing Python Linter Ever

Created by Charlie Marsh, Ruff is also taking the Python community by storm with its speed and features.

Share

Illustration by Nikhil Kumar

Listen to this story

Ruff, a Python linter written in Rust, has taken the Python community by storm with its blazing fast performance and comprehensive feature set. 

The project, created by Charlie Marsh in 2022, recently hit a major milestone with over 400 contributors on GitHub. Marsh also said on X, “Just got confirmation that an >8M LoC codebase successfully migrated to ruff format” Compared to the linters like Flake8, Pylint or Black, Ruff is extremely fast and accurate and is quickly adopted by the community.

Linters are essential tools for any programming language, helping developers catch potential errors, enforce coding standards, and maintain a consistent style across large codebases. In the Python ecosystem, popular linters like Flake8, Pylint, and Black have been widely used for years. However, these tools often come with performance trade-offs, especially when dealing with large projects.

Ruff, on the other hand, is surprisingly quick compared to the others while also integrating more functionality into a single, unified interface. By leveraging the speed and safety of Rust, Ruff is able to analyse and format code at an astonishing pace. 

In benchmarks, Ruff has proven to be 10-100x faster than tools like Flake8 and Black, making it a game-changer for developers working on large codebases.

Time scale of Ruff compared with other linters

Debugging at Lightning Speed

One of the key factors contributing to Ruff’s speed is its built-in caching mechanism, which avoids re-analysing unchanged files. This, combined with its highly optimised Rust implementation, allows Ruff to blaze through even the most massive codebases in a matter of seconds. Rust is already known for its speed and memory efficiency, making it an ideal choice for performance-critical applications like linters. 

As Nick Schrock, founder of Elementl and co-creator of GraphQL, noted, “On our largest module pylint takes about 2.5 minutes, parallelised across 4 cores on my M1. Running ruff against our entire codebase takes .4 seconds.”

Ruff’s speed is not its only selling point, however. The tool boasts an impressive array of features, including over 700 built-in rules, native re-implementations of popular Flake8 plugins, and drop-in parity with tools like isort and Black. This means that developers can replace multiple linters and formatters with Ruff, simplifying their development workflows and reducing the overall complexity of their toolchains. 

The Python community has been quick to embrace Ruff, with many high-profile projects like Apache Airflow, FastAPI, Hugging Face, Pandas, and SciPy already adopting it. Users have expressed disbelief at how quickly it can analyse their code. Sebastián Ramírez, creator of FastAPI, quipped, “Ruff is so fast that sometimes I add an intentional bug in the code just to confirm it’s actually running and checking the code.”

Perhaps the most surprising endorsement of Ruff comes from the Pylint project itself. In a recent development, even the Pylint, codebase has begun using Ruff for linting, a testament to the tool’s growing popularity and effectiveness.

The Inception 

Charlie Marsh was motivated to build Ruff to solve his own issues with coding, “it’s the tooling I wish I’d had,” he said in an interview. Marsh’s ultimate goal is to create an integrated toolchain that includes not only a linter but also an auto formatter and potentially a type checker. By bundling these functionalities together, Ruff would provide a more powerful and efficient solution for Python developers.

Despite the challenges of building a new tool and learning Rust, Marsh stayed committed and even announced his new company, Astral, which will continue developing Ruff and other high-performance Python tools.

“To me, the community’s response to Ruff is itself evidence of an opportunity to make the Python ecosystem more productive by building great tools. Astral exists to meet that opportunity.”

Marsh said his ultimate goal is an integrated toolchain that includes not just a linter, but also an auto formatter and possibly a type checker. By combining these tools, Ruff aims to provide an even more powerful and efficient solution for Python developers.

As Ruff continues to evolve and grow, it is set to change how Python developers work. With its speed, features, and community support, Ruff is on track to become the standard for Python linting and formatting. 

Share
Picture of K L Krithika

K L Krithika

K L Krithika is a tech journalist at AIM. Apart from writing tech news, she enjoys reading sci-fi and pondering the impossible technologies, trying not to confuse it with reality.
Related Posts

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

Upcoming Large format Conference

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Courses & Careers

Become a Certified Generative AI Engineer

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India

Subscribe to Our Newsletter

The Belamy, our weekly Newsletter is a rage. Just enter your email below.