Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A Python import organizer

Project description

Imporganizer organizes any imports of Python files found in the start of the file, putting them in alphabetic order. Comments or docstrings in the first lines are not supported yet. This feature is planned.


Your imports need to be formatted in these rules:

  • They must be at the start of the file (blank lines before the first import will be removed).
  • They must use forward-slash to define multi-line imports.
  • They must be separated from the rest of the file (Python code) by 2 empty lines.


from django.models import Model, \


from django.models import (Model,


Install using pip:

$ pip install imporganizer

Use with the command line (main usage):

$ imporganizer --third-party=package1,package2 --homemade=package3,package4

Update the standard packages list with:

$ imporganizer --update-builtin

You can’t update the builtin list and organize a file with a single command, but this is a feature in our roadmap.


They will be categorized by:

  • Standard: all packages included with the default distribution of Python.
  • Third party: all packages not standard and not internal to the project.
  • Homemade: dependencies, packages and modules internal to the project.

To be able to categorize your packages this way, you must inform which ones are third party and which ones are internal to the project. You do this by the command line:

imporganizer --third-party=package1,package2 --homemade=package3,package4

For an input like this:

from django.forms import Form, \
from textwrap import dedent

from django.db.models import Model
import sys
import os
import internal

import another_internal


The output will be:

import os
import sys
from textwrap import dedent

from django.db.models import Model
from django.forms import CharField, \

import another_internal
import internal


It will assume a maximum line length of 79 characters.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
imporganizer-1.1.1.tar.gz (6.1 kB) Copy SHA256 hash SHA256 Source None Mar 2, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page