Skip to main content

Run multiple python linters easily

Project description

multilint

https://img.shields.io/pypi/v/multilint.svg https://img.shields.io/travis/adamchainz/multilint.svg

Run multiple python linters easily.

Installation and Usage

Install with pip:

pip install multilint

Run with:

multilint

Python 3.5-3.7 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 <https://pypi-hypernode.com/project/flake8/>, to check code quality

  • Isort <https://pypi-hypernode.com/project/isort/>, in ‘diff’ mode to show where imports aren’t sorted

  • Modernize <https://pypi-hypernode.com/project/modernize/>, in ‘diff’ mode to show where python 2/3 compatibility with six is missing

  • python setup.py check, to check your setup.py is well configured. This will require docutils, and also Pygments if your long_description uses any code highlighting.

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

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.7 and do your linting on Python 3.7 would look like:

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

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

[testenv:py37-codestyle]
commands = multilint

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

History

Pending Release

3.0.0 (2019-05-13)

  • Drop Python 2 and 3.4 support, only Python 3.5+ is supported now.

  • Add support for running Black, the Python code auto-formatter.

  • Drop support for Flake8 < 3.0.0.

2.4.0 (2018-09-30)

  • Support positional arguments for paths.

2.3.0 (2018-04-28)

  • Fix for modernize 0.6.1+

  • Run modernize on the multilint codebase itself, so it now requires six

2.2.1 (2018-03-08)

  • Fix crash when setup.cfg doesn’t exist.

2.2.0 (2017-09-19)

  • Add --skip argument which can be used to skip particular linters even though they’re installed.

2.1.0 (2017-06-02)

  • Use entry_points in setup.py instead of scripts

  • Support python -m multilint

2.0.2 (2016-12-06)

  • Don’t invoke python setup.py check if there is no setup.py.

2.0.1 (2016-10-20)

  • Remove default for paths in setup.cfg.

  • Check that paths exist before running the linters.

2.0.0 (2016-09-24)

  • Use the config header tool:multilint in setup.cfg, rather than multilint, to avoid clashing with any potential setup.py commands. Your setup.cfg will need updating.

1.0.2 (2016-07-26)

  • Work with flake8 3.0+ which changed the way its main function worked.

1.0.1 (2016-07-16)

  • Fix modernize running on Python 2.

  • Run isort in the same Python process rather than with subprocess

  • Properly gate flake8 and isort so that they run only if they are installed.

1.0.0 (2016-06-19)

  • First release on PyPI.

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-3.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

multilint-3.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: multilint-3.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for multilint-3.0.0.tar.gz
Algorithm Hash digest
SHA256 07feb85131ea90ef140c0d4359360ef8cae9b3d0666956b36f5ada6fd348056f
MD5 c6e0f6a74431034c384a14d8cb031877
BLAKE2b-256 9d25e3efe4e25c35a86a158a84141b49da9b9ed3b09278d09cc8af0520806a36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multilint-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for multilint-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8951fca99ab8a97c59cc3d17361a3a8ce03fe4cfa0ac34463d024117c60c5a0b
MD5 3b22593ad4774b47f2e8ca1421dc1e53
BLAKE2b-256 b3d4a64a6796801ac277df77210feac579e57988fc2607e4e25720a25f01ec34

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