Read all csv files in a directory with one iterator.
Project description
csvdir
Read every CSV in a directory as one stream of rows. No manual file loops, no header surprises — discovery, encoding, chunking, and optional pandas integration.
Documentation (primary): csvdir.readthedocs.io — getting started, guides, configuration, API reference, and changelog.
At a glance
| Without csvdir | With csvdir |
|---|---|
Loop glob + open per file |
read_dir("/data") yields every row |
| Header drift breaks pipelines | strict_headers / on_mismatch="skip" |
| Load huge dirs into memory | chunksize= streams list[dict] batches |
| Awkward pandas glue code | CsvDirFile works with pandas.read_csv |
Includes: row and chunked iterators, .with_names() / .with_paths(), column helpers, recursive discovery, per-file encoding and quote sniffing. Dict iterators compare header names as sets; CsvDirFile (pandas) stitches using header sequence and sorted path order — see docs.
Requirements
Python 3.10+. No runtime dependencies (pandas optional for CsvDirFile).
Install
pip install csvdir
From a clone (contributors):
git clone https://github.com/eddiethedean/csvdir.git
cd csvdir
pip install -e ".[dev]"
Quick start
from csvdir import read_dir
for row in read_dir("/data/csvs"):
print(row)
for stem, row in read_dir("/data/csvs").with_names():
print(stem, row["name"])
More patterns (headers, chunks, columns, pandas) are in the guides on Read the Docs.
Documentation map
| Start here | Read the Docs |
|---|---|
| Install & mental model | Getting started |
| Feature guides | Guides overview |
Every read_dir option |
Configuration |
| Autodoc | API reference |
| Release history | Changelog |
Design files remain in docs/ in the repo; the site above is the supported reading path for releases.
Contributing
pip install -e ".[dev,docs]"
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest
ruff check csvdir tests && ruff format --check csvdir tests
mypy
python -m mkdocs build --strict
CI runs the same checks on Python 3.10–3.13. See Development on RTD.
License
MIT — LICENSE.
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 csvdir-0.9.0.tar.gz.
File metadata
- Download URL: csvdir-0.9.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af1fa64f6737566c18b13759d1d125b85accc15b407f840a8398a2bed3780289
|
|
| MD5 |
058f55d95b0a68bf81f2bfaa886e19c3
|
|
| BLAKE2b-256 |
cf84d39f16ac2ab80205bfe6032361c7b0b8e22182f83b14df00aed185bdebcf
|
File details
Details for the file csvdir-0.9.0-py3-none-any.whl.
File metadata
- Download URL: csvdir-0.9.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a650f1faf5b835ffc5cd559b2d44718ccc80df27e81be62cb5fcdf56c2502aa
|
|
| MD5 |
6005a1e74add70a79692cf91f33bea95
|
|
| BLAKE2b-256 |
ebd3accae36db53de0ee811b03ca1e266c5314068f4547eb1b0cf59a8aa5ed7c
|