Lazy generator pipelines
Project description
sloths
Lazy iterator pipelines for Python.
sloths is a library providing a chainable interface to easily compose lazy iterator pipelines in Python. The interface is largely inspired by Rust's Iterator trait (although it's not a carbon copy).
The 2 primary goals of the library are:
- Provide an easy to use, chainable and typed API for composing generator pipelines.
- Make it easy to control peak memory usage and throuhgput on large source datasets or long running input streams.
>>> from sloths import Stream
>>> Stream(range(100_000)).enumerate().filter(lambda x: x[1] % 3 == 0).skip(3).take(5).collect()
[(9, 9), (12, 12), (15, 15), (18, 18), (21, 21)]
For more examples see doctests within the code or usage.md.
Installation
The project is released on PyPI.
pip install sloths
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 Distribution
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 sloths-0.0.3.tar.gz.
File metadata
- Download URL: sloths-0.0.3.tar.gz
- Upload date:
- Size: 61.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc6b8b63f8b209be306b1afee36c175a01c81629490df43a2d97b6dad588c8cf
|
|
| MD5 |
32138251a3629475b9a5e1329e183ccf
|
|
| BLAKE2b-256 |
621545a21a519ac8a50b979fe8721434c8801e88c0b4601fea00b5257f2787d5
|
File details
Details for the file sloths-0.0.3-py3-none-any.whl.
File metadata
- Download URL: sloths-0.0.3-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8f47452f0b365ecddc40688aa277fc8705cc1f9789578b48a3370329c41e89c
|
|
| MD5 |
b1bb96258ec526c7958a8ace44176e11
|
|
| BLAKE2b-256 |
f3630fdff09416718ef5e9b708a4bb2e3b2874aab8ecf917cb5a4fa0594d5350
|