Skip to main content

Lazy generator pipelines

Project description

sloths

PyPI Python 3.x Tests Documentation Status License

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 throughput 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 check out the full usage documentation or the cookbook.

Installation

The project is released on PyPI.

pip install sloths

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

sloths-0.0.4.tar.gz (66.9 kB view details)

Uploaded Source

Built Distribution

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

sloths-0.0.4-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file sloths-0.0.4.tar.gz.

File metadata

  • Download URL: sloths-0.0.4.tar.gz
  • Upload date:
  • Size: 66.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for sloths-0.0.4.tar.gz
Algorithm Hash digest
SHA256 dee0257fb480cfefd310febeba450353164de9bf9432b76a43fd9a3dad6ae259
MD5 077348d5b285933a22cb849888a2d625
BLAKE2b-256 d68a12885e3b2cc9aafa805dff36aa58ec9e96d6cff0c4e30619e62cb86da06f

See more details on using hashes here.

File details

Details for the file sloths-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: sloths-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for sloths-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2f102839a26a6a6e9b8fcaff44a4d01362a2269b1a4563ef1c8ac2e9d6509bec
MD5 21760227b8becb185b1cba813c8681e5
BLAKE2b-256 6673ae636a3f297080b0d3b6beb1a94be7a7588e37bd49ea3914e12ca679717a

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