pysen-plugins

raw JSON →
2025.12.3 verified Fri May 01 auth: no python

A collection of plugins for pysen, a Python code formatter and linter orchestrator. Version 2025.12.3 supports Python >=3.8. Plugins include import sorter, formatter wrappers (black, isort, autoflake), and lint plugin helpers. Released on a monthly cadence tied to pysen releases.

pip install pysen-plugins
error ModuleNotFoundError: No module named 'pysen_plugins'
cause pysen-plugins is not installed or the Python environment is incorrect.
fix
Run: pip install pysen-plugins
error ImportError: cannot import name 'ImportSortPlugin' from 'pysen_plugins'
cause Importing directly from the top-level package instead of the submodule (changed in 2025.12.0).
fix
Use: from pysen_plugins.import_sort import ImportSortPlugin
error TypeError: 'Plugin' object is not callable
cause Attempting to call a plugin instance instead of using it in settings.
fix
Pass the plugin to LintSetting or FormatSetting, e.g., LintSetting(..., plugin=my_plugin).
breaking Version 2025.12.0 changed the import path for ImportSortPlugin from pysen_plugins.import_sort_plugin to pysen_plugins.import_sort.
fix Update imports to use pysen_plugins.import_sort.ImportSortPlugin.
deprecated Direct import from pysen_plugins (e.g., from pysen_plugins import ImportSortPlugin) is deprecated in favor of submodule imports.
fix Use from pysen_plugins.import_sort import ImportSortPlugin.
gotcha Plugin configuration requires explicit use of LintSetting/FormatSetting with the plugin instance; omitting the plugin argument silently does nothing.
fix Always pass plugin=<instance> when creating settings.

Basic configuration of pysen-plugins for formatting with black and isort.

from pysen import Plugin, LintSetting, FormatSetting
from pysen_plugins.black import BlackPlugin
from pysen_plugins.isort import IsortPlugin
from pysen_plugins.import_sort import ImportSortPlugin

# Create plugins for a pysen project
black_plugin = BlackPlugin()
isort_plugin = IsortPlugin()
import_sort_plugin = ImportSortPlugin()

# Configure pysen settings (simplified)
settings = Plugin.create_settings(
    base_dir=".",
    lint_settings=[LintSetting(name="black", plugin=black_plugin)],
    format_settings=[FormatSetting(name="isort", plugin=isort_plugin)],
)
print("Plugins configured successfully")