Skip to content

Replace flake8 and isort with ruff, and introduce ruff formatter#3395

Merged
dlstadther merged 11 commits intospotify:masterfrom
kitagry:add-ruff
Feb 22, 2026
Merged

Replace flake8 and isort with ruff, and introduce ruff formatter#3395
dlstadther merged 11 commits intospotify:masterfrom
kitagry:add-ruff

Conversation

@kitagry
Copy link
Contributor

@kitagry kitagry commented Feb 21, 2026

Description

Replace flake8 and isort with ruff, which handles linting, import sorting, and formatting in a single fast tool.

Previously the project had no formatter configured. This PR also introduces ruff format to establish a consistent code style.

Changes:

  • Add [tool.ruff] configuration to pyproject.toml (line-length=160, E/F/W/I rules)
  • Replace [testenv:flake8] and [testenv:isort] with [testenv:ruff] in tox.ini
  • Remove [flake8] section from tox.ini
  • Update GitHub Actions workflow to use ruff instead of flake8
  • Fix Python 2 unicode builtin usage in salesforce.py (→ str)
  • Apply ruff check --fix and ruff format across the codebase

Motivation and Context

flake8 and isort are maintained separately and require separate configuration. ruff replaces both with a single tool that is significantly faster and already listed in the lint dependency group. Adding a formatter also removes ambiguity around code style.

Have you tested this? If so, how?

uvx ruff check . and uvx ruff format --check . both pass with no errors.

Note for reviewers: The commits chore: apply ruff check --fix auto-fixes and chore: apply ruff format are fully automated changes with no manual edits. You can safely skip reviewing those and focus on the configuration and manual fix commits.

Optional: If you prefer single quotes (') over double quotes ("), ruff can enforce that by adding quote-style = "single" to [tool.ruff.format] in pyproject.toml. Happy to add it if there's a preference.

@kitagry kitagry requested review from a team and dlstadther as code owners February 21, 2026 06:32
- Add [tool.ruff] config to pyproject.toml (line-length=160, E/F/W/I rules)
- Replace [testenv:flake8] and [testenv:isort] with [testenv:ruff]
- Remove [flake8] section from tox.ini
- isort is now handled by ruff's I ruleset
Fix 209 issues automatically including E713 (not in), I001 (import sorting),
and other pycodestyle/pyflakes violations.
unicode does not exist in Python 3; str is the correct type.
Reformat 239 files to match ruff's code style.
@kitagry kitagry marked this pull request as draft February 21, 2026 06:38
@kitagry kitagry marked this pull request as ready for review February 21, 2026 07:59
Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

I'm a big fan of ruff (vs the combination of flake8/isort/black). The first PR to apply the lint and format rules to a repo that otherwise hasn't had them is hard to review, so thank you very much for separating the auto-applied commits from the manual fixes!

@kitagry kitagry requested a review from dlstadther February 21, 2026 13:06
@dlstadther dlstadther merged commit 8f9030d into spotify:master Feb 22, 2026
49 checks passed
@kitagry kitagry deleted the add-ruff branch February 22, 2026 02:24
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