Skip to main content

A fast reading file library for Python

Project description

Fast Reading

A fast reading file library for Python

Python ≥3.9 License: MIT

Description

Fast Reading is a high-performance file reading library for Python, written in Rust using pyo3. It provides an efficient mechanism for reading files by loading them in batches and yielding file content one at a time. This makes it ideal for processing large volumes of data with minimal overhead.

Features

  • High Performance: Built with Rust for speedy file operations.
  • Seamless Python Integration: Uses pyo3 for a natural Python interface.
  • Batch File Reading: Reads files in batches to optimize I/O, then iterates over individual file data.
  • Flexible Iterators: Provides different iterator types for various use cases.
  • Cross-Platform Compatibility: Works with Python 3.9 and above.

Installation

Ensure you have maturin installed:

pip install fast-reading

Tests

> 100_000 files of 1024 bytes each

$ Python reading time: 0.777500 seconds
$ FilesBatchIterator reading time (batch_size=5): 0.449203 seconds
$ FlattenFilesBatchIterator reading time (batch_size=5): 0.448566 seconds
> 100_000 files of 32768 bytes each

$ Python reading time: 1.138894 seconds
$ FilesBatchIterator reading time (batch_size=5): 0.847089 seconds
$ FlattenFilesBatchIterator reading time (batch_size=5): 0.835050 seconds
> 1_000_000 files of 4096 bytes each

$ Python reading time: 14.950660 seconds
$ FilesBatchIterator reading time (batch_size=5): 5.086445 seconds
$ FlattenFilesBatchIterator reading time (batch_size=5): 5.068229 seconds

Usage

FilesBatchIterator Example

This iterator reads files in batches and returns a list of file contents for each batch.

from fast_reading import FilesBatchIterator

# Initialize the iterator for reading files from a directory with a batch size of 100
for file_bytes in FilesBatchIterator("/path/to/directory", batch_size=100):
    # file_bytes is a list of bytes read from one or more files
    print(file_bytes)

FlattenFilesBatchIterator Example

This iterator loads a batch of files but yields file content one by one.

from fast_reading import FlattenFilesBatchIterator

# Initialize the iterator to read files in batches of 5,
# but return one file's content at a time.
for file_content in FlattenFilesBatchIterator("/path/to/directory", batch_size=5):
    # file_content is the bytes content of a single file
    print(file_content)

License

This project is licensed under the MIT License.

Contact

Author: @vffuunnyy

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

fast_reading-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distributions

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

fast_reading-0.1.1-cp313-cp313-win_amd64.whl (139.0 kB view details)

Uploaded CPython 3.13Windows x86-64

fast_reading-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl (270.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fast_reading-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (234.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fast_reading-0.1.1-cp312-cp312-win_amd64.whl (139.3 kB view details)

Uploaded CPython 3.12Windows x86-64

fast_reading-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl (270.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fast_reading-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (234.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fast_reading-0.1.1-cp311-cp311-win_amd64.whl (139.3 kB view details)

Uploaded CPython 3.11Windows x86-64

fast_reading-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl (270.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

fast_reading-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (237.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fast_reading-0.1.1-cp310-cp310-win_amd64.whl (139.3 kB view details)

Uploaded CPython 3.10Windows x86-64

fast_reading-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl (271.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

fast_reading-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (237.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

fast_reading-0.1.1-cp39-cp39-win_amd64.whl (139.4 kB view details)

Uploaded CPython 3.9Windows x86-64

fast_reading-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl (271.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

fast_reading-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (237.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file fast_reading-0.1.1.tar.gz.

File metadata

  • Download URL: fast_reading-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fast_reading-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2fe64d99161f11a54cd25f61191def955400c6d3f31a075f2aeb25e0ad41a45a
MD5 835d1cb45dad91c883d28a7578df768c
BLAKE2b-256 6e38cd8370ab0fb5b8ab4b5e8a5d7d62f5351e56fa8282b41416ffa4ce268bac

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 54d858d3d7b5448871ccb9266fd23efbdda6e69f1ae826d3bf69f230d8e06902
MD5 d88dae38ed526810012f3cb8488c8475
BLAKE2b-256 88e5c0207b78faa011d1925b69fc995b3ff717f0019bdeed44cc05dca4ceb9f0

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3785c70f3e3f83b501ce0eac930473a8f960e678916826a968cea4e1ccc3dc72
MD5 ee14268b9128de242dbd249f2b1678da
BLAKE2b-256 7d5a0ead9fd778a6dc03f2298584787e95e0a1ed71fd0565efb409b376e8ac0b

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2cf27d383c95601ec6c57a3b9bc2fd7b7a09592dadf50cef20dce8e09d66d22
MD5 5f7690ba764e0f4b4dbec04ddf908c0d
BLAKE2b-256 2e96f94e9da734f5e20c5b1b255131c456947594039e8ad26585163a45dd81f1

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a6f5ffda1226e8ece02d5e1cd35af292d99dbd1291e081cec3c6694fed371db4
MD5 d9bda62f7f0041f604a8740b2e4d65d1
BLAKE2b-256 750a63ab80d87c5af663c7a170b596250acfc573265e1b85adb448f515772ae9

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cfeaae374ee324a71bc97f4fb1dfb8e4bac3f0fbcc1d56b06f58de8b499c5616
MD5 855277e9826151a029050bdd5d49bb5d
BLAKE2b-256 e804f96f2585bb9a7295ecd630a1a76f5da1bfdea101bb32cc5558f32acc7e5b

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14e58389a309f2bd7fe1bd22f6db8b3116f6e2f749e1f833afa58c06e8a663e6
MD5 06b5104e986ef742256b95693b03e392
BLAKE2b-256 01161cd3e7182f67d800f84044256bf6c11da72d5f00604ac16bdd209d1cdeea

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7a35d39f086dc683d59c3b2004d4c21ede1122336ca5cd1af85f350d10ec32a1
MD5 92bc610cf37a21419cc7b443f6344b91
BLAKE2b-256 0cdbb849173e8689f796c6e75d4354a84d69f48655ac537108ca132e841886c6

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8e52795d4b78829b28120cfd9c4fe8d1a90e1dd4a37140cc8390a58449e9fc63
MD5 ef61595126ea31e3c7d7d1fca61b368e
BLAKE2b-256 b589b5aad2d8744924a4c743231aefac8e5132d9c26544f3195f9293d82617d6

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc6a0f3a29338777754e1861ad6637d700906b17193693080763504a6d7ea05d
MD5 70f5013313cbe5712283d9ff76fc1e16
BLAKE2b-256 9dcc75e7a9af8ed6882a8bb837ac49d5561b3d2fb5ae4278dc595e90f491b698

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ed2eec73f600dd37a6cb50a41d09467947bb85e70df39b673e8594fe24216535
MD5 2c939c9e7bd9289c02a356789c114441
BLAKE2b-256 9fe4f8d6521dab9f97d95090fb9006096abb2d80d76ce60a07133ac2e60fe072

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4e2a087f0397a320bccda51945916e6389ad7ec81538e91407b0f514b57ea823
MD5 ade0984215976f1b9b389d313b9174a4
BLAKE2b-256 c6163d7deb667a8757f6c0fe9014f051933608800f3901cae798d63684e357e3

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 902e9e8a6a73ced580a23951b3164c5c6c660eb6a8d56543d7e072f3a5d79b2a
MD5 0a4d910b7735d6c9e968765b2d43ccfb
BLAKE2b-256 55f6a57ca3ff7a848a66f979d0bb241c4d667410b65f2b5c681890eaf0aaa23c

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fast_reading-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 139.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fast_reading-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b0a6eab2cde8896c345c6489e6ce2cb1cad02c77128619a7816bfc99a2fa4584
MD5 1649e0c3ff7d33db24d693dbb68a9525
BLAKE2b-256 625efce2c46ff6273ca6a97ff6829b7860fcdbc63b70c6634bca6879f5038b3a

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c3127dcd067e9e107aa5d867127be49d7681650290ea4f014d0c56352dc5dfe0
MD5 944bdc5fdde5df87e13236e670417998
BLAKE2b-256 6f01e99a32a956fdf548f9fcca353011b95ecab26f6137dec562794b05b0836e

See more details on using hashes here.

File details

Details for the file fast_reading-0.1.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_reading-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9bb97750fdcc33548b0a942377d6441f99490bb7f373873ffe3cd6720447999
MD5 77491b09baa7139740e58a14ad1ca534
BLAKE2b-256 e8cc08bab96556fc0a2d9b8e5322e7e33127b265d4e97b7e0101c145fb5c0f50

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