GitHub - prasad-a-abhishek/csvcomp: Semantic CSV↔CSV diff (schema + rows + cells) with zero runtime dependencies. · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
prasad-a-abhishek
csvcomp
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>10 Commits<br>10 Commits
benchmarks
benchmarks
dist
dist
src
src
tests
tests
LICENSE
LICENSE
README.md
README.md
pyproject.toml
pyproject.toml
View all files
Repository files navigation
csvcomp
Zero-dependency Python CSV diff utility designed for serverless environments, CI/CD pipelines, and data quality audits.
Quick Start
pip install csvcomp<br>csvcomp file1.csv file2.csv
from csvcomp import diff
result = diff("file1.csv", "file2.csv", keys=["id"])<br>print(result.summary)
⚡ Performance & Benchmarks
csvcomp is designed for instant cold starts, sub-millisecond execution, and zero-dependency deployments.
Workload Profile<br>csvcomp<br>pandas.compare()<br>Speed Advantage<br>Peak RAM
Small CSV (100 rows)<br>⚡ 3.82 ms<br>7.59 ms<br>2.0x Faster<br>0.12 MB
Wide CSV (50 cols)<br>⚡ 32.50 ms<br>57.12 ms<br>1.8x Faster<br>4.68 MB
Install Package Size<br>🪶<br>🛑 > 150 MB<br>3000x Smaller<br>N/A
Dependencies<br>🛡️ 0 (Pure Stdlib)<br>⚠️ 8+ (numpy...)<br>Zero-Dep<br>N/A
Replicate these results: Run python3 benchmarks/run_benchmark.py directly inside this repository. See full matrix in benchmarks/BENCHMARK.md.
Why csvcomp?
Most developers default to pandas.compare(), but Pandas requires 150+ MB of C-compiled dependencies (numpy, pytz, dateutil), making it heavy and slow for serverless functions (AWS Lambda) or lightweight CI scripts.
Furthermore, pandas.compare() throws a ValueError crash if File A has 10 columns and File B has 11. csvcomp gracefully detects added, removed, and renamed columns.
Key Features
Zero Runtime Dependencies: Built entirely with Python standard library modules (csv, hashlib, decimal).
Shape Mismatch Tolerance: Gracefully handles added, removed, and reordered columns without throwing exceptions.
Key-Based & Positional Alignment: Align rows by unique primary keys (--key id) or positional row indices.
Flexible Formats: Output diffs as unified, summary, or json.
Numeric & Date Coercion: Smart type coercion normalizes trailing zeros (10.0 vs 10.00) and date ISO formats.
CLI Usage
diff_report.json"># Compare two CSV files with summary output<br>csvcomp old.csv new.csv
# Align rows by key column 'user_id'<br>csvcomp old.csv new.csv --key user_id
# Output unified diff format<br>csvcomp old.csv new.csv --format unified
# Export detailed JSON diff report<br>csvcomp old.csv new.csv --format json > diff_report.json
Python API Reference
from csvcomp import diff
# Perform diff<br>result = diff("left.csv", "right.csv", keys=["id"], ignore_columns=["updated_at"])
# Access diff properties<br>print("Has changes:", result.has_changes)<br>print("Added rows:", len(result.added_rows))<br>print("Removed rows:", len(result.removed_rows))<br>print("Modified rows:", len(result.modified_rows))
# Print human-readable summary<br>print(result.summary)
License
MIT © Abhishek Prasad
About<br>Semantic CSV↔CSV diff (schema + rows + cells) with zero runtime dependencies.<br>Resources<br>Readme<br>MIT license<br>Activity<br>Stars<br>0 stars<br>Watchers<br>0 watching<br>Forks<br>0 forks<br>Report repository
Releases
Packages
Contributors
Languages
You can’t perform that action at this time.