python / python/mypy

Config file format is inconvenient when you have a lot of untyped dependencies

Open
#8,918 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature needs discussion topic-usability
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

  • Are you reporting a bug, or opening a feature request?

Feature request.

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.

When a project with many dependencies is ported to mypy, it will typically have to tell mypy to ignore the imports of these many dependencies. That means that the mypy.ini config file will look like this

[mypy-numpy]
ignore_missing_imports = True
[mypy-cv2]
ignore_missing_imports = True
[mypy-bson,bson.*]
ignore_missing_imports = True

For big projects, this list will be very long.

  • What is the behavior/output you expect?

It would be nice if you could specify the list as a single option in the mypy config file:

[mypy]
ignore_missing_imports =
    numpy
    cv2
    bson
    ...

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

Begin with the mypy.ini examples in the issue, then locate mypy's configuration parser and tests for per-module options. Check how repeated ignore_missing_imports sections and dotted patterns such as bson.* are currently handled. Done means a single list-style setting applies the option to each named module or pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.