Skip to content

mypy should search parent directories for pyproject.toml config file #10613

Closed
@benburk

Description

@benburk

Bug Report

First of all, thank you for supporting the highly requested pyproject.toml config format #5205

I'm hoping we can resolve an issue to bring mypy inline with several others including but not limited to isort, black, and pylint. I think mypy should search parent directories for pyproject.toml config file. I think mypy should search up until the user's home directory (or ~25 directories, whichever comes first) for config files.

To Reproduce

Prepare a project such as this

outer/
    inner/
        main.py
    pyproject.toml

From inside the inner directory, run mypy main.py

Expected Behavior

I expect mypy to use the settings defined in the pyproject.toml file found in the parent directory outer. I'm guessing mypy only checks the directory it is invoked from.

Actual Behavior

The settings inside pyproject.toml are not used.

Your Environment

  • Mypy version used: 0.900
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9.4
  • Operating system and version: macOS 10.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-configurationConfiguration files and flags

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions