Registry / type-stubs / mypy-strict-kwargs

mypy-strict-kwargs

JSON →
library2026.5.20.1pypypiunverified

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.

pip install mypy-strict-kwargs
INSTALL
IMPORT
SIG · MYPY-STRICT-KWARGS
M
mypy-strict-kwargs
type-stubspythonv2026.5.20.1
Install
3.5s avg
Import
Disk
81MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2026.1.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 3.8s
py 3.11
✓ —
✓ 3.45s
py 3.12
✓ —
✓ 3.3s
py 3.13
✓ —
✓ 3.45s
py 3.9
✕ build_error
✕ build_error
81MB installed
● package 81MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MypyStrictKwargsPlugin
[mypy] plugins = mypy_strict_kwargs.plugin
from mypy_strict_kwargs import plugin
mypy-strict-kwargs is a Mypy plugin, not a standard Python library to be imported in Python code. It must be enabled by adding `plugins = mypy_strict_kwargs.plugin` under the `[mypy]` section of your `mypy.ini` or equivalent Mypy configuration file. Importing it directly in Python will not activate the plugin's checks.

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.

# mypy.ini [mypy] plugins = mypy_strict_kwargs.plugin # main.py def calculate(a: int, b: int, operation: str = "add") -> int: if operation == "add": return a + b elif operation == "subtract": return a - b else: raise ValueError("Invalid operation") # These calls will pass Mypy checks print(calculate(1, 2, operation="add")) print(calculate(a=5, b=3)) # This call will trigger a Mypy strict-kwargs error: # print(calculate(10, 5, "subtract")) # To fix, pass 'operation' as a keyword argument: print(calculate(10, 5, operation="subtract"))
Debug
Known issues
gotchaThe plugin explicitly ignores certain function types, including methods with `**kwargs`, `__init__` methods, and `@property` setters. This means these specific functions will not be checked for strict keyword argument usage.
fix
Be aware of these exclusions. If strict keyword enforcement is needed for these cases, alternative Mypy checks or refactoring might be required.
affects: All versions
breakingmypy-strict-kwargs requires Python 3.10 or newer. Installing or running with older Python versions will lead to compatibility errors.
fix
Ensure your development environment and Mypy execution environment are using Python 3.10 or higher. Upgrade Python if necessary.
affects: All versions
gotchaThe plugin must be explicitly enabled in your `mypy.ini` (or equivalent Mypy config). Simply installing the package is not enough; Mypy will not use it unless specified in the configuration file.
fix
Add `plugins = mypy_strict_kwargs.plugin` under the `[mypy]` section in your Mypy configuration file (`mypy.ini`, `pyproject.toml`, etc.).
affects: All versions
gotchaThe plugin specifically targets arguments that have default values and can theoretically be passed positionally. It does not enforce keyword-only arguments for all parameters, nor does it enforce keyword-only arguments for parameters already marked as keyword-only using `*`.
fix
Understand that the plugin's scope is for arguments with defaults. For strict keyword-only enforcement on arguments without defaults, use `*, arg: type` in your function signature.
affects: All versions
Upgrade
Version history
2026.5.20.1latest on PyPI · released May 20, 2026
Audit
Dependencies
mypyrequiredThis library is a plugin for Mypy and requires Mypy to be installed and run for its functionality.
Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
2
Amazon
1
Resources
mypy-strict-kwargs — pip install mypy-strict-kwargs · libregistry