Recommended way to format python code?

I’ve made a tool that might help some people on this thread or anyone who wanders here:

ament_ruff is ruff with ament integration.

Some highlights:

  • I tried my best to adjust the included ruff.toml file so that it can work with the configuration set in ament_flake8, but I’m sure I’ve missed a couple things that my code base doesn’t trigger.
  • ruff may have added some import sorting configuration since some of the discussion here, so I’ve tried to make that match the google import style as well.
  • Like other ament_lint tools, it supports cli and cmake interfaces. The cli allows for error-checking and automatic reformatting (if ruff can fix the issue safely)
2 Likes

@bandrew-swri this probably deserves its own Discourse post.

2 Likes