Skip to content

Conversation

@akx
Copy link
Contributor

@akx akx commented Feb 24, 2024

This PR:

  • upgrades Ruff and fixes pyproject.toml's keys so Ruff doesn't warn about them
  • configures the line-length to 119; the default for Ruff (from Black) is 88, which is pretty narrow for modern terminals.
    • Across all projects I happen to have checked out locally, the median configured line-length is 119:
      $ ag line-length */*.{cfg,toml} | cut -f2 -d= | grep -oE '\d+' | datamash -H count 1 median 1 mean 1
      count(88)	median(88)	mean(88)
      193	119	118.35751295337
      
  • runs Ruff formatting as a separate commit that's attributed to Ruff only.
    • The second commit should not need to be reviewed very meticulously, since it is purely mechanical.
    • However, the method to get there might be of interest:
      1. ruff --select=COM818,COM819 --fix . to remove trailing commas from expressions that would otherwise trigger the formatter's magic comma newlining
      2. ruff format . to format everything
      3. ruff --select=COM --fix . to add trailing commas to multi-line parameter lists, etc.
      4. ruff format . once more to ensure the added trailing commas are up to spec

Important

This PR should be merged with a regular merge, not a squash, so the reformatting commit can be added to .git-blame-ignore-revs.

@github-actions
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@akx akx force-pushed the ruff-format branch 3 times, most recently from 0f51b78 to da953a2 Compare March 13, 2024 14:08
@akx akx marked this pull request as ready for review March 13, 2024 14:15
@Titus-von-Koeller Titus-von-Koeller merged commit 06029dd into bitsandbytes-foundation:main Mar 13, 2024
@akx akx deleted the ruff-format branch March 13, 2024 14:35
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.

2 participants