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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

SeqTools-1.3.0-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.3.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.3.0-cp310-cp310-win_amd64.whl (37.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

SeqTools-1.3.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.3.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.3.0-cp39-cp39-win_amd64.whl (37.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

SeqTools-1.3.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.3.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.3.0.tar.gz.

File metadata

  • Download URL: SeqTools-1.3.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.5

File hashes

Hashes for SeqTools-1.3.0.tar.gz
Algorithm Hash digest
SHA256 7aec1d451cf7786a816c572119e26818ab4a3fe2d48d877d7d4cccedf4226df8
MD5 86d1710c1176e953654dcdac6c310cb9
BLAKE2b-256 1b3efdc6f37e0e18f76a8ef6301335c9d7a50f7f7b4cfdebe8192e4a070554f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.3.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.5

File hashes

Hashes for SeqTools-1.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 105c81b1623c1c8ff3d2fba115d0b6d09be499a249f3b1724eea3ea4c774c3dd
MD5 c6ef03376c09ae0f478dda9e54b04468
BLAKE2b-256 16823b7d0f3ee578a25e1b90b52b91bcdfac03816b96dcae9b8bbea5a5da727a

See more details on using hashes here.

File details

Details for the file SeqTools-1.3.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.3.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6b8eef15779f3a7e63ffef85720bd7f5cefd902511d48cfe0676f9027312a96
MD5 b04e3a9a53349e7c1cb85935ca2304a2
BLAKE2b-256 641b5691f820e1414f26eecc29dbe0f08663c18fe3df77acadef4114b277c672

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca95d475acc265469adf8cb8277bcd7f08e21d9a2f90f22224080301ad750639
MD5 a436176ed827f8362cfc1959fefe95f7
BLAKE2b-256 64cbe9d9827e7a34a45435f6121a99384a64627d94a01d223ac9d4ab9a6a2324

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.3.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.5

File hashes

Hashes for SeqTools-1.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9effe9a42bba93dca5bfb8d9fe0eca5fd482ac79bf79cedfac69e8f25bab3e5d
MD5 c36cd71c407129e5370eb1add4bb5c00
BLAKE2b-256 bc1c6280cdae8b4210b336c0187edc4c55a54965963af456f607d4485d82c0bb

See more details on using hashes here.

File details

Details for the file SeqTools-1.3.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.3.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 964e148639d59606033ff87d450adbdb0fc413b7789c3539aa2ffa74199341c8
MD5 e2318af0da981a18c4932f38d2e24961
BLAKE2b-256 ff20aac95c675e923b3c5d82dee19b077adceb38034200b27aa2fe43239f01f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a264b37bf092cc642aac41bb476ea2aecc12f77fbd610cb24e4b4f2c5b9b2c7f
MD5 e7ddb158e0e377fac3eb280faf1db4d4
BLAKE2b-256 a253c8e18bd6221d9c8a5233ec98d0bba4e83c3e256a276c68ff4be6914d5290

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SeqTools-1.3.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.5

File hashes

Hashes for SeqTools-1.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 edfc508478d16e04c8b00519fd8ea24af380f2ef408f0826234199554982a2dc
MD5 41e56ff8937e4d0549d4c30820cacaf6
BLAKE2b-256 822233d8d6d04de36637383f20a67ef3b413b536028ca96bbe780cfa1c94455c

See more details on using hashes here.

File details

Details for the file SeqTools-1.3.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.3.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 607b9bb744b39454e6ded109c8e61d6e29feb7e5e0ddde208ec96a7d042c8612
MD5 367413ff92c1d749a94c619c83585254
BLAKE2b-256 2dd44ccaca4bd6b5f219a68caf5a8a7dc21f65a1f041d5db22bb7a0ba429070c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SeqTools-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a149e1274175034ae63cf7d51ee1a7d9da0ac4913de878bdba1af915233ab7b
MD5 5e90f684ade7f4e222368c6d7da863ff
BLAKE2b-256 32ffbf4acf0f8e8b0b81d301d1e3e98db8220bb0edc62e1ef27f39d682edac55

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