google-deepmind / google-deepmind/chex
`chex.dataclass` wrapper causes type error: Expected no arguments to dataclass constructor
- Dominant language
- Python
- Stars
- 957
- Forks
- 74
- Avg merge
- 21h 10m
- Merged PRs (30d)
- 1
Description
Applying the [`chex.dataclass`](https://chex.readthedocs.io/en/latest/api.html#chex.dataclass) wrapper to a class yields the following error:
```python3
import chex
@chex.dataclass(frozen=True)
class Class:
x: int
Class(4)
```
```
$ pyright --version
pyright 1.1.337
$ python3 --version
Python 3.11.6
$ python3 -c "import chex; print(chex.__version__)"
0.1.85
$ pyright test.py
/Users/user/Desktop/test.py
/Users/user/Desktop/test.py:7:1 - error: Expected no arguments to "Class" constructor (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations
```
https://github.com/microsoft/pyright/issues/6536#issuecomment-1826087060
> This is a bug in the `chex` library. The `chex.dataclass` decorator has no type annotations despite the fact that the package contains a "py.typed" marker file.
https://github.com/microsoft/pyright/issues/6536#issuecomment-1862080880
> I recommend looking at the stdlib `dataclass` class in the typeshed `dataclass.pyi` stub.
https://github.com/python/typeshed/blob/main/stdlib/dataclasses.pyi
Contributor guide
Assessment
This issue has not been assessed yet.