A snappy CSV viewer TUI - peek at your data fast
Project description
csvpeek
A fast CSV viewer in your terminal - peek at your data instantly ⚡
Csvpeek is a snappy, memory-efficient CSV viewer built for speed. Powered by DuckDB for fast SQL-backed querying and Urwid for a lean terminal UI.
✨ Features
- Fast - DuckDB streaming with LIMIT/OFFSET keeps startup instant, even with huge files
- Smart Filtering - Real-time column filtering with literal text search and numeric ranges
- Modern TUI - Beautiful terminal interface with syntax highlighting
- Large File Support - Pagination handles millions of rows without breaking a sweat
- Cell Selection - Select and copy ranges with keyboard shortcuts
- Column Sorting - Sort by any column instantly
- Memory Efficient - Only loads the data you're viewing (100 rows at a time)
- Visual Feedback - Highlighted filter matches and selected cells
- Keyboard-First - Every action is a keystroke away
🚀 Quick Start
Installation
pip install csvpeek
Or install from source:
git clone https://github.com/giantatwork/csvpeek.git
cd csvpeek
pip install -e .
Usage
csvpeek your_data.csv
📖 Keyboard Shortcuts
| Key | Action |
|---|---|
/ |
Open filter dialog |
r |
Reset all filters |
Ctrl+D |
Next page |
Ctrl+U |
Previous page |
s |
Sort current column |
c |
Copy selection to clipboard |
Shift+Arrow |
Select cells |
Arrow Keys |
Navigate (clears selection) |
q |
Quit |
🎯 Usage Examples
Basic Viewing
Open any CSV file and start navigating immediately:
csvpeek data.csv
Filtering
- Press
/to open the filter dialog - Enter filter values for any columns
- Press
Enterto apply - Filter matches are highlighted in red
Filter modes:
- Literal mode: Case-insensitive substring search (e.g.,
scrantonmatches "Scranton") - Regex mode: Start with
/for regex patterns (e.g.,/^Jmatches names starting with J)/\d+- Contains digits/sales|eng- Contains "sales" OR "eng"/^test$- Exactly "test"- All regex patterns are case-insensitive
Sorting
- Navigate to any column
- Press
sto sort by that column - Press
sagain to toggle ascending/descending
Selection & Copy
- Position cursor on starting cell
- Hold
Shiftand use arrow keys to select a range - Press
cto copy selection as tab-separated values - Paste anywhere with
Ctrl+V
🏗️ Architecture
csvpeek is designed for performance and maintainability:
csvpeek/
├── csvpeek.py # Main Urwid application and data operations
├── selection_utils.py # Selection helpers
└── main.py # Entry point
Key Design Decisions
- Lazy Loading: DuckDB queries with LIMIT/OFFSET keep memory bounded and avoid up-front scans
- Pagination: Only 100 rows in memory at once - handles GB-sized files effortlessly
- Incremental Updates: Cell selection updates only changed cells, not the entire table
- Modular Design: Separated concerns make the codebase easy to extend
🔧 Requirements
- Python 3.10+
- DuckDB >= 1.1.0
- Urwid >= 2.1.0
- Pyperclip >= 1.9.0
🎨 Performance
csvpeek is optimized for speed:
- Instant Startup: Lazy loading means no upfront data processing
- Responsive UI: Incremental cell updates prevent UI lag during selection
- Memory Efficient: Constant memory usage regardless of file size
- Smart Caching: Pages are cached for instant back/forward navigation
Benchmarks (on a 10M row CSV):
- Startup: < 100ms
- Filter application: ~200ms
- Page navigation: < 50ms
- Sort operation: ~300ms
🤝 Contributing
Contributions are welcome! Here are some areas where you could help:
- Add regex filter mode
- Export filtered results
- Column width auto-adjustment
- Multi-column sorting
- Search navigation (next/previous match)
- Dark/light theme toggle
- Custom color schemes
📝 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
Built with amazing open-source tools:
📬 Contact
Found a bug? Have a feature request? Open an issue!
csvpeek - Because life's too short to wait for CSV files to load 🚀
- ⌨️ Keyboard Shortcuts: Navigate and filter with ease
Installation
uv tool install csvpeek
Usage
python csvpeek.py <path_to_csv_file>
Example:
python csvpeek.py data.csv
Keyboard Shortcuts
q- Quit the applicationr- Reset all filtersf- Focus on filter inputsTab- Navigate between filter inputsEnter- Apply filters- Arrow keys - Navigate the data table
Filtering
- Example: typing "john" will show all rows where the column contains "john"
- Apply filters to multiple columns simultaneously
- All filters are combined with AND logic
Requirements
- Python 3.10+
- duckdb >= 1.1.0
- urwid >= 2.1.0
- pyperclip >= 1.8.0
Memory Efficiency
The viewer uses DuckDB, which runs embedded and optimizes for:
- Vectorized execution with columnar storage
- SQL filtering, sorting, and regex matching directly in the engine
- Streaming via LIMIT/OFFSET to keep memory stable on large files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csvpeek-0.6.0.tar.gz.
File metadata
- Download URL: csvpeek-0.6.0.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d7b1249185f9e083a4d4eff91386552e9a84cee785ab7f296a021c8bba7b92a
|
|
| MD5 |
c9a224f19b98c7bbc693962f42adda21
|
|
| BLAKE2b-256 |
18b26dff6b034ecbea5cdc5181e5302a2d3bd6e12e393d69b320406dd816e56b
|
File details
Details for the file csvpeek-0.6.0-py3-none-any.whl.
File metadata
- Download URL: csvpeek-0.6.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73fb1dccb3b52db738b120ad546720f201e3e53736023e79a7b2459c0ad51c85
|
|
| MD5 |
c80a7352eead567abed5484d8aaff09b
|
|
| BLAKE2b-256 |
4dea842e04ee474a0c68a849bd43c615ead585fc28d91083155dd0aa70975d2b
|