# CSV dedupe proof

`csv_dedupe.py` is a dependency-free Python CLI that removes duplicate CSV rows by one or more named key columns. It validates headers and malformed rows, preserves source order, and supports keeping either the first or last occurrence.

## Run

```bash
python3 csv_dedupe.py sample.csv cleaned.csv --key id
```

The command prints a machine-readable summary:

```json
{"duplicates_removed": 2, "input_rows": 5, "keep": "first", "key_columns": ["id"], "output_rows": 3}
```

Use `--key` more than once for a composite key. Optional flags are `--keep last`, `--ignore-case`, and `--strip-key-whitespace`.

## Verify

```bash
python3 -m unittest -v test_csv_dedupe.py
```

The implementation uses only Python's standard library and never sends input data over the network.
