Install & Compatibility
Where this runs
tested against v0.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
52MB installed
● package 52MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Config
✓ from pysen.pyproject_model import Config
For programmatic access to pysen's configuration model, typically used for advanced customization or plugins.
To get started with pysen, create a `pyproject.toml` (or `pysen.toml`) file in your project's root directory and define the `[tool.pysen]` section with your desired linting configurations. Then, run `pysen run lint` to check for issues or `pysen run format` to apply automatic fixes.
# 1. Create a pyproject.toml or pysen.toml file in your project root:
# pyproject.toml
# [tool.pysen]
# version = "0.11" # Specify the pysen configuration version
#
# [tool.pysen.lint]
# enable_black = true
# enable_flake8 = true
# enable_isort = true
# enable_mypy = true
# mypy_preset = "strict"
# line_length = 88
# py_version = "py310" # Adjust to your target Python version
#
# [[tool.pysen.lint.mypy_targets]]
# paths = ["."]
# 2. Run pysen from your terminal:
# To check for linting issues:
pysen run lint
# To automatically format code (where supported by linters like black, isort):
pysen run format
pysen --version
Debug
Known issues
gotchaPysen explicitly does not manage the versions of the underlying linting tools (e.g., black, mypy, flake8, isort). Users are expected to install and manage these dependencies separately using their preferred package manager (e.g., pipenv, poetry).fixEnsure you explicitly install and lock the versions of linters you use alongside pysen (e.g., `pip install black==X.Y.Z`).
affects: <=0.12.0
gotchaBy default, pysen only checks files that are tracked in Git. Files not under Git version control will be ignored.fixUse `git add` to stage the files you want pysen to check, or set the environment variable `PYSEN_IGNORE_GIT=1` to disable this behavior and check all files.
affects: <=0.12.0
gotchaMypy has its own mechanism for discovering files and does not honor the `tool.pysen.lint.source` option in `pyproject.toml` like other linters.fixFor Mypy, you must specify the target paths using `[[tool.pysen.lint.mypy_targets]]` and any exclusions with `tool.pysen.lint.mypy_exclude` directly within your configuration.
affects: <=0.12.0
gotchaMypy may report an error 'Source file found twice under different module names' if not configured correctly.fixEnsure file names are unique across sections by explicitly adding `tool.pysen.lint.mypy_targets` sections for different parts of your codebase.
affects: <=0.12.0
breakingPython 3.7 is no longer supported starting from pysen 0.12.0.fixUpgrade your Python environment to 3.10 or newer.
affects: 0.12.0 and later
breakingPysen 0.12.0 includes fixes for colons that violated new `configparser` rules introduced in Python 3.14. Older versions of pysen might break when run with Python 3.14.fixUpgrade pysen to version 0.12.0 or newer if using Python 3.14.
affects: Prior to 0.12.0 with Python 3.14
Upgrade
Version history
0.12.0latest on PyPI · released Dec 22, 2025
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer. Version 0.12.0 dropped support for Python 3.7 and added support for Python 3.12, with fixes for Python 3.14.
blackoptionalA code formatter, orchestrated by pysen. Users should manage its version.
flake8optionalA linter, orchestrated by pysen. Users should manage its version.
isortoptionalAn import sorter, orchestrated by pysen. Users should manage its version.
mypyoptionalA static type checker, orchestrated by pysen. Users should manage its version.