python / python/mypy

MYPYPATH should override mypy_path in config file (not extend it)

Open
#17,778 1 comment 0 reactions 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

The MYPYPATH environment variable should override the mypy_path config file option (not extend it).

Pitch

I propose the ability to override the mypy_path config file option with the the MYPYPATH environment variable. To make Visual Studio Code work with the Mypy extension for namespace packages, it is necessary to set mypy_path and explicit_package_bases, whereas I would like to disable the mypy_path option when running Tox (to typecheck the installed package). It is usually the case that environment variables have higher precedence over config file options, and this change would make Mypy consistent with the expected behavior.

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 locating mypy's configuration parsing and the existing MYPYPATH and mypy_path handling, then find tests covering configuration precedence or environment variables. Confirm the current behavior before changing it. Done means MYPYPATH replaces the config-file mypy_path value, while the existing behavior and related options remain covered by tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.