Skip to main content

Type stubs for toolz

Project description

toolz-stubs

CI

Type stubs for toolz and tlz - Python functional programming libraries.

Type hinting for cytoolz is available via tlz.

Installation

pip install toolz-stubs

This installs type stubs for both toolz and tlz.

Usage

Once installed, type checkers like mypy, pyright, or basedpyright will automatically use these stubs:

import toolz
from toolz import curry, compose, pipe

@curry
def add(x: int, y: int) -> int:
    return x + y

# Type checkers will understand these operations
add_five = add(5)  # Correctly typed as partial function
result = add_five(3)  # Type checked as int

The same types work with tlz:

import tlz
from tlz import curry, compose, pipe

# Identical API, same type hints
result = tlz.pipe(data, transform1, transform2)

What's Included

This package provides type stubs (.pyi files) for:

  • toolz: The pure Python functional programming library
  • tlz: The auto-selecting wrapper that uses cytoolz (if available) or falls back to toolz

Modules covered:

  • toolz.functoolz / tlz.functoolz - Function manipulation (curry, compose, pipe, etc.)
  • toolz.itertoolz / tlz.itertoolz - Iterator utilities (groupby, partition, sliding_window, etc.)
  • toolz.dicttoolz / tlz.dicttoolz - Dictionary operations (merge, valmap, keyfilter, etc.)
  • toolz.curried / tlz.curried - Pre-curried versions of all functions
  • toolz.recipes / tlz.recipes - Common recipes (countby, partitionby)
  • toolz.sandbox / tlz.sandbox - Experimental utilities

Development

make sync    # Install dependencies
make check   # Run type checker
make test    # Run tests
make lint    # Run linter
make format  # Check formatting
make build   # Build wheel

If manually running commands, be sure to specify --no-editable or hatchling will mispackage toolz & tlz packages.

Tests

The tests in tests/ serve a few purposes:

  • they verify runtime behavior with pytest.
  • they verify that these stubs geninely improve the developer experience in an IDE.
  • they are type-checked by basedpyright. This ensures the stubs match actual library behavior.

Contributing

Contributions are welcome! Areas that could use improvement:

  1. More precise generic types
  2. Additional overloads for functions with variable signatures
  3. Improved curry and composition typing
  4. Protocol types for duck-typed parameters

License

BSD 3-Clause (same as toolz)

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_stubs-0.2.2.tar.gz (59.3 kB view details)

Uploaded Source

Built Distribution

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

toolz_stubs-0.2.2-py3-none-any.whl (65.1 kB view details)

Uploaded Python 3

File details

Details for the file toolz_stubs-0.2.2.tar.gz.

File metadata

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

File hashes

Hashes for toolz_stubs-0.2.2.tar.gz
Algorithm Hash digest
SHA256 79f215db2f841f00c1b060b3755c904a35a5270dd97e3973d795287dbc204a2d
MD5 cec6bdb0d54a9a1bda8890cfe3048c4a
BLAKE2b-256 143d16268d92ca5a40db2484a3178a83ca3eab3ddda5a50ba15f2b9ea9b69201

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolz_stubs-0.2.2.tar.gz:

Publisher: publish.yml on mgrinshpon/toolz-stubs

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_stubs-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: toolz_stubs-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 65.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_stubs-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3a80e724bcf60852b4ebb9441123ca059a9fb4db4a852b04adfe4ceb3a008bb
MD5 5defe95b0e380bfe7ae9d2039fbfb20a
BLAKE2b-256 9926b9fcd9f41608e8f3fc541ce9589b70172a513a05b43d53335136780d1c8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolz_stubs-0.2.2-py3-none-any.whl:

Publisher: publish.yml on mgrinshpon/toolz-stubs

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