python-attrs / python-attrs/cattrs

Mypy error on structure

Open
#111 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked-upstream
Dominant language
Python
Stars
1.1k
Forks
159
Avg merge
12h 21m
Merged PRs (30d)
6

Description

  • cattrs version: 1.1.2
  • Python version: 3.8.6
  • Operating System: Linux x86-64
Description

Run mypy on first example from readme and get error.

What I Did
import cattr
from typing import Tuple

cattr.structure([1.0, 2, "3"], Tuple[int, int, int])

$ mypy example.py
example.py:4: error: Argument 2 has incompatible type "object"; expected "Type[<nothing>]"
Found 1 error in 1 file (checked 1 source file)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the first example in the README and reproduce the reported command using example.py and mypy. Trace the type information for cattr.structure's second argument and confirm that the example type-checks without the reported error. Use the issue's Python 3.8.6 and cattrs 1.1.2 details when validating the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.