Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Typing problem for validator collections

Open
#1,244 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start by locating the deep_iterable validator and its type annotations, then compare how list and tuple values are typed for member_validator. The change is complete when mypy accepts the shown example with a list of validators, while the existing tuple behavior remains valid.

Written by the indexing model from the issue text.

Description

This is a copy of the second issue collected in https://github.com/python-attrs/attrs/issues/1206 to enable separate tracking of the bug.

The issue

Consider the following piece of code:

@define
class A:
    x: List[str] = field(
        validator=deep_iterable(
            member_validator=[instance_of(str), min_len(1)],
            iterable_validator=and_(instance_of(list), min_len(1)),
        ),
    )

When a list of validators is passed for member_validator, mypy complains about the type, as already pointed out in https://github.com/python-attrs/attrs/issues/1197. However, when a tuple is used instead, mypy is happy.

Dominant language
Python
Stars
5.8k
Forks
490
Avg merge
3d 12h
Merged PRs (30d)
3

Getting set up

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.

More from python-attrs/attrs

All issues in python-attrs/attrs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.