python / python/mypy

Consider adding new plugin API for checking implicit definitions

Open
#15,515 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature topic-plugins
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Feature

This PR introduces a new check for mypy: we now can find incompatible __post_init__ methods in @dataclasses: https://github.com/python/mypy/pull/15503/files#diff-f96a2d6138bc6cdf2a07c4d37f6071cc25c1631afc107e277a28d5b59fc0ef04R1048-R1050

But, the thing is that for now we are using a direct call to dataclasses internal plugin, because there are no ways to do it otherwise.

Pitch

Let's discuss possible options we have to introduce a new API that can solve this problem.

CC @ilevkivskyi (original reviewer), @Tinche (as you might be interested), @JukkaL

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 by reading the linked PR and the dataclasses internal plugin call described in this issue. Explore the possible plugin API designs for checking implicit definitions, with completion being an agreed approach that avoids the direct internal call.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.