A fast reading file library for Python
Project description
Fast Reading
A fast reading file library for Python
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
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
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.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_reading-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fast_reading-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 228.1 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02aa4ecd97b8943849e49caa10c4f91c8f0f78cca719c94572a22b3e2d05f64d
|
|
| MD5 |
a770cd48b484540df3b555aaa1990f18
|
|
| BLAKE2b-256 |
48cac43f6dbb60dd763d9708ffab5f647778b1f8a266e5442fd546628b37dfc5
|