8000 Add Ruff formatter integration with Apheleia for Python by ruahman · Pull Request #1 · ruahman/emacs · GitHub
[go: up one dir, main page]

Skip to content

Add Ruff formatter integration with Apheleia for Python - #1

Open
ruahman wants to merge 1 commit into
mainfrom
claude/dazzling-knuth-yu40if
Open

ruahman wants to merge 1 commit into
mainfrom
claude/dazzling-knuth-yu40if

Conversation

@ruahman
@ruahman ruahman commented Sep 21, 2026
Copy link
Copy Markdown
Owner

Summary

Integrate Ruff code formatter with Apheleia to automatically format Python files on save using both import sorting (ruff-isort) and code formatting (ruff).

Changes

  • Configure Apheleia with custom Ruff formatters:
    • ruff-isort: Runs ruff check --fix with import sorting rules
    • ruff: Runs ruff format for general code formatting
  • Set Python mode to use both formatters in sequence (import sorting followed by formatting)
  • Enable Apheleia mode automatically when entering Python mode
  • Add apheleia to the list of installed packages

Implementation Details

The configuration uses Apheleia's formatter customization to define two separate Ruff invocations:

  • Import sorting is handled via ruff check --fix --select I (I = isort rules)
  • Code formatting is handled via ruff format
  • Both formatters read from stdin and write to stdout, with filepath passed for context
  • The formatters are applied in order when Python files are saved

https://claude.ai/code/session_01JTBs5h4WwJTRibE7rqZMVw

Adds apheleia and wires python-mode to run ruff check --fix
(import sorting) then ruff format on every save, independent of
the existing eglot LSP setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTBs5h4WwJTRibE7rqZMVw
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

0