google-deepmind / google-deepmind/chex

Typing issue with chex.dataclass

Open
#155 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
957
Forks
74
Avg merge
21h 10m
Merged PRs (30d)
1

Description

Static type checkers like pyright, mypy, etc. will think `chex.dataclass`-decorated dataclass has a constructor with no parameters.

Example:

```
@chex.dataclass(frozen=True)
class Foo:
a: int
b: int
```

image

However, `Foo()` is not a valid call: A legitimate call would be something like `Foo(a=1, b=2)`. This does not agree with static type checker's analysis.

Compare the behavior with built-in dataclass:

image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.