Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6f81ca1
Add core cytoolz stub files
BobTheBuidler Jan 18, 2026
c956619
Add dicttoolz/functoolz/itertoolz stubs
BobTheBuidler Jan 18, 2026
f0b3acf
Add curried stub files
BobTheBuidler Jan 18, 2026
870205c
Include stub package data in pyproject
BobTheBuidler Jan 18, 2026
c766afd
Align pyproject with upstream; add setup.cfg for stub package data
BobTheBuidler Jan 18, 2026
5f01519
Add mypy job for stub checks
BobTheBuidler Jan 18, 2026
d674d55
Sync upstream configs and add mypy stubs job
BobTheBuidler Jan 19, 2026
e69b8bf
Sync upstream core sources
BobTheBuidler Jan 19, 2026
9354cc8
Sync upstream dicttoolz/functoolz
BobTheBuidler Jan 19, 2026
8528290
Sync upstream itertoolz.pyx
BobTheBuidler Jan 19, 2026
fc54f84
Update curried stubs
BobTheBuidler Jan 19, 2026
29fa0dd
Update core stubs
BobTheBuidler Jan 19, 2026
4dd93df
Sync test_functoolz.py
BobTheBuidler Jan 19, 2026
dce830e
Sync test_inspect_args.py
BobTheBuidler Jan 19, 2026
a8a8c65
Sync test_itertoolz.py
BobTheBuidler Jan 19, 2026
7d1716b
Sync remaining tests
BobTheBuidler Jan 19, 2026
d6232d3
Remove .gitattributes
BobTheBuidler Jan 19, 2026
b5c6ce8
Remove conda.recipe/bld.bat
BobTheBuidler Jan 19, 2026
aa2f8b1
Remove conda.recipe/build.sh
BobTheBuidler Jan 19, 2026
e0ce7b5
Remove conda.recipe/meta.yaml
BobTheBuidler Jan 19, 2026
e88203f
Remove cytoolz/_version.py
BobTheBuidler Jan 19, 2026
e13c711
Remove setup.cfg
BobTheBuidler Jan 19, 2026
2bf8935
Remove versioneer.py
BobTheBuidler Jan 19, 2026
9cf9e14
Fix test sync issues
BobTheBuidler Jan 19, 2026
d2e6459
Add mypy config and include stub package data
BobTheBuidler Jan 19, 2026
030507c
Revert setup.py package data to avoid merge conflicts
BobTheBuidler Jan 19, 2026
ab1e89d
Fix curry class syntax for mypy parser
BobTheBuidler Jan 19, 2026
52f6dc3
Fix mypy stub errors
BobTheBuidler Jan 19, 2026
80627d7
Merge upstream master into typing-stubs-upstream
BobTheBuidler Jan 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ permissions:
contents: read

jobs:
mypy-stubs:
name: Mypy (stubs)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install mypy
run: |
python -m pip install --upgrade pip
pip install mypy typing_extensions
- name: Type check stubs
run: |
python -m mypy --config-file mypy.ini

test:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
87 changes: 87 additions & 0 deletions cytoolz/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Builtins - re-export to make them available in toolz namespace
from builtins import filter as filter, map as map, sorted as sorted
from functools import partial as partial, reduce as reduce

# Re-export all public APIs from submodules
# Submodules
from . import curried as curried

# Specific functions
from .dicttoolz import (
assoc as assoc,
assoc_in as assoc_in,
dissoc as dissoc,
get_in as get_in,
itemfilter as itemfilter,
itemmap as itemmap,
keyfilter as keyfilter,
keymap as keymap,
merge as merge,
merge_with as merge_with,
update_in as update_in,
valfilter as valfilter,
valmap as valmap,
)
from .functoolz import (
apply as apply,
complement as complement,
compose as compose,
compose_left as compose_left,
curry as curry,
do as do,
excepts as excepts,
flip as flip,
identity as identity,
juxt as juxt,
memoize as memoize,
pipe as pipe,
thread_first as thread_first,
thread_last as thread_last,
)
from .itertoolz import (
accumulate as accumulate,
concat as concat,
concatv as concatv,
cons as cons,
count as count,
diff as diff,
drop as drop,
first as first,
frequencies as frequencies,
get as get,
groupby as groupby,
interleave as interleave,
interpose as interpose,
isdistinct as isdistinct,
isiterable as isiterable,
iterate as iterate,
join as join,
last as last,
mapcat as mapcat,
merge_sorted as merge_sorted,
nth as nth,
partition as partition,
partition_all as partition_all,
peek as peek,
peekn as peekn,
pluck as pluck,
random_sample as random_sample,
reduceby as reduceby,
remove as remove,
second as second,
sliding_window as sliding_window,
tail as tail,
take as take,
take_nth as take_nth,
topk as topk,
unique as unique,
)
from .recipes import countby as countby, partitionby as partitionby

# Aliases
comp = compose

# Version attribute (available via __getattr__ at runtime)
__toolz_version__: str

__version__: str
28 changes: 28 additions & 0 deletions cytoolz/_signatures.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import typing

class _AnyCallable[ReturnT](typing.Protocol):
def __call__(self, *args: object, **kwargs: object) -> ReturnT: ...

Signature = _AnyCallable[object]
SignatureInfo = dict[str, list[Signature]]

cytoolz_info: dict[str, SignatureInfo]
module_info: dict[str, SignatureInfo]


def create_signature_registry(info: dict[str, SignatureInfo]) -> None: ...

def update_signature_registry() -> None: ...


def _is_arity(func: Signature, n: int) -> bool: ...

def _has_varargs(func: Signature) -> bool: ...

def _has_keywords(func: Signature) -> bool: ...

def _num_required_args(func: Signature) -> int: ...

def _is_partial_args(func: Signature, args: tuple[object, ...], kwargs: dict[str, object]) -> bool: ...

def _is_valid_args(func: Signature, args: tuple[object, ...], kwargs: dict[str, object]) -> bool: ...
15 changes: 15 additions & 0 deletions cytoolz/_version.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import typing

VersionInfo = typing.TypedDict(
"VersionInfo",
{
"version": str,
"full-revisionid": str | None,
"dirty": bool | None,
"error": str | None,
"date": str | None,
},
)


def get_versions() -> VersionInfo: ...
32 changes: 32 additions & 0 deletions cytoolz/compatibility.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from builtins import filter as filter, map as map, range as range, zip as zip
from functools import reduce as reduce
from itertools import filterfalse as filterfalse, zip_longest as zip_longest
import collections.abc
import typing

__all__ = (
"map",
"filter",
"range",
"zip",
"reduce",
"zip_longest",
"iteritems",
"iterkeys",
"itervalues",
"filterfalse",
"PY3",
"PY34",
"PYPY",
)

PY3: bool
PY34: bool
PYPY: bool


def iteritems[K, V](mapping: collections.abc.Mapping[K, V]) -> collections.abc.ItemsView[K, V]: ...

def iterkeys[K, V](mapping: collections.abc.Mapping[K, V]) -> collections.abc.KeysView[K]: ...

def itervalues[K, V](mapping: collections.abc.Mapping[K, V]) -> collections.abc.ValuesView[V]: ...
Loading