pysen

0.12.0 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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

view raw JSON →