jaraco / jaraco/jaraco.functools

`chainable` is incorrectly typed

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
22
Forks
16
PR merge metrics
No merged PRs in 30d

Description

https://github.com/jaraco/jaraco.functools/blob/e4644e208414137c3c2618bd1c1c1dcf23a895bc/jaraco/functools/__init__.py#L667-L670

Needs to be rewritten to

```py
_T = TypeVar('_T')
_P = ParamSpec('_P')

def chainable(method: Callable[Concatenate[_T, _P], None]) -> Callable[Concatenate[_T, _P], _T]:
```

with `Concatenate` from `typing_extensions` (and `typing` if 3.9 is not supported, so past 2025-10).

It must as well be added to stubs, not (just) inline with the code.
`stubtest` fails now:

```
❯ stubtest jaraco.functools
error: jaraco.functools.chainable is not present in stub
Stub: in file /home/bswck/Hobby/jaraco.functools/jaraco/functools/__init__.pyi
MISSING
Runtime: in file /home/bswck/Hobby/jaraco.functools/jaraco/functools/__init__.py:650
def (method: 'Callable[[_T, ...], None]') -> 'Callable[[_T, ...], _T]'

Found 1 error (checked 1 module)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with jaraco/functools/__init__.py at the linked chainable definition and compare it with jaraco/functools/__init__.pyi. Run stubtest jaraco.functools before and after the change; done means the stub exposes chainable with the requested ParamSpec and Concatenate signature without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.