Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rust-csv + PyO3 = Not much slower than csv :tada:

travis-badge

BIG DISCLAIMER

  • This is not a production-ready library.

  • I’m not a production-ready Rust programmer.

  • Either Python 3’s csv stdlib module is pretty %#!& fast or my Rust code is %#!& slow.

Installation

pip install rustcsv

Examples

CSVReader instance from path

examples/reader_from_path.py:

import tempfile
from rustcsv import CSVReader

# Create a temporary file to put our CSV content in,
# automatically delete it once we're done.
with tempfile.NamedTemporaryFile(mode="w") as writable_fd:
    writable_fd.write(
        """\
spam1,spam2,spam3
spam4,spam5,spam6
"""
    )
    writable_fd.flush()

    for row_number, row in enumerate(CSVReader(writable_fd.name), start=1):
        print(
            "row #{row_number}: {row}".format(row_number=row_number, row=row)
        )

# Prints:
# row #1: ("spam1", "spam2", "spam3")
# row #2: ("spam4", "spam5", "spam6")

CSVReader instance from a binary file object

examples/reader_from_file_object.py:

import tempfile
from rustcsv import CSVReader

# Create a temporary file to put our CSV content in,
# automatically delete it once we're done.
with tempfile.NamedTemporaryFile(mode="w") as writable_fd:
    writable_fd.write(
        """\
spam1,spam2,spam3
spam4,spam5,spam6
"""
    )
    writable_fd.flush()

    readable_fd = open(writable_fd.name, "rb")

    for row_number, row in enumerate(CSVReader(readable_fd), start=1):
        print(
            "row #{row_number}: {row}".format(row_number=row_number, row=row)
        )

# Prints:
# row #1: ("spam1", "spam2", "spam3")
# row #2: ("spam4", "spam5", "spam6")

Development

Development Installation

Install and build the extension locally from e.g. a git checkout.

Requirements

Install Python dependencies

pipenv install --dev

Build the rustcsv._rustcsv extension

Either

  1. Using the “debug” cargo profile, or

    make develop-debug
  2. Using the “release” cargo profile

    make develop-release

Run tests

make test

Run benchmarks

make benchmark

Note: make benchmark will always build the extension using the “release” cargo profile.

Benchmarks

Benchmarks are executed as the last step in the Travis CI project.

You can also run it yourself, see Development and Run benchmarks.

References

Metadata

Release files for rustcsv 0.1.0a16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rustcsv 0.1.0a16
File Size Uploaded Provenance Actions
rustcsv-0.1.0a16.tar.gz 27.0 kB Without provenance Details for rustcsv-0.1.0a16.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustcsv 0.1.0a16
File Interpreter ABI Platform Actions
rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl
rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl
rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details for rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl

Total release size: 2.5 MB

Release files / rustcsv-0.1.0a16.tar.gz

Download URL rustcsv-0.1.0a16.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
71cec520b6a569be88aa51d452514ef19a16e99e012dc69513001aa37d0c3e1c
BLAKE2b-256 checksum
How to use checksums
336e65aeef0f3417fff1a3e68ef68c9bf5a02b54a846635d9040d7c248eda9b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Release files / rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl

Download URL rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl
Size 835.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
781e786afd4462b2924babdb4138bf0d7b5b013a60dcff25fe67e9b40e572a1a
BLAKE2b-256 checksum
How to use checksums
162fad355f22ee2ccc6da5db5018de91b79728f98ebcfad6c371076c5018a45d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Release files / rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl

Download URL rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl
Size 834.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
bdc7c011cdc5e7e4b70394851892cad228be4443c77afaf0ee075e0bdac0c2de
BLAKE2b-256 checksum
How to use checksums
577b441413df3f14c9aa9f4326b8a3b5457f29f78d948544e2905375d3f749b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Release files / rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl

Download URL rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl
Size 834.9 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9ffd2054e07a7ecb5cc9b2d45da40f487c5a2ec363197381c0df46d7858af9fa
BLAKE2b-256 checksum
How to use checksums
ffff0c09c405d632bff33f23eb021bd6925e26acf477c7820e1963ddaa3b2b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

Security for rustcsv 0.1.0a16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page