Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
suonpaa opened this issue Feb 10, 2025 · 2 comments · Fixed by #18656
Closed

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

suonpaa opened this issue Feb 10, 2025 · 2 comments · Fixed by #18656
Labels
bug mypy got something wrong

Comments

@suonpaa
Copy link

suonpaa commented Feb 10, 2025

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.

@suonpaa suonpaa added the bug mypy got something wrong label Feb 10, 2025
@A5rocks
Copy link
Collaborator

A5rocks commented Feb 10, 2025

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

cc @hauntsaninja

hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Feb 10, 2025
@hauntsaninja
Copy link
Collaborator

Thanks for the report! #18656

@hauntsaninja hauntsaninja 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 Feb 12, 2025
ericmarkmartin pushed a commit to ericmarkmartin/mypy that referenced this issue Feb 19, 2025
Fixes python#18650

Slightly annoying to add a test for since it would clutter up user home
directory
ericmarkmartin pushed a commit to ericmarkmartin/mypy that referenced this issue Feb 19, 2025
Fixes python#18650

Slightly annoying to add a test for since it would clutter up user home
directory
x612skm pushed a commit to x612skm/mypy-dev that referenced this issue Feb 24, 2025
Fixes python#18650

Slightly annoying to add a test for since it would clutter up user home
directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants