Skip to content

[1.15 regression] mypy does not use $HOME/.mypy.ini, if .git directory exists #18650

Closed

Description

@suonpaa

After upgrading to mypy 1.15.0, I found mypy no longer reads configuration from ~/.mypy.ini. This seems to happen if project directory has directory .git, even if no other configuration is provided, for instance in pyproject.toml.

For testing purposes, I created faulty configuration.

~/.mypy.ini:

[mypy]
incorrect = True

With mypy 1.14.0:

suonpaa@deb:~/src/test$ mypy --version
mypy 1.14.0 (compiled: yes)
suonpaa@deb:~/src/test$ mypy .
/home/suonpaa/.mypy.ini: [mypy]: Unrecognized option: incorrect = True
Success: no issues found in 1 source file
suonpaa@deb:~/src/test$ mkdir .git
suonpaa@deb:~/src/test$ mypy .
/home/suonpaa/.mypy.ini: [mypy]: Unrecognized option: incorrect = True
Success: no issues found in 1 source file

With mypy 1.15.0:

suonpaa@deb:~/src/test$ mypy --version
mypy 1.15.0 (compiled: yes)
suonpaa@deb:~/src/test$ mypy .
../../.mypy.ini: [mypy]: Unrecognized option: incorrect = True
Success: no issues found in 1 source file
suonpaa@deb:~/src/test$ mkdir .git
suonpaa@deb:~/src/test$ mypy .
Success: no issues found in 1 source file
suonpaa@deb:~/src/test$

Just to be clear: no mypy.ini or pyproject.toml in this directory or in its parents.

I would expect this change being related to #16965 and / or #18482.

Activity

  1. A5rocks commented on Feb 10, 2025

    @A5rocks
    Collaborator

    This also checks for .hg, relevant change is #18482. Note this is explicitly checked so maybe this is now intentional.

    cc @hauntsaninja

  2. added a commit that references this issue on Feb 10, 2025
    e13bc2c
  3. hauntsaninja commented on Feb 10, 2025

    @hauntsaninja
    Collaborator

    Thanks for the report! #18656

  4. changed the title [-]mypy 1.15.0 does not use $HOME/.mypy.ini, if .git directory exists[/-] [+][1.15 regression] mypy does not use $HOME/.mypy.ini, if .git directory exists[/+] on Feb 12, 2025
  5. added a commit that references this issue on Feb 12, 2025
    44f82ef
  6. added 2 commits that reference this issue on Feb 19, 2025
    69df19d
    9153523
  7. added a commit that references this issue on Feb 24, 2025
    c3d5ed8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions