csvpy
Execute Python code on CSV files
TLDR
Load a CSV file into a CSVKitReader object
Load a CSV file into a CSVKitDictReader object
SYNOPSIS
csvpy [options] [FILE]
PARAMETERS
-l, --list
Output as list of lists (default if no header)
-d, --dict
Output as list of dicts (uses first row as keys)
-H, --no-header
Ignore header row
-D DELIM
Specify delimiter (default: comma)
-q, --quote
Use quotes around strings
-h, --help
Show help
--version
Show version info
DESCRIPTION
csvpy is a lightweight command-line utility designed to convert CSV files into executable Python code. It reads standard CSV input and generates Python data structures, such as lists of lists or lists of dictionaries, making it easy to embed tabular data directly into Python scripts without manual parsing.
Ideal for developers needing quick data serialization for testing, prototyping, or configuration files. Supports common CSV dialects, including headers, quoting, and delimiters. Output can be customized for readability and compatibility with Python versions 2 and 3.
Unlike full-featured tools like csvkit, csvpy focuses solely on code generation, keeping it simple and fast. Install via pip install csvpy. No system dependencies beyond Python.
CAVEATS
Not a standard Linux command; requires pip install csvpy. Limited to basic CSV; no support for very large files or complex dialects. Python 3.6+ recommended.
EXAMPLE USAGE
Convert input.csv to dicts:
csvpy -d input.csv
# Outputs:
data = [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]
INSTALLATION
pip install csvpy
Or clone from GitHub: github.com/eyeseast/csvpy
HISTORY
Developed around 2015 as a minimal Python script by independent developer. Released on PyPI with sporadic updates; version 0.2.1 last major release in 2018. Gained niche use in data scripting communities.


