Skip to main content

Run multiple python linters easily

Project description

https://github.com/adamchainz/multilint/workflows/CI/badge.svg?branch=master https://img.shields.io/pypi/v/multilint.svg https://img.shields.io/badge/code%20style-black-000000.svg

Run multiple python linters easily.

Installation and Usage

Install with pip:

python -m pip install multilint

Run with:

multilint

Python 3.5 to 3.8 supported.

How It Works

I like to keep my projects tidy with a standard set of linters. Running them all turned out to be easier with a wrapper script, which I ended up copy-pasting between them all. This project stops me needing to copy/paste, centralizing running all these neat tools.

In order, it will check if these linters are installed, and if so, run them:

  • Black, to autoformat code

  • Flake8, to check code quality

  • Isort, in ‘diff’ mode to show where imports aren’t sorted

  • Modernize, in ‘diff’ mode to show where python 2/3 compatibility with six is missing

If any of them fail, multilint stops and dies with a non-zero exit code. Otherwise it succeeds!

You need to configure the paths that will be linted (by default, only setup.py is linted). Put a section in your setup.cfg like:

[tool:multilint]
paths = my_package
        tests
        setup.py

You can also pass the paths as arguments to multilint, which will override the settings, like:

multilint path/my_file.py path/folder1

Note: previously multilint supported running setup.py check if you passed a setup.py file. This was removed as the command is deprecated. You should instead use twine check as per the python packaging documentation.

Usage With tox

I normally run my tests with tox. An example tox.ini to use multilint to run your tests on Python 3.5-3.8 and do your linting on Python 3.8 would look like:

[tox]
envlist =
    py{35,36,37,38},
    py38-codestyle

[testenv]
deps = -rrequirements.txt
commands = pytest

[testenv:py38-codestyle]
commands = multilint

Then just put multilint, plus the linters you want it to run (e.g. flake8) in your requirements.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multilint-5.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

multilint-5.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file multilint-5.0.0.tar.gz.

File metadata

  • Download URL: multilint-5.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for multilint-5.0.0.tar.gz
Algorithm Hash digest
SHA256 c4cc4cf4338481781d89bb62995873633b58ef4bde9014c0325d52cd39f945bb
MD5 05f8107b500a763268e78dd41cd6b786
BLAKE2b-256 8b1a491f77472a7c40ca20f54154474a6e81ef1993999352848979e96510e2b6

See more details on using hashes here.

File details

Details for the file multilint-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: multilint-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for multilint-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3912bbbddcf8691b11e2b6a772223cf90f507fc6a35c12edc0e55d17bd2c9563
MD5 101ab9c9649c988abef39102311dd46c
BLAKE2b-256 83b9a7114403553855c331656413f25d0450af7fce5ff3207a4132b275954148

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page