Skip to main content

A library for transparent transformation of indexable containers (lists, etc.)

Project description

PyPi package Documentation

SeqTools

SeqTools extends the functionalities of itertools to indexable (list-like) objects. Some of the provided functionalities include: element-wise function mapping, reordering, reindexing, concatenation, joining, slicing, minibatching, etc.

SeqTools functions implement on-demand evaluation under the hood: operations and transformations are only applied to individual items when they are actually accessed. A simple but powerful prefetch function is also provided to eagerly evaluate elements in background threads or processes.

SeqTools originally targets data science, more precisely the data preprocessing stages. Being aware of the experimental nature of this usage, on-demand execution is made as transparent as possible by providing fault-tolerant functions and insightful error message.

Example

>>> def count_lines(filename):
...     with open(filename) as f:
...         return len(f.readlines())
>>>
>>> def count_words(filename):
...     with open(filename) as f:
...         return len(f.read().split())
>>>
>>> filenames = ["a.txt", "b.txt", "c.txt", "d.txt"]
>>> lc = seqtools.smap(count_lines, filenames)
>>> wc = seqtools.smap(count_words, filenames)
>>> counts = seqtools.collate([lc, wc])
>>> # no computations so far!
>>> lc[2]  # only evaluates on index 2
3
>>> counts[1]  # same for index 1
(1, 2)

Batteries included!

The library comes with a set of functions to manipulate sequences:

concatenate

concatenate

batch

batch

gather

gather

prefetch

prefetch

interleave

interleave

uniter

uniter

and others (suggestions are also welcome).

Installation

pip install seqtools

Documentation

The documentation is hosted at https://seqtools-doc.readthedocs.io.

Contributing and Support

Use the issue tracker to request features, propose improvements or report issues. For questions regarding usage, please send an email.

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

SeqTools-1.2.3.tar.gz (595.7 kB view details)

Uploaded Source

Built Distributions

SeqTools-1.2.3-cp311-cp311-win_amd64.whl (37.3 kB view details)

Uploaded CPython 3.11 Windows x86-64

SeqTools-1.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (44.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

SeqTools-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

SeqTools-1.2.3-cp310-cp310-win_amd64.whl (37.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

SeqTools-1.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (44.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

SeqTools-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

SeqTools-1.2.3-cp39-cp39-win_amd64.whl (37.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

SeqTools-1.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (44.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

SeqTools-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl (34.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file SeqTools-1.2.3.tar.gz.

File metadata

  • Download URL: SeqTools-1.2.3.tar.gz
  • Upload date:
  • Size: 595.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for SeqTools-1.2.3.tar.gz
Algorithm Hash digest
SHA256 62de138e188885ef4c98a4893ba60069dcbfcf8225c4c6ea73d73433e4b3bb0b
MD5 3726ac4937d4d240ea221d67be180159
BLAKE2b-256 1a66c27b8d431715538f7950f362ae7c1162554f1797f386cc415807a418ab18

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: SeqTools-1.2.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for SeqTools-1.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2e87208fa6751307cad48318956df79be9238b93f3ee29947b58379ddd055c24
MD5 980ea5444f607cfa012449af2261dd66
BLAKE2b-256 9e856b64b11c5e5368fdac919a1d8be5adaeee3a267fb43142d90de259beacf7

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07a7545426900ece4eab3fa9baa05fabca4e82ed0314f43711dacac68eeef872
MD5 68733f751dec4039f4c62745c71c35ab
BLAKE2b-256 8faabc893c73b735d1834d5a3abb4c08e169cb9d6486d7c28533b0c18b113785

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 11e888511da83fcfbf526b9e28b6cb6ca6ed65b441db17c0687999eb2d3d67fb
MD5 4e946efd856cf0249800553b01bbd455
BLAKE2b-256 a61c20a6869f8fad49dccbe93c32536fd8689b42a0a19c960b54805c98465f3e

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: SeqTools-1.2.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for SeqTools-1.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0a6c75a84d4a1f0e8378acbc9e3a4aa2cc5fdcea6c7666ba0718b91c96d9b7f1
MD5 f8f5ac83178a912d7cca3661e6a8cc95
BLAKE2b-256 2fcc51546ac1b25e05ff2f2bc2ea9d13477a24178dcb3453a1851053970e48d5

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8cf8abffc1f8d00e65f416a994d254780f6aa25dd4000dd3a494de23acc67e4
MD5 7189d55d4524c8112c6fdb0230bf100e
BLAKE2b-256 1f14410047be58c8259dc2356162a1cf1ac5eb1340d4cf4d779efe98bd446450

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ce0973ccf6f7da51801026aca0eb82ec68a96a036e8be4579d4e34bebc0b77b
MD5 9e96a0f6c1656603065b92059d8e0624
BLAKE2b-256 2ca0394b5f18aeaccf4ae5ce37bf3ab437f0636e6c523d1ca2de7d7dd001a26e

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: SeqTools-1.2.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for SeqTools-1.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f53611e016701f8f5b7e082d5f381fb3cb14f600d220b31a2f8a0cc2578e04f6
MD5 8a104911a6fbef3b0492be03244d25ab
BLAKE2b-256 bafb010051b63b4983cca9b072499baea927e91ff366ab0a8128520f50c6668d

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de88941d51fce71bd1b6aeb11d9485dd34ddc806eb458f91f81b977e97151d04
MD5 d1864ccffb8394d977e9d0b5af78cd83
BLAKE2b-256 dcb53b258ef75cdf8f9d984a36c98fabe1e416297520f006b469541d1e188552

See more details on using hashes here.

File details

Details for the file SeqTools-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for SeqTools-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3a569bddffe91c4c40a620294264efbdae918c8c501119887f068f14ea0d863
MD5 aaaf277d4dee68c35de7757f647013bd
BLAKE2b-256 f2c60bed6755a6e4e0ce391b72a5a635b727d59907fac061d36c62b3905599f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page