Skip to main content

CLI tool for comparing CSV files in git diff format

Project description

CSV Diff

PyPI License CI

CSV Diff is a CLI tool for comparing two CSV files and displaying the results in git diff style.

For example, there are two CSV files, districts-2022.csv and districts-2025.csv. With this tool, you can easily see the data differences between these two CSV files. The output will be saved as a .diff file, like this:

--- districts-2022.csv
+++ districts-2025.csv
@@ -7,9 +7,9 @@
 11.01.07,11.01,Sawang
 11.01.08,11.01,Tapaktuan
 11.01.09,11.01,Trumon
-11.01.10,11.01,Pasi Raja
-11.01.11,11.01,Labuhan Haji Timur
-11.01.12,11.01,Labuhan Haji Barat
+11.01.10,11.01,Pasie Raja
+11.01.11,11.01,Labuhanhaji Timur
+11.01.12,11.01,Labuhanhaji Barat
 11.01.13,11.01,Kluet Tengah
 11.01.14,11.01,Kluet Timur
 11.01.15,11.01,Bakongan Timur
@@ -141,7 +141,7 @@
 11.08.11,11.08,Syamtalira Bayu
 11.08.12,11.08,Tanah Luas
 11.08.13,11.08,Tanah Pasir
-11.08.14,11.08,T. Jambo Aye
+11.08.14,11.08,Tanah Jambo Aye
 11.08.15,11.08,Sawang
 11.08.16,11.08,Nisam
 11.08.17,11.08,Cot Girek
... (truncated)

To see the full differences, please check the result.diff file.

Usage

csvdiff path/to/file1.csv path/to/file2.csv

Use --help to see the available options.

Installation

This package is available on PyPI. You can install it as a standalone CLI application using pipx or uv.

Using pipx

pipx install csv-diff-py
csvdiff

Using uv

uv tool install csv-diff-py
csvdiff

or without installing globally, you can use uvx to run it directly:

uvx --from csv-diff-py csvdiff

Development Setup

Prerequisites

  • uv package manager
  • Python 3.9 or higher

Tip: You can use uv to install Python. See the Python installation guide for more details.

Steps

  1. Clone this repository

    git clone https://github.com/fityannugroho/csv-diff.git
    cd csv-diff
    
  2. Install dependencies

    uv sync --all-extras
    
  3. Run the tool locally

    Via uv:

    uv run csvdiff
    

    Via virtual environment:

    source .venv/bin/activate
    csvdiff
    
  4. Run tests

    uv run pytest
    
  5. Run linter and formatter

    uv run ruff check
    uv run ruff format
    

Limitations

  • Only supports CSV files with a header row.

Project details


Download files

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

Source Distribution

csv_diff_py-0.5.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csv_diff_py-0.5.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file csv_diff_py-0.5.0.tar.gz.

File metadata

  • Download URL: csv_diff_py-0.5.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for csv_diff_py-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f6ee364905c40a9abe24d2b7e46c6346990712b442c0d20e19598c0f23f0486e
MD5 5b4251ae0e33e4895554813f4c84bb13
BLAKE2b-256 4da2717f6d1c293fe115f3c5068910360e4fd25696e58cf959b726b187b82779

See more details on using hashes here.

Provenance

The following attestation bundles were made for csv_diff_py-0.5.0.tar.gz:

Publisher: publish.yml on fityannugroho/csv-diff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csv_diff_py-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: csv_diff_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for csv_diff_py-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c54b8805bf12873b88d3304e962e8cee6c9dfd2ac3521b29bb2ab87d1aec368
MD5 7ae47bbe34b72872410cda0bf8ed1bf9
BLAKE2b-256 1e90184a9e70aa9da4d6facc121185bd32ce2a1ed84db5c9c10e330cc676f33e

See more details on using hashes here.

Provenance

The following attestation bundles were made for csv_diff_py-0.5.0-py3-none-any.whl:

Publisher: publish.yml on fityannugroho/csv-diff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page