No project description provided
Project description
Contents
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
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
- Pipenv.
- Python 3.6.
- Rust and Cargo nightly (1.30 as of now) - https://rustup.rs/.
Install Python dependencies
pipenv install --dev
Build the rustcsv._rustcsv extension
Either
Using the “debug” cargo profile, or
make develop-debug
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.
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl (834.9 kB) | File type Wheel | Python version cp35 | Upload date | Hashes View |
Filename, size rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl (834.9 kB) | File type Wheel | Python version cp36 | Upload date | Hashes View |
Filename, size rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl (835.0 kB) | File type Wheel | Python version cp37 | Upload date | Hashes View |
Filename, size rustcsv-0.1.0a16.tar.gz (27.0 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for rustcsv-0.1.0a16-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ffd2054e07a7ecb5cc9b2d45da40f487c5a2ec363197381c0df46d7858af9fa |
|
MD5 | aa62ea001cbd0cba70a648f14ba7027d |
|
BLAKE2-256 | ffff0c09c405d632bff33f23eb021bd6925e26acf477c7820e1963ddaa3b2b72 |
Close
Hashes for rustcsv-0.1.0a16-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc7c011cdc5e7e4b70394851892cad228be4443c77afaf0ee075e0bdac0c2de |
|
MD5 | 3f214f725a7363bcd3612abd5b765062 |
|
BLAKE2-256 | 577b441413df3f14c9aa9f4326b8a3b5457f29f78d948544e2905375d3f749b9 |
Close
Hashes for rustcsv-0.1.0a16-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 781e786afd4462b2924babdb4138bf0d7b5b013a60dcff25fe67e9b40e572a1a |
|
MD5 | df10b30b447a9ebc820d8707dcc3bb46 |
|
BLAKE2-256 | 162fad355f22ee2ccc6da5db5018de91b79728f98ebcfad6c371076c5018a45d |