Type stubs for toolz
Project description
toolz-stubs
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 functionstoolz.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:
- More precise generic types
- Additional overloads for functions with variable signatures
- Improved curry and composition typing
- Protocol types for duck-typed parameters
License
BSD 3-Clause (same as toolz)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toolz_stubs-0.3.1.tar.gz.
File metadata
- Download URL: toolz_stubs-0.3.1.tar.gz
- Upload date:
- Size: 62.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277946eaafdd1d52cfd003fdfa08b485e9196af43bf800c6094a5a2b880fe1b0
|
|
| MD5 |
8a5dd8fd4fb20c2d1f38caae0edc3dfd
|
|
| BLAKE2b-256 |
ee986690a4f68c4eba338efcc03c22f91a866036987ef20f6c2378d2e67dc129
|
Provenance
The following attestation bundles were made for toolz_stubs-0.3.1.tar.gz:
Publisher:
publish.yml on mgrinshpon/toolz-stubs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolz_stubs-0.3.1.tar.gz -
Subject digest:
277946eaafdd1d52cfd003fdfa08b485e9196af43bf800c6094a5a2b880fe1b0 - Sigstore transparency entry: 804612964
- Sigstore integration time:
-
Permalink:
mgrinshpon/toolz-stubs@3603739d259d1b723f9a680a0e5d355d0dac519b -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mgrinshpon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3603739d259d1b723f9a680a0e5d355d0dac519b -
Trigger Event:
release
-
Statement type:
File details
Details for the file toolz_stubs-0.3.1-py3-none-any.whl.
File metadata
- Download URL: toolz_stubs-0.3.1-py3-none-any.whl
- Upload date:
- Size: 66.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
807cefdb67120e495bfc141af856391990b487391b4e8fda8fb06e2b9a04b9bf
|
|
| MD5 |
e12eac2197487253af4832a0d28bea2a
|
|
| BLAKE2b-256 |
396d457d956e8d9dae766d821444d10cbdbd4760a02e6e5be7c2b06a72a7521f
|
Provenance
The following attestation bundles were made for toolz_stubs-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on mgrinshpon/toolz-stubs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolz_stubs-0.3.1-py3-none-any.whl -
Subject digest:
807cefdb67120e495bfc141af856391990b487391b4e8fda8fb06e2b9a04b9bf - Sigstore transparency entry: 804612966
- Sigstore integration time:
-
Permalink:
mgrinshpon/toolz-stubs@3603739d259d1b723f9a680a0e5d355d0dac519b -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mgrinshpon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3603739d259d1b723f9a680a0e5d355d0dac519b -
Trigger Event:
release
-
Statement type: