python / python/mypy

Option to run non-interactive and fail if --install-types is dirty.

Open
#14,320 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature
When running mypy non-interactivelly in CI, i want to assert that all types-XXX packages required are already pre-installed on the build-server (docker image). Because that way they can be pinned and reviewed while being installed, instead of it happening without supervision through mypy.
Today there is no reliable way to do so, --install-types can only prompt Y/N in interactive mode. In --non-interactive mode it will always assume yes.

Proposing a new flag --no-install-types, that when used together with --non-interactive will fail if same call with --install-types would have suggested any stub packages to be installed.

In scenario above, there can also be stubs that are not desired (one example is types-Sqlalchemy conflicting with sqlalchemy2-stubs). To allow such to be ignored and not always fail the --no-install-types check. There also need to be an option in mypy.ini for always-ignore-types.

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 tracing the existing --install-types and --non-interactive entry points and how mypy.ini options are read. Define the behavior for --no-install-types, including failure when packages would be installed and exclusions from always-ignore-types; done means CI can detect missing required stubs without prompting while permitting configured exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
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.