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.5.tar.gz (67.4 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.5-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sloths-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1dd354d6caf316ac1751a0cf55421c1aacc1d25b16ee7e20c1b52efacaae328e
MD5 5dc109d2ff51b328c961c77d21cbf71f
BLAKE2b-256 fe6b8ee38b08c21801a14833364ce748bc0badea061e899321e3fc68f60782a2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sloths-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cfb26928fdc06425825dbc10ce15bd141fa5f62b32e9d61a27ec3b5bcae87752
MD5 aeea30055f78b545bad89aa98b325c32
BLAKE2b-256 685aac48878342e6fa7001ad0efa78c40bb8ddedcff0e492018132713645071f

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