python / python/mypy

mypy_path option split on [:,] before environment variable expansion

Open
#9,214 2 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

Hi,

given an environment variable composed of multiple path, eg export A=/foo:/bar, using the following mypy.ini fails to recognize the two paths foo and bar

[mypy]
mypy_path = $A

This is a consequence of splitting the option on [:,] before expanding environment variables. (https://github.com/python/mypy/blob/master/mypy/config_parser.py#L85)

Would it be sufficient / not harmful to replace the parsing function with the following ?

lambda s: re.split('[,:]', expand_path(s.strip()))

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 in mypy/config_parser.py around line 85 and reproduce the issue with the shown mypy.ini and environment variable A. Check the path splitting and expansion order; done means a value such as $A expands into both /foo and /bar and both paths are recognized.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.