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.4.0.tar.gz (595.9 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

SeqTools-1.4.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (44.7 kB view details)

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

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

SeqTools-1.4.0-cp310-cp310-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.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

SeqTools-1.4.0-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.4.0-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.4.0.tar.gz.

File metadata

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

File hashes

Hashes for SeqTools-1.4.0.tar.gz
Algorithm Hash digest
SHA256 bbd6ccf7acac51e5ca9e448115826c041ef1e86463b01579fbbdd8ccf03d4272
MD5 dbef4fba508efc53429ef6af54232d83
BLAKE2b-256 747e70a002f7d539d3f2501825f1c9d27c86ffea6e2a399324d822bf8adbd627

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.4.0-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.6

File hashes

Hashes for SeqTools-1.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c1f9fe3e0c9d308b4d6beb244ae0246017ef5cb65e5c79111109197fb84794a6
MD5 31254ec737d1532ddeed6e2612f20c21
BLAKE2b-256 f60cca76ff0293d7c46b5844ee09eeb784868f0edd1ae29a891f5d172c0072f1

See more details on using hashes here.

File details

Details for the file SeqTools-1.4.0-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.4.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 833bf981d7c0892396581c8cff6d4b492b98bc4911a9965e386bf6abe27db04e
MD5 28c0a3d0e5d86772ebb1799bf7ef72e7
BLAKE2b-256 c791d6ed34d669d6662aeab11a285de928d1167f59fcb2fa9efe9a78921afb49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ccd87d5a020b42be9ab185dea7afaa13a12201af530d37d1e104e60de03e1239
MD5 69bc3b176eb37b0c78c149d860a0f514
BLAKE2b-256 4f2bc543b4b7a96e4c7625eba716e75b9a18ec389d7f0aca70c1ddd84c6f1917

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.4.0-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.6

File hashes

Hashes for SeqTools-1.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a2af6e5b293c9a347350a115a22f4504321cec7100693b3c2508937afe074a5
MD5 92d929a18204cb84d18d92df1ecce3f6
BLAKE2b-256 eb6f01a7b5b798f42eab1484867391dfff98652dfd7e6868d6db6d82e02121a4

See more details on using hashes here.

File details

Details for the file SeqTools-1.4.0-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.4.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f838575f0cc69feaefbbe1461d04e751dd3f7f1edaa03f15434836a609f4574
MD5 ed45c8db82aa590c8d9089519b832ef8
BLAKE2b-256 1cd37075e270fef79313921be6906969f0098df5cd97fa69f75fdaa7a86a1865

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a4aee7de67b7d4be90ba7ebed5cccc74399ee066b41e47bc7a135fa785af63e4
MD5 2cb01c03976dda699c40ddfdfd2adab9
BLAKE2b-256 cde36f28df007db6416995510e6cadc9c3baed2cfed9c6565a91590684f369c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.4.0-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.6

File hashes

Hashes for SeqTools-1.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 864f6fb48fc67d700f0b089bd68b6a96a6a50d0622a3229e664f3aa4c519b823
MD5 cf3c42c70ef1df6f0a2d6296fc472a0b
BLAKE2b-256 436f0bc1edf884eec345e7b88e1ea0c4a2d6d73cd4f73120e7d98c5927a8f077

See more details on using hashes here.

File details

Details for the file SeqTools-1.4.0-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.4.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4722abe6aed0d8e89a1db95b36edd0fd44390ef2f9a1301416de50301247c9c2
MD5 1af469a006f43e2795b782dbc3762dbf
BLAKE2b-256 edccf5631a46b4993494b9bf227f2e5eed2f4d3a49563c6a86fc048d38ed8662

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b35f682088d9bbf08a6e554d4a01f28f621f07b9373098d63df82b3f3f38cfb
MD5 1b6d36c4b470ac76d92147581b787d3b
BLAKE2b-256 f172823522e64985d738b05046a3a2e9062be39b3314e8b2095110e95e61087d

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