This guide helps you migrate from the old python-mode linting configuration (using pylint, pyflakes, pycodestyle, etc.) to the new Ruff-based system.
Python-mode now uses Ruff instead of multiple separate linting tools. Ruff is:
- 10-100x faster than the old tools
- Single unified tool replacing pyflakes, pycodestyle, mccabe, pylint, pydocstyle, autopep8
- Backward compatible - your existing configuration is automatically mapped to Ruff rules
pip install ruffVerify installation:
ruff --versionThe good news: You don't need to change anything immediately. Your existing g:pymode_lint_* options are automatically mapped to Ruff rules.
For example:
" Your old configuration still works!
let g:pymode_lint_checkers = ['pyflakes', 'pycodestyle', 'mccabe']
let g:pymode_lint_ignore = ["E501", "W"]This is automatically converted to equivalent Ruff rules.
For better control and performance, you can migrate to Ruff-specific options:
" Enable Ruff linting and formatting
let g:pymode_ruff_enabled = 1
let g:pymode_ruff_format_enabled = 1
" Ruff-specific ignore rules (takes precedence over g:pymode_lint_ignore)
let g:pymode_ruff_ignore = ["E501", "W"]
" Ruff-specific select rules (takes precedence over g:pymode_lint_select)
let g:pymode_ruff_select = []
" Optional: Specify Ruff config file
let g:pymode_ruff_config_file = ""Note: Rule codes are mostly compatible. See RUFF_CONFIGURATION_MAPPING.md for detailed mappings.
Ruff supports configuration via pyproject.toml or ruff.toml:
pyproject.toml:
[tool.ruff]
line-length = 88
select = ["E", "F", "W"]
ignore = ["E501"]
[tool.ruff.lint]
select = ["E", "F", "W"]
ignore = ["E501"]ruff.toml:
line-length = 88
select = ["E", "F", "W"]
ignore = ["E501"]Python-mode will automatically use these files if they exist in your project root.
Python-mode now supports flexible configuration precedence via g:pymode_ruff_config_mode:
Default Behavior ("local_override"):
- If your project has a local
ruff.tomlorpyproject.tomlwith[tool.ruff]section, it will be used - If no local config exists, python-mode settings serve as fallback
- This ensures project-specific configs are respected while providing defaults
Using Only Local Config ("local"):
let g:pymode_ruff_config_mode = "local"Use this when you want python-mode to completely respect your project's Ruff configuration and ignore all python-mode settings.
Using Only Global Config ("global"):
let g:pymode_ruff_config_mode = "global"Use this to restore the previous behavior where python-mode settings always override local configs. Local config files will be ignored.
Note: The default "local_override" mode is recommended for most users as it respects project standards while providing sensible defaults.
pip install ruff
ruff --versionYour existing configuration should work immediately. Try:
:PymodeLint " Should work with Ruff
:PymodeLintAuto " Should format with RuffCreate pyproject.toml or ruff.toml in your project root:
[tool.ruff]
line-length = 88
select = ["E", "F", "W"]
ignore = ["E501"]Update your .vimrc:
" Old way (still works)
let g:pymode_lint_checkers = ['pyflakes', 'pycodestyle']
let g:pymode_lint_ignore = ["E501"]
" New way (recommended)
let g:pymode_ruff_enabled = 1
let g:pymode_ruff_format_enabled = 1
let g:pymode_ruff_ignore = ["E501"]Before:
let g:pymode_lint_checkers = ['pyflakes', 'pycodestyle']
let g:pymode_lint_ignore = ["E501"]After (automatic):
- Works immediately, no changes needed!
After (Ruff-specific):
let g:pymode_ruff_enabled = 1
let g:pymode_ruff_ignore = ["E501"]
" Ruff automatically includes F (pyflakes) and E/W (pycodestyle) rulesBefore:
" autopep8 was used automatically by :PymodeLintAutoAfter:
let g:pymode_ruff_format_enabled = 1
" :PymodeLintAuto now uses Ruff format (faster!)Before:
let g:pymode_lint_checkers = ['pylint']
let g:pymode_lint_options_pylint = {'max-line-length': 100}After:
let g:pymode_ruff_enabled = 1
" Use pyproject.toml for Ruff configuration:
" [tool.ruff]
" line-length = 100
" select = ["PLE", "PLR", "PLW"] # pylint rulesError: ruff: command not found
Solution:
pip install ruff
# Verify:
ruff --versionIssue: Ruff formats code differently than autopep8
Solution: This is expected. Ruff follows PEP 8 and Black formatting style. If you need specific formatting, configure Ruff via pyproject.toml:
[tool.ruff.format]
quote-style = "double"
indent-style = "space"Issue: Some rule codes might differ between old tools and Ruff
Solution: See RUFF_CONFIGURATION_MAPPING.md for detailed rule mappings. Most common rules (E501, F401, etc.) are compatible.
Issue: Linting seems slower than expected
Solution:
- Ensure Ruff is installed:
pip install ruff - Check if legacy options are causing overhead (migrate to Ruff-specific options)
- Verify Ruff config file is being used
The following tools are no longer available as separate checkers:
pylint(use Ruff PLE/PLR/PLW rules)pyflakes(use Ruff F rules)pycodestyle(use Ruff E/W rules)mccabe(use Ruff C90 rules)pep257(use Ruff D rules)autopep8(use Ruff format)
g:pymode_lint_checkersvalues are mapped to Ruff rules (not actual tools)g:pymode_lint_options_*are mapped to Ruff configuration- Old tool-specific options may not have exact equivalents
- Formatting: Ruff format may produce slightly different output than autopep8
- Linting: Ruff may report different errors than pylint/pyflakes (usually fewer false positives)
- Performance: Should be significantly faster
If you need to rollback to the old system:
-
Checkout previous version:
git checkout <previous-version-tag>
-
Reinstall old dependencies (if needed):
pip install pylint pyflakes pycodestyle mccabe pydocstyle autopep8
-
Restore old configuration in your
.vimrc
Note: The old tools are no longer maintained as submodules. You'll need to install them separately if rolling back.
- Configuration mapping: See
RUFF_CONFIGURATION_MAPPING.md - Ruff documentation: https://docs.astral.sh/ruff/
- Ruff rules: https://docs.astral.sh/ruff/rules/
- Python-mode help:
:help pymode-ruff-configuration
✅ No immediate action required - your existing config works
✅ Install Ruff: pip install ruff
✅ Optional: Migrate to Ruff-specific options for better control
✅ Use Ruff config files: pyproject.toml or ruff.toml for project-specific settings
✅ Enjoy faster linting and formatting!
