Enforce using keyword arguments where possible.
Project description
strict-kwargs
Fast enforcement of keyword arguments at call sites, without mypy or ty plugins. Detects positional arguments and rewrites them to keyword arguments automatically.
def add(a: int, b: int) -> int: ...
add(a=1, b=2) # OK
add(1, 2) # error: too many positional args -> fix rewrites to add(a=1, b=2)
Install
uv tool install strict-kwargs # or: pip install strict-kwargs
Usage
strict-kwargs . # check a directory (exit 0 = clean, 1 = violations, 2 = error)
strict-kwargs fix . # rewrite positional args to keyword args in place
strict-kwargs fix --diff . # preview the rewrite, write nothing
strict-kwargs --python .venv . # point the ty fallback at an environment
fix is conservative: it never rewrites a call it would not report, and leaves overloaded callees, *args/**kwargs unpacking, synthesized constructors, and ambiguous ty resolutions untouched (reporting how many it declined). ty-resolved calls are rewritten only when ty reports one concrete callable signature with complete parameter names.
--python accepts an interpreter, venv, or sys.prefix (mirrors ty check --python) for third-party packages outside an activated venv or <project>/.venv.
A path that does not exist is a hard error (exit 2), like ruff, rather than a silent "clean" result; a nonexistent --python is reported on stderr and the run falls back to ty's own environment discovery.
pre-commit
repos:
- repo: https://github.com/adamtheturtle/strict-kwargs-pre-commit
rev: 2026.5.16.post1 # pin to a release tag
hooks:
- id: strict-kwargs
Use the mirror (prebuilt wheel, no Rust toolchain).
Pointing repo: at this repository works too but builds from source.
Configuration
In pyproject.toml:
[tool.strict_kwargs]
ignore_names = ["main.func", "builtins.str"] # fully-qualified names to ignore
debug = false # log debug info and AST dumps to stderr
A missing pyproject.toml, or one without a [tool.strict_kwargs] table, is fine and uses the defaults.
A pyproject.toml that exists but cannot be parsed, or whose [tool.strict_kwargs] has the wrong shape or value types (e.g. ignore_names not a list), is a hard error (exit 2) rather than a silent fall back to defaults.
Comparison with mypy-strict-kwargs
mypy-strict-kwargs is a mypy plugin that enforces the same rule. Use strict-kwargs if you type-check with ty or prefer a standalone linter without plugins.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strict_kwargs-2026.5.18.post4-py3-none-win_amd64.whl.
File metadata
- Download URL: strict_kwargs-2026.5.18.post4-py3-none-win_amd64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2476e6f82a94fd54ae8c1a470504822a838046dae3f49695375b772b23eaee8
|
|
| MD5 |
35fe14e6580932b6450bfd71a229da7a
|
|
| BLAKE2b-256 |
51d4bab728350e21df10e1994fc620fb68b64d02695d81e4384e5106f45e18c3
|
Provenance
The following attestation bundles were made for strict_kwargs-2026.5.18.post4-py3-none-win_amd64.whl:
Publisher:
release.yml on adamtheturtle/strict-kwargs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strict_kwargs-2026.5.18.post4-py3-none-win_amd64.whl -
Subject digest:
d2476e6f82a94fd54ae8c1a470504822a838046dae3f49695375b772b23eaee8 - Sigstore transparency entry: 1570140776
- Sigstore integration time:
-
Permalink:
adamtheturtle/strict-kwargs@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file strict_kwargs-2026.5.18.post4-py3-none-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: strict_kwargs-2026.5.18.post4-py3-none-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd82a6455b1b5d28f88aa7c1d9547670ccadb6f57e15de024756ef8fa422affb
|
|
| MD5 |
8b88384498603e7fb7cf25bf16da99d9
|
|
| BLAKE2b-256 |
bb23e4949435a7b794a638837ddf9d20560304887d00f295286de64fed62b026
|
Provenance
The following attestation bundles were made for strict_kwargs-2026.5.18.post4-py3-none-manylinux_2_39_x86_64.whl:
Publisher:
release.yml on adamtheturtle/strict-kwargs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strict_kwargs-2026.5.18.post4-py3-none-manylinux_2_39_x86_64.whl -
Subject digest:
dd82a6455b1b5d28f88aa7c1d9547670ccadb6f57e15de024756ef8fa422affb - Sigstore transparency entry: 1570140599
- Sigstore integration time:
-
Permalink:
adamtheturtle/strict-kwargs@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file strict_kwargs-2026.5.18.post4-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: strict_kwargs-2026.5.18.post4-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa0e874e9b73851aebebaa5871de53d97e0210b81c73537c1fc3ec6e3c68e40a
|
|
| MD5 |
7c0f25e58fbe562d43cec0b7b4ad66c2
|
|
| BLAKE2b-256 |
3e122dc70606027ac4debeeec02102759e2e494520b78b45b1c9ae2bc608d03d
|
Provenance
The following attestation bundles were made for strict_kwargs-2026.5.18.post4-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on adamtheturtle/strict-kwargs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strict_kwargs-2026.5.18.post4-py3-none-macosx_11_0_arm64.whl -
Subject digest:
fa0e874e9b73851aebebaa5871de53d97e0210b81c73537c1fc3ec6e3c68e40a - Sigstore transparency entry: 1570141046
- Sigstore integration time:
-
Permalink:
adamtheturtle/strict-kwargs@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3fdecdfec2903f25de39979d0b8951ef3161f32d -
Trigger Event:
workflow_dispatch
-
Statement type: