{"id":13648360,"url":"https://github.com/ambv/flake8-mypy","last_synced_at":"2025-04-22T07:31:22.615Z","repository":{"id":57429980,"uuid":"83177341","full_name":"ambv/flake8-mypy","owner":"ambv","description":"A plugin for flake8 integrating Mypy.","archived":true,"fork":false,"pushed_at":"2020-06-19T16:51:36.000Z","size":41,"stargazers_count":100,"open_issues_count":23,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T08:17:11.591Z","etag":null,"topics":["flake8","linter","linter-plugin","mypy","plugin","type-hints","typing"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ambv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-26T02:27:33.000Z","updated_at":"2025-01-16T14:59:39.000Z","dependencies_parsed_at":"2022-08-26T02:41:13.855Z","dependency_job_id":null,"html_url":"https://github.com/ambv/flake8-mypy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambv%2Fflake8-mypy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambv%2Fflake8-mypy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambv%2Fflake8-mypy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambv%2Fflake8-mypy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ambv","download_url":"https://codeload.github.com/ambv/flake8-mypy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250195033,"owners_count":21390230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake8","linter","linter-plugin","mypy","plugin","type-hints","typing"],"created_at":"2024-08-02T01:04:10.595Z","updated_at":"2025-04-22T07:31:22.310Z","avatar_url":"https://github.com/ambv.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# flake8-mypy\n\n## NOTE: THIS PROJECT IS DEAD\n\nIt was created in early 2017 when Mypy performance was often insufficient for\nin-editor linting. The Flake8 plugin traded correctness for performance,\nmaking Mypy only check a bare minimum of problems. These days Mypy is\naccelerated with mypyc, as well as uses aggressive caching to speed up\nincremental checks. It's no longer worth it to use hacks such as flake8-mypy.\n\n## What was the project anyway?\n\nA plugin for [Flake8](http://flake8.pycqa.org/) integrating\n[mypy](http://mypy-lang.org/). The idea is to enable limited type\nchecking as a linter inside editors and other tools that already support\n*Flake8* warning syntax and config.\n\n\n## List of warnings\n\n*flake8-mypy* reserves **T4** for all current and future codes, T being\nthe natural letter for typing-related errors.  There are other plugins\ngreedily reserving the entire letter **T**.  To this I say: `¯\\_(ツ)_/¯`.\n\n**T400**: any typing note.\n\n**T484**: any typing error (after PEP 484, geddit?).\n\n**T498**: internal *mypy* error.\n\n**T499**: internal *mypy* traceback, stderr output, or an unmatched line.\n\nI plan to support more fine-grained error codes for specific *mypy*\nerrors in the future.\n\n\n## Two levels of type checking\n\n*mypy* shines when given a full program to analyze.  You can then use\noptions like `--follow-imports` or `--disallow-untyped-calls` to\nexercise the full transitive closure of your modules, catching errors\nstemming from bad API usage or incompatible types.  That being said,\nthose checks take time, and require access to the entire codebase.  For\nsome tools, like an editor with an open file, or a code review tool,\nachieving this is not trivial.  This is where a more limited approach\ninside a linter comes in.\n\n*Flake8* operates on unrelated files, it doesn't perform full program\nanalysis.  In other words, it doesn't follow imports.  This is a curse\nand a blessing.  We cannot find complex problems and the number of\nwarnings we can safely show without risking false positives is lower.\nIn return, we can provide useful warnings with great performance, usable\nfor realtime editor integration.\n\nAs it turns out, in this mode of operation, *mypy* is still able to\nprovide useful information on the annotations within and at least usage\nof stubbed standard library and third party libraries.  However, for\nbest effects, you will want to use separate configuration for *mypy*'s\nstandalone mode and for usage as a *Flake8* plugin.\n\n\n## Configuration\n\nDue to the reasoning above, by default *flake8-mypy* will operate with\noptions equivalent to the following:\n\n```ini\n[mypy]\n# Specify the target platform details in config, so your developers are\n# free to run mypy on Windows, Linux, or macOS and get consistent\n# results.\npython_version=3.6\nplatform=linux\n\n# flake8-mypy expects the two following for sensible formatting\nshow_column_numbers=True\nshow_error_context=False\n\n# do not follow imports (except for ones found in typeshed)\nfollow_imports=skip\n\n# since we're ignoring imports, writing .mypy_cache doesn't make any sense\ncache_dir=/dev/null\n\n# suppress errors about unsatisfied imports\nignore_missing_imports=True\n\n# allow untyped calls as a consequence of the options above\ndisallow_untyped_calls=False\n\n# allow returning Any as a consequence of the options above\nwarn_return_any=False\n\n# treat Optional per PEP 484\nstrict_optional=True\n\n# ensure all execution paths are returning\nwarn_no_return=True\n\n# lint-style cleanliness for typing needs to be disabled; returns more errors\n# than the full run.\nwarn_redundant_casts=False\nwarn_unused_ignores=False\n\n# The following are off by default since they're too noisy.\n# Flip them on if you feel adventurous.\ndisallow_untyped_defs=False\ncheck_untyped_defs=False\n```\n\nIf you disagree with the defaults above, you can specify your own *mypy*\nconfiguration by providing the `--mypy-config=` command-line option to\n*Flake8* (with the .flake8/setup.cfg equivalent being called\n`mypy_config`). The value of that option should be a path to a mypy.ini\nor setup.cfg compatible file.  For full configuration syntax, follow\n[mypy documentation](http://mypy.readthedocs.io/en/latest/config_file.html).\n\nFor the sake of simplicity and readability, the config you provide will\nfully replace the one listed above.  Values left out will be using\n*mypy*'s own defaults.\n\nRemember that for the best user experience, your linter integration mode\nshouldn't generally display errors that a full run of *mypy* wouldn't.\nThis would be confusing.\n\nNote: chaing the `follow_imports` option might have surprising effects.\nIf the file you're linting with Flake8 has other files around it, then in\n\"silent\" or \"normal\" mode those files will be used to follow imports.\nThis includes imports from [typeshed](https://github.com/python/typeshed/).\n\n\n## Tests\n\nJust run:\n\n```\npython setup.py test\n```\n\n## OMG, this is Python 3 only!\n\nYes, so is *mypy*.  Relax, you can run *Flake8* with all popular plugins\n**as a tool** perfectly fine under Python 3.5+ even if you want to\nanalyze Python 2 code.  This way you'll be able to parse all of the new\nsyntax supported on Python 3 but also *effectively all* the Python 2\nsyntax at the same time.\n\nBy making the code exclusively Python 3.5+, I'm able to focus on the\nquality of the checks and re-use all the nice features of the new\nreleases (check out [pathlib](https://docs.python.org/3/library/pathlib.html))\ninstead of wasting cycles on Unicode compatibility, etc.\n\n\n## License\n\nMIT\n\n\n## Change Log\n\n### 17.8.0\n\n* avoid raising errors in the default config which don't happen during\n  a full run (disable warn_unused_ignores and warn_redundant_casts)\n\n* always run type checks from a temporary directory to avoid\n  clashing with unrelated files in the same directory\n\n### 17.3.3\n\n* suppress *mypy* messages about relative imports\n\n### 17.3.2\n\n* bugfix: using *Flake8* with absolute paths now correctly matches *mypy*\n  messages\n\n* bugfix: don't crash on relative imports in the form `from . import X`\n\n### 17.3.1\n\n* switch `follow_imports` from \"silent\" to \"skip\" to avoid name clashing\n  files being used to follow imports within\n  [typeshed](https://github.com/python/typeshed/)\n\n* set MYPYPATH by default to give stubs from typeshed higher priority\n  than local sources\n\n### 17.3.0\n\n* performance optimization: skip running *mypy* over files that contain\n  no annotations or imports from `typing`\n\n* bugfix: when running over an entire directory, T484 is now correctly\n  used instead of T499\n\n### 17.2.0\n\n* first published version\n\n* date-versioned\n\n\n## Authors\n\nGlued together by [Łukasz Langa](mailto:lukasz@langa.pl).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambv%2Fflake8-mypy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fambv%2Fflake8-mypy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambv%2Fflake8-mypy/lists"}