Skip to main content

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 ⚡

License Python

Csvpeek is a snappy, memory-efficient CSV viewer built for speed. Powered by Polars for lightning-fast data operations and Textual for a modern terminal UI.

✨ Features

  • Fast - Lazy loading with Polars means instant startup, 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

  1. Press / to open the filter dialog
  2. Enter filter values for any columns
  3. Press Enter to apply
  4. Filter matches are highlighted in red

Filter modes:

  • Literal mode: Case-insensitive substring search (e.g., scranton matches "Scranton")
  • Regex mode: Start with / for regex patterns (e.g., /^J matches names starting with J)
    • /\d+ - Contains digits
    • /sales|eng - Contains "sales" OR "eng"
    • /^test$ - Exactly "test"
    • All regex patterns are case-insensitive

Sorting

  1. Navigate to any column
  2. Press s to sort by that column
  3. Press s again to toggle ascending/descending

Selection & Copy

  1. Position cursor on starting cell
  2. Hold Shift and use arrow keys to select a range
  3. Press c to copy selection as tab-separated values
  4. Paste anywhere with Ctrl+V

🏗️ Architecture

csvpeek is designed for performance and maintainability:

csvpeek/
├── csvpeek.py          # Main application and data operations
├── filter_modal.py     # Filter dialog UI component
├── styling.py          # Cell styling utilities
├── styles.py           # CSS styling constants
└── main.py            # Entry point

Key Design Decisions

  • Lazy Loading: Polars' lazy evaluation means queries are optimized and only necessary data is loaded
  • 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+
  • Polars >= 0.19.0
  • Textual >= 0.47.0
  • Rich
  • 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:

  • Polars - Lightning-fast DataFrames
  • Textual - Modern TUI framework
  • Rich - Beautiful terminal formatting

📬 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 application
  • r - Reset all filters
  • f - Focus on filter inputs
  • Tab - Navigate between filter inputs
  • Enter - 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+
  • polars >= 0.19.0
  • textual >= 0.47.0
  • pyperclip >= 1.8.0

Memory Efficiency

The viewer uses Polars, which is written in Rust and optimized for:

  • Zero-copy operations where possible
  • Efficient memory layout (columnar format)
  • Lazy evaluation for complex queries
  • SIMD vectorization

This makes it significantly more memory-efficient than pandas for large datasets.

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

csvpeek-0.3.0.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

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

csvpeek-0.3.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file csvpeek-0.3.0.tar.gz.

File metadata

  • Download URL: csvpeek-0.3.0.tar.gz
  • Upload date:
  • Size: 25.4 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

Hashes for csvpeek-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f9532a98dd8dfd71f227af75180be580aed52f55235a59ca9ad581156999f289
MD5 038113d89e41d131efc9e0589b7e6306
BLAKE2b-256 d1d3d27cd6c24f4a3d3b4f0302c592d98a8bdffa9b698d47e192fd681e880b04

See more details on using hashes here.

File details

Details for the file csvpeek-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: csvpeek-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.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

Hashes for csvpeek-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e65fff94e4cd86c6124ad78c3023d1470cbe0895a1dc319e3005795d98afec0c
MD5 c0bcdbd811eac6f39ba7612b84cd6518
BLAKE2b-256 4733333925ed1a6388df279aa8451a9dbde4f583d5079f3b435dc38a4777b7ac

See more details on using hashes here.

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