Title: Config file at ~/.mypy.ini is not used · Issue #18977 · python/mypy · GitHub
Open Graph Title: Config file at ~/.mypy.ini is not used · Issue #18977 · python/mypy
X Title: Config file at ~/.mypy.ini is not used · Issue #18977 · python/mypy
Description: Bug Report I have my mypy configuration file at ~/.mypy.ini. In that config file I have the following option: [mypy] cache_dir=/tmp/mypy_cache However when I run mypy from some working directory, .mypy_cache directory gets created in tha...
Open Graph Description: Bug Report I have my mypy configuration file at ~/.mypy.ini. In that config file I have the following option: [mypy] cache_dir=/tmp/mypy_cache However when I run mypy from some working directory, ....
X Description: Bug Report I have my mypy configuration file at ~/.mypy.ini. In that config file I have the following option: [mypy] cache_dir=/tmp/mypy_cache However when I run mypy from some working directory, ....
Opengraph URL: https://github.com/python/mypy/issues/18977
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Config file at ~/.mypy.ini is not used","articleBody":"**Bug Report**\n\nI have my `mypy` configuration file at `~/.mypy.ini`.\n\nIn that config file I have the following option:\n```ini\n[mypy]\ncache_dir=/tmp/mypy_cache\n```\nHowever when I run `mypy` from some working directory, `.mypy_cache` directory gets created in that directory, which means my config file is not used.\n\nHowever, if I specify path to that config file directly, it's used correctly:\n\n```shell\n$ mypy -v --config-file ~/.mypy.ini SomeFile.py\n\nLOG: Mypy Version: 1.15.0\nLOG: Config File: /home/user/.mypy.ini\nLOG: Configured Executable: /usr/bin/python3\nLOG: Current Executable: /usr/bin/python3\nLOG: Cache Dir: /tmp/mypy_cache\n...\n```\nUnfortunately, `mypy` doesn't print the location of the config file it uses, or the locations where it tries to find a config file, so no more details on the problem is available.\n\n**Expected Behavior**\n\nAs stated in the documentation: https://mypy.readthedocs.io/en/stable/config_file.html\n`~/.mypy.ini` should be used if `--config-file` is not specified and other preferred config file locations do not exist, which it true in my case.\n\nSo I would expect the exact same behavior if `--config-file ~/.mypy.ini` is specified and if `--config-file` is not specified at all.\n\n**Actual Behavior**\n\n```shell\n$ mypy -v SomeFile.py\n\nLOG: Mypy Version: 1.15.0\nLOG: Config File: Default\nLOG: Configured Executable: /usr/bin/python3\nLOG: Current Executable: /usr/bin/python3\nLOG: Cache Dir: .mypy_cache\n...\n```\nNote `Config File: Default` and `Cache Dir: .mypy_cache`.\n\nAnd indeed, `./.mypy_cache` folder is created.\n\n**Your Environment**\n\n```shell\n$ mypy --version\nmypy 1.15.0 (compiled: yes)\n\n$ python --version\nPython 3.12.3\n```\n","author":{"url":"https://github.com/jolaf","@type":"Person","name":"jolaf"},"datePublished":"2025-04-27T01:15:06Z","url":"https://github.com/python/mypy/issues/18977"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6c1be8b6-07cb-5bd3-dc36-4a8a3372d7f1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9EE:4D1C6:1804BE0:20584C1:6AFFF170 |
| html-safe-nonce | 262c791e69637a272201169b26128236ed5ea24d921d6fa79c63afee76384e7c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUVFOjREMUM2OjE4MDRCRTA6MjA1ODRDMTo2QUZGRjE3MCIsInZpc2l0b3JfaWQiOiI2ODMxMDkzMTQzMzE2NzIyMDMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4a03bf3b24780addf07bf7ff94cb1117eb4ea22fc314e9f828dbc1c1b5043488 |
| hovercard-subject-tag | issue:3022537642 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18977/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1706f487dbb40c953ee6998ec801014f65625d0748d668dc0abaa1efe9c5ba29/python/mypy/issues/18977 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1706f487dbb40c953ee6998ec801014f65625d0748d668dc0abaa1efe9c5ba29/python/mypy/issues/18977 |
| og:image:alt | Bug Report I have my mypy configuration file at ~/.mypy.ini. In that config file I have the following option: [mypy] cache_dir=/tmp/mypy_cache However when I run mypy from some working directory, .... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jolaf |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width