Registry / testing / pysen
library0.12.0pypypiunverified

Pysen is a Python library designed to simplify code linting and formatting by centralizing the configuration and orchestration of various tools like Black, Flake8, Isort, and Mypy. It aims to provide a unified platform for maintaining consistent coding styles across projects, reducing the burden of managing individual linter configurations. Developed by Preferred Networks, it is actively maintained with regular releases.

pip install "pysen[lint]"
INSTALL
IMPORT
SIG · PYSEN
P
pysen
testingpythonv0.12.0
Install
4.2s avg
Import
830ms
Disk
52MB
Pass rate
1/ 10
Env Coverage1 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
musl
glibc
py 3.10
4/8 runs
4/8 runs
py 3.11
4/8 runs
4/8 runs
py 3.12
4/8 runs
4/8 runs
py 3.13
4/8 runs
4/8 runs
py 3.9
4/8 runs
✓ 4.16s
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).
fix
Ensure 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.
fix
Use `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.
fix
For 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.
fix
Ensure 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.
fix
Upgrade 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.
fix
Upgrade 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.
Agent activity
8 hits · last 30 days
node
8
Resources
pysen — pip install pysen · libregistry