Skip to content

ament_ruff#531

Draft
Nils-ChristianIseke wants to merge 1 commit intoament:rollingfrom
Nils-ChristianIseke:ament_ruff
Draft

ament_ruff#531
Nils-ChristianIseke wants to merge 1 commit intoament:rollingfrom
Nils-ChristianIseke:ament_ruff

Conversation

@Nils-ChristianIseke
Copy link
Copy Markdown
Contributor

@Nils-ChristianIseke Nils-ChristianIseke commented Mar 20, 2025

Note:
The code changes are currently preliminary and not yet finalized. I’m not seeking feedback on the implementation at this stage.

ament_ruff
I’m new to ament_lint, so I’m not fully aware of all the implications of adding a new tool. I wanted to use this as a starting point to settle the discussion on whether we should support Ruff. Feel free to get the discussion rolling before I invest much effort into it! :)

There has already been a discussion on this topic on ROS Discourse:
Recommended Way to Format Python Code

This PR aims to adds ament_ruff, a fast and modern Python linting and formatting tool, to ament_lint. Ruff combines the functionality of ament_flake8, ament-pydocstyle, ament_pyflakes, ament_pep257 into a single, high-performance tool, simplifying the toolchain and improving developer productivity.

Key Benefits:

  • Speed: Ruff is significantly faster than Flake8 and Black.
  • All-in-One: Combines linting and formatting in one tool.

Signed-off-by: Nils-Christian Iseke <nilsmailiseke@gmail.com>
@christophebedard
Copy link
Copy Markdown
Member

See this relevant issue: #497

@DangitBen
Copy link
Copy Markdown

Not trying to advertise, but there is now an ament_ruff package and accompanying cmake hook package (discourse post here). It could be used as a starting point for this PR, or as-is by users via source or pip (cli tool only).

The repo I linked could still use:

  • Some better error reporting to pytest
  • More testing and feedback from users with large python ros packages
    • Especially to see how it works as a drop-in for ament_flake8
  • A better/more confidence inspiring pypi page
  • A way to install the ament_cmake_ruff portion of the tool

Comment thread ament_ruff/package.xml
<author email=""></author>

<exec_depend>ament_lint</exec_depend>
<exec_depend>python3-ruff</exec_depend>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants