skillfed

csv23

Python 2/3 unicode CSV compatibility layer

csv23 v0.3.4 327.6K downloads/30d#7,567 on PyPI6
Permissive license MIT Active released

What it is and what it does

csv23 bridges the Python 2/3 divide for CSV handling by exposing the Python 3 csv module API (which uses unicode strings) to both Python 2.7 and Python 3 code. The core problem it solves is that Python 2's csv module works with byte strings while Python 3's works with unicode, making it difficult to write CSV code that runs on both versions. csv23 hides this difference and defaults to UTF-8 encoding throughout.

Beyond basic compatibility, it provides convenience utilities like open_csv() context managers for simpler file handling, and on Python 3 it adds read_csv() and write_csv() functions that work with file-like objects (useful for reading/writing CSV data from binary streams). It also includes workarounds for specific stdlib CSV bugs related to escape characters and embedded newlines.

Use it for:

  • Writing CSV parsing/writing code that must run unchanged on both Python 2.7 and Python 3 without conditional logic.
  • Reading or writing CSV data directly to binary streams without intermediate disk writes.
  • Calculating checksums over CSV output by piping to hashlib objects without writing to disk.
  • Transparently handling compressed CSV files (.bz2, .gz, .xz) with the autocompress option.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Python 3-style unicode CSV API that works consistently across Python 2.7 and Python 3, with UTF-8 as the default encoding and workarounds for stdlib CSV bugs.

Yes, if you maintain Python 2.7 code or need to support both Python 2 and 3 in the same codebase. The package is stable, has no known vulnerabilities, and low install friction. However, if you are writing new code for Python 3 only, the standard library csv module is sufficient—install this only if cross-version compatibility is a real requirement.

Install

csv23 on PyPI

pip

pip install csv23

uv

uv add csv23

poetry

poetry add csv23

Installing csv23

Before you install

Low friction: pure Python wheel with a single mock dependency. Repository is active with recent commits (last commit 2026-07-06), though the latest release was 2022-06-12, suggesting the package is stable rather than actively developed.

License in practice

MIT license (permissive) means you can use this freely in commercial and open-source projects with minimal restrictions—just include the license notice.

Quickstart

pip install csv23

import csv23

with csv23.open_csv('data.csv') as reader:
    for row in reader:
        print(row)

Verify before relying

  • Whether the package is still maintained or in maintenance-only mode given the gap between last release (2022-06-12) and recent commits.
  • Scope of the stdlib CSV bugs fixed (bpo-12178, bpo-31590) and whether they remain relevant in current Python versions.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*)
Install friction low — pure-Python wheel
Runtime dependencies 1 — mock
Maintenance actively maintained — 1,524 days since the last release
Last repo commit
First released
Downloads 327,602/month — #7,567 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: csv23-0.3.4-py2.py3-none-any.whl

Keywords: unicode, csv, reader, writer

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

python 2 3 csv compatibilityunicode csv reader writercross-version csv handlingutf-8 csv python 2csv module wrapperbytes text csv abstraction
python-2-compatcsv-handling

More Text Processing packages