python / python/mypy

Add --plugins command-line option

Open
#11,667 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature

It seems that currently the only way to make mypy load a plugin is to add it to the configuration file as plugins = .... I would love if it would be possible to invoke mypy in the command line with or without a given plugin enabled. For example:

mypy --plugins=mypy_django_plugin.main,other_plugin:custom_entry_point ...

Pitch

The main benefit of this feature is that it would allow us to dynamically load plugins when invoking mypy using mypy.api.run or when invoking mypy using the command line. Currently it is difficult to programmatically "inject" a plugin into a mypy run, this change would make this much easier.

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 mypy's command-line handling, the configuration-file plugins setting, and the mypy.api.run entry point mentioned in the issue. Determine how a --plugins value could enable the listed plugin entry points in both command-line and API runs, then verify that invocation with and without plugins behaves as requested.

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.