{"library":"mypy-strict-kwargs","title":"Mypy Strict Kwargs","description":"mypy-strict-kwargs is a Mypy plugin that enforces the use of keyword arguments for function parameters that have default values, promoting clearer and less error-prone function calls. As of its current version, 2026.1.12, it follows a date-based release cadence with frequent updates, often several times a year.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install mypy-strict-kwargs"],"cli":null},"imports":["[mypy]\nplugins = mypy_strict_kwargs.plugin"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# mypy.ini\n[mypy]\nplugins = mypy_strict_kwargs.plugin\n\n# main.py\ndef calculate(a: int, b: int, operation: str = \"add\") -> int:\n    if operation == \"add\":\n        return a + b\n    elif operation == \"subtract\":\n        return a - b\n    else:\n        raise ValueError(\"Invalid operation\")\n\n# These calls will pass Mypy checks\nprint(calculate(1, 2, operation=\"add\"))\nprint(calculate(a=5, b=3))\n\n# This call will trigger a Mypy strict-kwargs error:\n# print(calculate(10, 5, \"subtract\"))\n# To fix, pass 'operation' as a keyword argument:\nprint(calculate(10, 5, operation=\"subtract\"))\n","lang":"python","description":"To use mypy-strict-kwargs, first install it, then enable the plugin in your `mypy.ini` configuration file. The plugin will then enforce that arguments with default values are passed as keyword arguments when a positional argument would suffice, ensuring clarity in function calls. Run `mypy main.py` to see the effect.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}