Skip to main content

No project description provided

Project description

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(f"row #{row_number}: {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(f"row #{row_number}: {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

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

rustcsv-0.1.0a4.tar.gz (25.0 kB view details)

Uploaded Source

Built Distributions

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

rustcsv-0.1.0a4-cp37-cp37m-manylinux1_x86_64.whl (831.2 kB view details)

Uploaded CPython 3.7m

rustcsv-0.1.0a4-cp36-cp36m-manylinux1_x86_64.whl (831.2 kB view details)

Uploaded CPython 3.6m

File details

Details for the file rustcsv-0.1.0a4.tar.gz.

File metadata

  • Download URL: rustcsv-0.1.0a4.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for rustcsv-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 33a30a62aff19ef540d4d9fd389dc42ad7b4f47250374be8c175079d567ae50b
MD5 6664f5fc787b578148c9ddb01ce9e82f
BLAKE2b-256 b5167c0b72b154244814ff391636c3c3d6c6e386adfae577f6695227875d9979

See more details on using hashes here.

File details

Details for the file rustcsv-0.1.0a4-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: rustcsv-0.1.0a4-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 831.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for rustcsv-0.1.0a4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 91404394766c9a2dcfec8a91cf277ab0491f47c2e3de006bf8a4596293bb8803
MD5 bd1d0f65f78755c686cc7839291bb2d2
BLAKE2b-256 6a97f20436277a73bbc26efaa187fd4e66f19f323f354049adf4a5a225485298

See more details on using hashes here.

File details

Details for the file rustcsv-0.1.0a4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: rustcsv-0.1.0a4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 831.2 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for rustcsv-0.1.0a4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 49b38565c90b054d7bea54115b358fa73330a182894d92d91296930291dd696d
MD5 48baa43d22ed779958f7f2a669a0b8a8
BLAKE2b-256 5c96cca2ab3a8c4af1178e957b23fc85f19567654877b36f92c723ed1e84fdc6

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