skillfed

csvsort

Sort large CSV files on disk rather than in memory

csvsort v1.6.1 120.6K downloads/30d#12,017 on PyPI14
Copyleft license lgpl AGING released

What it is and what it does

csvsort is a utility for sorting CSV files that exceed available memory. It implements an external merge-sort algorithm: the original file is split into smaller chunks that fit in memory, each chunk is sorted independently, and then the sorted chunks are merged back together. The package supports custom delimiters (for TSV and other formats), column selection, header detection, and CSV quoting options.

The tool is designed for a specific, narrow use case: when you have a large CSV file on disk and need to sort it without loading the entire file into RAM. It has no runtime dependencies and is straightforward to use via a single function call. However, the package is aging—last released in 2020 with minimal recent activity—and Python version support is undocumented, creating uncertainty about compatibility with current Python releases.

Use it for:

  • Sort a multi-gigabyte CSV export from a database without exhausting available memory.
  • Organize log files or data dumps by timestamp or ID columns before downstream processing.
  • Prepare large datasets for merge operations or deduplication that require sorted input.
  • Sort TSV or other delimiter-separated files using the same merge-sort strategy.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Sorts large CSV files on disk using a merge-sort algorithm that breaks files into memory-manageable chunks, sorts them, and merges the results—useful when the entire file cannot fit in RAM.

Yes, if you have a specific need to sort a CSV file too large for memory and can tolerate the aging codebase. The package is simple, has no dependencies, and solves a narrow problem well. However, verify Python version compatibility before relying on it in production, and consider whether a database or streaming tool might be more appropriate for your workflow. The LGPL license is permissive for internal use but requires disclosure if you modify and distribute the library.

Install

csvsort on PyPI

pip

pip install csvsort

uv

uv add csvsort

poetry

poetry add csvsort

Installing csvsort

Before you install

High install friction reported. The package is aging—last release was 2020-06-17, over 2249 days ago—and the repository shows minimal activity (14 stars, last commit 2025-05-11). No runtime dependencies, but the age and inactivity suggest limited ongoing maintenance.

License in practice

Licensed under LGPL (copyleft). You must disclose source code modifications and make the modified library available under the same license if you distribute it; static linking or vendoring may require legal review depending on your use case.

Quickstart

from csvsort import csvsort
# Sort test.csv on columns 4 and 2 (0-indexed)
csvsort('test.csv', [4, 2])
# Sort with custom output file and delimiter
csvsort('test.tsv', [0], output_filename='sorted.tsv', delimiter='\t', max_size=10)

Python support is unspecified in the package metadata; the description mentions Python 2 & 3 support, but no minimum version is declared.

Verify before relying

  • Whether Python 2 support is still functional or if the package is effectively Python 3-only in practice.
  • Current performance characteristics and memory efficiency on modern systems with large files.
  • Whether the package handles edge cases like malformed CSV, special characters, or non-ASCII encodings reliably.

Package facts

License lgpl (copyleft)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance aging — 2,249 days since the last release
Last repo commit
First released
Downloads 120,586/month — #12,017 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: csvsort-1.6.1.tar.gz

Tags

sort large csv filescsv sorting out of memorymerge sort csvdisk-based csv sortinghandle oversized csv datacsv file chunkingexternal sort csv
csv-processingexternal-sortdata-tools

More Utilities packages