Skip to main content

List processing tools and functional utilities

Project description

Build Status Coverage Status Version Status

A set of utility functions for iterators, functions, and dictionaries.

See the PyToolz documentation at https://toolz.readthedocs.io

LICENSE

New BSD. See License File.

Install

toolz is on the Python Package Index (PyPI):

pip install toolz

Structure and Heritage

toolz is implemented in three parts:

itertoolz, for operations on iterables. Examples: groupby, unique, interpose,

functoolz, for higher-order functions. Examples: memoize, curry, compose,

dicttoolz, for operations on dictionaries. Examples: assoc, update-in, merge.

These functions come from the legacy of functional languages for list processing. They interoperate well to accomplish common complex tasks.

Read our API Documentation for more details.

Example

This builds a standard wordcount function from pieces within toolz:

>>> def stem(word):
...     """ Stem word to primitive form """
...     return word.lower().rstrip(",.!:;'-\"").lstrip("'\"")

>>> from toolz import compose, frequencies
>>> from toolz.curried import map
>>> wordcount = compose(frequencies, map(stem), str.split)

>>> sentence = "This cat jumped over this other cat!"
>>> wordcount(sentence)
{'this': 2, 'cat': 2, 'jumped': 1, 'over': 1, 'other': 1}

Dependencies

toolz supports Python 3.9+ with a common codebase. It is pure Python and requires no dependencies beyond the standard library.

It is, in short, a lightweight dependency.

CyToolz

The toolz project has been reimplemented in Cython. The cytoolz project is a drop-in replacement for the Pure Python implementation. See CyToolz GitHub Page for more details.

See Also

  • Underscore.js: A similar library for JavaScript

  • Enumerable: A similar library for Ruby

  • Clojure: A functional language whose standard library has several counterparts in toolz

  • itertools: The Python standard library for iterator tools

  • functools: The Python standard library for function tools

Project Status

This project is alive but inactive.

The original maintainers have mostly moved on to other endeavors. We’re still around for critical bug fixes, Python version bumps, and security issues and will commit to keeping the project alive (it’s highly depended upon). However, beyond that we don’t plan to spend much time reviewing contributions. We view Toolz as mostly complete.

We encourage enthusiasts to innovate in new and wonderful places 🚀

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

toolz-1.1.0.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

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

toolz-1.1.0-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file toolz-1.1.0.tar.gz.

File metadata

  • Download URL: toolz-1.1.0.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toolz-1.1.0.tar.gz
Algorithm Hash digest
SHA256 27a5c770d068c110d9ed9323f24f1543e83b2f300a687b7891c1a6d56b697b5b
MD5 c6ba0b5adf0a988db621136eb7119c61
BLAKE2b-256 11d6114b492226588d6ff54579d95847662fc69196bdeec318eb45393b24c192

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolz-1.1.0.tar.gz:

Publisher: publish_pypi.yml on pytoolz/toolz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file toolz-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: toolz-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toolz-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15ccc861ac51c53696de0a5d6d4607f99c210739caf987b5d2054f3efed429d8
MD5 1ce76b95c6c795a40f0114a10282eccb
BLAKE2b-256 fb125911ae3eeec47800503a238d971e51722ccea5feb8569b735184d5fcdbc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolz-1.1.0-py3-none-any.whl:

Publisher: publish_pypi.yml on pytoolz/toolz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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