Skip to main content

Enforce using keyword arguments where possible.

Project description

strict-kwargs

Fast enforcement of keyword arguments at call sites, without mypy or ty plugins. Companion to mypy-strict-kwargs; a fast standalone linter for teams that type-check with ty.

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, and ty-only-resolved calls untouched (reporting how many it declined). --python accepts an interpreter, venv, or sys.prefix (mirrors ty check --python) for third-party packages outside an activated venv or <project>/.venv.

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, as in mypy-strict-kwargs
debug = false

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

strict_kwargs-2026.5.18-py3-none-win_amd64.whl (2.0 MB view details)

Uploaded Python 3Windows x86-64

strict_kwargs-2026.5.18-py3-none-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

strict_kwargs-2026.5.18-py3-none-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file strict_kwargs-2026.5.18-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.18-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c90ae750b5754176e943bebaee42d34e51433ead05da60908159b42059ccea75
MD5 8b7990390b58569b4271cefa2e3faeeb
BLAKE2b-256 2bea8c711d39423fa503f94a4afd5913e3d5ae2f87d1e9009d2219e47c78c473

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.18-py3-none-win_amd64.whl:

Publisher: release.yml on adamtheturtle/strict-kwargs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file strict_kwargs-2026.5.18-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.18-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2ce07d85420eed40e51b0a61681db39fd56ed2be97f73780ef2be97ef9373c1b
MD5 b36a6478c999d75a5b39c8d8801acc67
BLAKE2b-256 790d989af3f5eda8cd14bd80488e449f8f40d81709de44dd376f309df83bb726

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.18-py3-none-manylinux_2_39_x86_64.whl:

Publisher: release.yml on adamtheturtle/strict-kwargs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file strict_kwargs-2026.5.18-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.18-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e60f890d25dde613b337eef035b96ed820acafdca46ec3349b35f4d5af55c5ac
MD5 3670894e77f5b0da5bcad5a4f99bf55b
BLAKE2b-256 e35f214c7046d4fdb7562db842baeeb8b3dda4521c2736f4ac5fb10ab3397f0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.18-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on adamtheturtle/strict-kwargs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page