sort-lines
alphabetize lines in files
Decision gist · record as of 2026-08-14
Yes, if you need lightweight, pragma-driven line sorting in code or text files. The tool has no dependencies, installs easily, and integrates well with pre-commit workflows. It's actively maintained and carries no known security vulnerabilities. Suitable for teams that want to enforce alphabetical ordering without heavyweight formatters.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction install with no runtime dependencies.
- Actively maintained with recent commits; last release was 793 days ago but the repository shows ongoing activity.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2024-06-12 (793 days) · last repo commit 2026-07-26 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,235 downloads/mo, #14,458 on PyPI
Alternatives
Verify before relying
pip install sort-lines
# Add to a Python file:
names = [ # pragma: alphabetize
'Alice',
'Bob',
'Charlie',
]
# Run: sort-lines names.py- Whether the tool handles nested indentation levels correctly in complex structures.
- Performance characteristics on very large files or deeply indented code blocks.
What it is and what it does
sort-lines is a command-line tool that alphabetizes lines within a file based on their indentation level. You mark a section for sorting by adding a `# pragma: alphabetize` comment on the line above the block you want sorted; the tool then alphabetizes all subsequent lines at the same indentation level until it encounters a line with different indentation or a blank line. It supports case-insensitive sorting via a `[case-insensitive]` option in the pragma comment or a command-line flag.
The tool is designed for Python code but works with any consistently indented text. It integrates with pre-commit hooks, making it useful for automated code formatting workflows. With no runtime dependencies and a straightforward installation, it's a lightweight utility for keeping lists, imports, or other line-based structures in alphabetical order without manual intervention.
Use it for
- Alphabetize lists of names, imports, or configuration items in Python code by marking them with a pragma comment.
- Enforce consistent ordering of dictionary keys or array elements in code reviews via pre-commit hooks.
- Sort lines in any text file with consistent indentation, such as configuration files or data lists.
- Maintain alphabetical order in multi-line function arguments or class definitions.
- Automate line sorting in CI/CD pipelines to ensure reproducible, consistent code formatting.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need lightweight, pragma-driven line sorting in code or text files.
The tool has no dependencies, installs easily, and integrates well with pre-commit workflows. It's actively maintained and carries no known security vulnerabilities. Suitable for teams that want to enforce alphabetical ordering without heavyweight formatters.
Install
sort-lines on PyPI
Before you install
Low friction install with no runtime dependencies. Actively maintained with recent commits; last release was 793 days ago but the repository shows ongoing activity.
Requires Python 3.9 or later.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install sort-lines
# Add to a Python file:
names = [ # pragma: alphabetize
'Alice',
'Bob',
'Charlie',
]
# Run: sort-lines names.py
Verify before relying
- Whether the tool handles nested indentation levels correctly in complex structures.
- Performance characteristics on very large files or deeply indented code blocks.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 793 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,235 / month, #14,458 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPython |
Evidence: sort_lines-0.3.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 › “sort lines alphabetically”
- sort-linesAlphabetizes lines in files based on indentation levels, triggered by…
- isortisort sorts Python imports alphabetically and automatically separates…
- uv-sortAlphabetically sorts dependencies in uv's pyproject.toml…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also autopep8 · toml-sort · natsort · uv-sort · csvsort · usort · reformat-gherkin · ufmt · nocasedict · jaraco.text