AnswerDotAI / AnswerDotAI/fastcore
`docments(full=True)` drops `**kwargs` docments unless `args_kwargs=True` is passed explicitly
- Dominant language
- Jupyter Notebook
- Stars
- 1.1k
- Forks
- 295
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 7
Description
`docments(..., full=True)` does not retain a trailing docment attached to `**kwargs`.
This contradicts the documentation in `04_docments.ipynb`, which says that `args_kwargs=True` is always enabled when `full=True`:
> ... (Note that for `full`, `args_kwargs=True` is always set too.)
## Reproduction
```python
from fastcore.docments import docments
def f(
**kwargs, # keyword arguments
): pass
docments(f, full=True)['kwargs']['docment']
```
Actual result:
```python
None
```
Expected result:
```python
'keyword arguments'
```
Passing `args_kwargs=True` explicitly produces the expected result:
```python
docments(f, full=True, args_kwargs=True)['kwargs']['docment']
# 'keyword arguments'
```
## Environment
- fastcore: 2.2.13
- Branch: `main`
## Likely cause
`docments()` passes `args_kwargs` unchanged to `_param_locs()`, even when `full=True`:
```python
p = _param_locs(s, returns=returns, args_kwargs=args_kwargs) or {}
```
This appears inconsistent with the documented behavior that full docments include variadic parameter docments.
A possible fix is to make `full=True` imply `args_kwargs=True`.
Contributor guide
Research direction
Start by reading docments() and _param_locs(), then run the supplied reproduction for a function with a trailing **kwargs docment. Check that full=True follows the documented behavior in 04_docments.ipynb and returns 'keyword arguments' without explicitly passing args_kwargs=True; preserve coverage for the explicit option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100