python / python/mypy

0.910 --install-types doesn't install stubs for 2nd level deps on first run

Open
#10,713 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

I use mypy in CI for a library, that depends on aiochsa. And aiochsa depends on backports.zoneinfo for python prior to 3.9. The first run of mypy --install-types --non-interactive -p my_package (the cache is empty) in python 3.8 environment installs all needed stub packages, except types-backports, causing pipeline to fail with "Library stubs not installed for "backports" (or incompatible with Python 3.8)" error. The second run of the same command installs missing types-backports and pipeline succeeds.

Expected Behavior

mypy --install-types --non-interactive … installs stubs for dependencies of dependencies on the first run (with clean cache).

Actual Behavior

mypy --install-types --non-interactive … installs stubs on the run for 1st level dependencies only.

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: --install-types --non-interactive -p …
  • Python version used: 3.8

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

Reproduce the issue with mypy 0.910 using Python 3.8, an empty cache, and mypy --install-types --non-interactive -p my_package. Trace the --install-types entry point and dependency discovery for aiochsa and backports.zoneinfo; done means the first run installs types-backports and the type-checking pipeline succeeds.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.