cleanvc
A lightweight, zero-dependency Python tool and CLI to clean up messy CSV files.
Features
- Header Normalization: Automatically converts column headers into clean snake_case identifiers (e.g.,
First Name (%)->first_name_pct). - Whitespace Stripping: Strips extraneous leading and trailing spaces from values and headers.
- Empty Row Removal: Automatically discards completely blank rows.
- UTF-8 with BOM Support: Safely reads CSV files exported from Excel and other spreadsheet software (
utf-8-sig). - CLI & Python API: Use as a command-line utility or import in your Python scripts.
- Zero Dependencies: Powered exclusively by the Python standard library.
Installation
pip install cleanvc
Command-Line Usage (CLI)
Once installed, use cleanvc directly from your terminal:
# Clean a messy CSV (creates cleaned_messy.csv automatically)
cleanvc messy.csv
# Specify custom output destination
cleanvc messy.csv -o clean_data.csv
# Custom delimiter (e.g., semicolon)
cleanvc messy.csv -d ";" -o clean_data.csv
# Check version
cleanvc --version
You can also run it via Python module invocation:
python -m cleanvc messy.csv -o clean_data.csv
Python API Usage
Process a CSV File
from cleanvc import CSVCleaner
cleaner = CSVCleaner()
# Automatically saves as cleaned_messy_sales.csv
cleaner.process_file("messy_sales.csv")
# Or specify your own output path
cleaner.process_file("messy_sales.csv", "cleaned_sales.csv")
In-Memory Row Cleaning
from cleanvc import CSVCleaner
cleaner = CSVCleaner()
raw_data = [
{" First Name (%) ": " Alice ", " Score ": " 95 "},
{" First Name (%) ": " ", " Score ": ""}, # Automatically dropped
{" First Name (%) ": " Bob ", " Score ": " 80 "},
]
cleaned = cleaner.clean_rows(raw_data)
# [
# {"first_name_pct": "Alice", "score": "95"},
# {"first_name_pct": "Bob", "score": "80"}
# ]
Running Tests
Run the unit tests with Python's standard unittest runner:
python -m unittest discover -v tests
Publishing to PyPI
-
Install build and upload tools:
pip install --upgrade build twine
-
Build distribution artifacts:
python -m build
This generates the wheel (
.whl) and source distribution (.tar.gz) indist/. -
Verify the build:
twine check dist/*
-
Upload to TestPyPI (Recommended first):
twine upload --repository testpypi dist/*
-
Publish to PyPI:
twine upload dist/*
License
MIT License. See LICENSE for details.
Metadata
Release files for cleanvc 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cleanvc-0.1.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cleanvc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / cleanvc-0.1.0.tar.gz
| Download URL | cleanvc-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6b747dcedc5682f01daef98b4413b51faf55b13b8b5cadcf053f63347593dfd
|
|
BLAKE2b-256 checksum How to use checksums |
0ca47bbaadda57fd5414d3cce146420f41824558478713ad9f5134e9a6b485d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / cleanvc-0.1.0-py3-none-any.whl
| Download URL | cleanvc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97d64fd4bb4bcf5482bb06317d285fe96bdcbcfb683bb3a331e3100867396efd
|
|
BLAKE2b-256 checksum How to use checksums |
731eea12c8784475eb65b70e89be59713864f10fa7f155be646565487532ee81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|