--- id: tsv2py version: "0.8.0" license: MIT license_treatment: permissive maintenance: active --- # tsv2py — High-performance parser and generator for PostgreSQL-compatible tab-separated values (TSV) License: permissive · Maintenance: active · Downloads: 94.9K/mo ## What it is and what it does tsv2py is a native-code parser and generator for tab-separated values (TSV) data, optimized for bulk data transfer between Python and databases like PostgreSQL. It converts TSV records into Python tuples of typed objects—supporting bytes, strings, integers, floats, booleans, dates, datetimes, UUIDs, decimals, IP addresses, and JSON structures—and can generate TSV output from tuples. The implementation uses AVX2 SIMD instructions for date-time parsing, UUID parsing, and field delimiter detection, and calls C standard library functions for integer parsing and IP address validation. The package is designed as a high-performance alternative to Python standard-library approaches for TSV handling, particularly for scenarios involving PostgreSQL COPY operations or bulk data import/export. It supports the PostgreSQL text format (a TSV variant with backslash-escaped special characters) and handles the full escape sequence set including NULL values, control characters, and backslashes. Prebuilt wheels are available for modern Python versions on macOS, Linux, Windows, and PyPy, reducing installation friction on common platforms. Use it for: - Bulk import or export of data from PostgreSQL using the COPY command with text format. - High-speed parsing of large TSV files with mixed data types into Python objects. - Converting database query results into TSV for transfer to another system or database. - Generating TSV output from Python data structures for database ingestion. - Processing RFC 3339 timestamps and RFC 4122 UUIDs embedded in TSV records. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and generates tab-separated values (TSV) data with high performance, converting between TSV text files and Python objects with support for multiple data types including dates, UUIDs, decimals, and IP addresses. Yes, if you work with TSV data or PostgreSQL bulk operations and need performance beyond the standard library. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers prebuilt wheels for most platforms. Install friction is moderate but manageable; only consider it a blocker if you cannot install a C compiler on your target system. ## Install pip install tsv2py uv add tsv2py poetry add tsv2py ## Installing tsv2py Before you install: Medium install friction due to native C code, but prebuilt wheels cover major platforms (macOS arm64, Linux x86_64/i686, Windows, and PyPy variants). Requires a C compiler and Python development headers only if no wheel matches your platform. License in practice: MIT license is permissive; you can use, modify, and distribute tsv2py freely in commercial and private projects with minimal restrictions. Quickstart: from tsv2py.helper import Parser from uuid import UUID from datetime import date, datetime parser = Parser(fields=(str, int, date, datetime, UUID, bool)) with open('data.tsv', 'rb') as f: records = parser.parse_file(f) Requires Python 3.10 or later; if no prebuilt wheel is available for your platform, a C compiler and Python development headers are needed to build from source. Verify before relying: - Whether orjson is an optional dependency that improves JSON parsing performance, or if the fallback to built-in json is automatic. - Whether the package handles streaming large TSV files efficiently or if parse_file loads the entire file into memory. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 94.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags tsv parser python, tab-separated values parsing, postgresql copy format, high-performance tsv reader, tsv to python objects, bulk data import export, database data transfer, tsv-parsing, postgresql, bulk-data-transfer [View on SkillFed](https://skillfed.io/packages/tsv2py) · [View on PyPI](https://pypi.org/project/tsv2py/)