Skip to main content

A flake8 plugin that helps you write tidier imports.

Project description

Flake8 Tidy Imports

https://img.shields.io/pypi/v/flake8-tidy-imports.svg https://img.shields.io/travis/adamchainz/flake8-tidy-imports.svg

A flake8 plugin that helps you write tidier imports.

  • Free software: ISC license

Installation

Install from pip with:

pip install flake8-tidy-imports

It will then automatically be run as part of flake8; you can check it has been picked up with:

$ flake8 --version
2.4.1 (pep8: 1.7.0, pyflakes: 0.8.1, flake8-tidy-imports: 1.0.0, mccabe: 0.3.1) CPython 2.7.11 on Darwin

Rules

Currently only one rule is implemented.

I200: Unnecessary import alias

Complains about unnecessary import aliasing of three forms:

  • import foo as foo -> import foo

  • import foo.bar as bar -> from foo import bar

  • from foo import bar as bar -> from foo import bar

The message includes the suggested rewrite (which may not be correct at current), for example:

$ flake8 file.py
file.py:1:1: I200 Unnecessary import alias - rewrite as 'from foo import bar'.

History

Pending Release

  • New release notes here

1.0.0 (2016-01-23)

  • First release on PyPI.

  • I200 rule that complains about unnecessary import aliasing, e.g. from foo import bar as bar.

Project details


Download files

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

Source Distributions

flake8_tidy_imports-1.0.0.tar.gz (5.0 kB view hashes)

Uploaded Source

flake8-tidy-imports-1.0.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

flake8_tidy_imports-1.0.0-py2.py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 2 Python 3

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