reorder-python-imports
Tool for reordering python imports
Decision gist · record as of 2026-08-14
Yes. Low install friction, permissive MIT license, active maintenance, no known vulnerabilities, and a focused tool that solves a real problem (merge conflicts from import changes). Use it if your team wants deterministic import ordering enforced automatically, especially via pre-commit hooks.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with a single runtime dependency (classify-imports).
- Active maintenance with a release 35 days ago and 784 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
last release 2026-07-10 (35 days) · last repo commit 2026-07-15 · 784 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 147,672 downloads/mo, #11,053 on PyPI
Alternatives
Verify before relying
pip install reorder-python-imports
reorder-python-imports myfile.py
# Or add to .pre-commit-config.yaml:
# - repo: https://github.com/asottile/reorder-python-imports
# rev: v3.17.0
# hooks:
# - id: reorder-python-imports- Performance characteristics when processing large codebases or files with many imports.
- How the static analysis approach differs in practice from similar tools on real-world projects.
- Support for type-checking-only imports and conditional import blocks.
What it is and what it does
reorder-python-imports is a command-line tool that automatically reformats Python import statements according to a consistent style designed to minimize merge conflicts. It separates imports into three sections (standard library, third-party, first-party), places import statements before from imports, splits multi-item from imports into individual lines, and removes duplicates. The tool uses static analysis to understand import classification.
It integrates as a pre-commit hook or standalone CLI tool and supports options for Python version targeting (e.g., --py3-plus to remove obsolete __future__ imports), adding or removing specific imports, replacing imports with alternatives, and handling application-specific module paths. The single-import-per-line style allows multiple developers to modify imports without creating merge conflicts, even when editing the same module.
Use it for
- Enforce consistent import ordering across a team codebase via pre-commit hooks.
- Automatically remove obsolete __future__ imports when upgrading to newer Python versions.
- Replace compatibility library imports with modern equivalents automatically.
- Reduce merge conflicts when multiple contributors add imports to the same file.
- Rewrite mock and typing imports for newer Python versions automatically.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Low install friction, permissive MIT license, active maintenance, no known vulnerabilities, and a focused tool that solves a real problem (merge conflicts from import changes). Use it if your team wants deterministic import ordering enforced automatically, especially via pre-commit hooks.
Install
reorder-python-imports on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (classify-imports). Active maintenance with a release 35 days ago and 784 repository stars.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
Quickstart
pip install reorder-python-imports
reorder-python-imports myfile.py
# Or add to .pre-commit-config.yaml:
# - repo: https://github.com/asottile/reorder-python-imports
# rev: v3.17.0
# hooks:
# - id: reorder-python-imports
Verify before relying
- Performance characteristics when processing large codebases or files with many imports.
- How the static analysis approach differs in practice from similar tools on real-world projects.
- Support for type-checking-only imports and conditional import blocks.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageclassify-imports |
| Maintenance | Actively maintained 35 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 147,672 / month, #11,053 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: reorder_python_imports-3.17.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “merge conflict reduction”
- reorder-python-importsAutomatically reorders Python imports into a standardized format…
- merge3Implements 3-way merge of text sequences, combining changes from two…
- django-linear-migrationsEnforces linear migration history in Django projects by tracking the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also absolufy-imports · isort · usort · pyupgrade · classify-imports · google-pasta · aspy.refactor-imports · pytest-isort · sort-lines · mo-future