This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Groups, lexicographically sorts and formats import statement into the three groups as defined by PEP8 (standard library, third-party packages, current package/application.)

Imports from the same package are collapsed into a single statement, and multiple identifiers from the same packages are grouped using parentheses and separated by a newline.

Usage

Usage: format-imports.py [options]

Groups, sorts, and formats import statements.

Options:
-h, --help            show this help message and exit
-a APPLICATION, --application=APPLICATION
-s STDLIB_FILES, --stdlib-file=STDLIB_FILES
                        File(s) containing additional module names to add to
                        the standard library set.

The script accepts input via stdin, and outputs the formatted code via stdout.

Example

For the given bad.py:

import sys

import foo
import bar as other
from baz import (
    package,
    package3,
)
from module import package3 as package4
from baz import package2, package1

import application
from application.utils import memoize
from application.models import User
from application.models import Place

import os

The output of format-imports.py -a application < bad.py will be:

import os
import sys

import bar as other
import foo
from baz import (
    package,
    package1,
    package2,
    package3,
)
from module import package3 as package4

import application
from application.models import (
    Place,
    User,
)
from application.utils import memoize

Usage with Vim

Select a chunk of text in visual mode, then invoke the format-imports.py script against the chunk with:

:'<,'>!format-imports.py -a <application>
Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
importformatter-0.1.3.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Nov 7, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting