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 for teams that type-check with ty (or want a fast standalone linter).

Example

def add(a: int, b: int) -> int:
    return a + b

add(a=1, b=2)  # OK
add(1, 2)  # strict-kwargs error: too many positional arguments

Install

From PyPI (after the first release):

pip install strict-kwargs
# or
uv tool install strict-kwargs

From source:

cargo install --path .
# or
pip install .

Usage

strict-kwargs .                 # check a directory
strict-kwargs src/foo.py        # check a file
strict-kwargs --project-root .  # explicit project root for config

With ty:

ty check
strict-kwargs .

Exit codes: 0 = clean, 1 = violations found, 2 = internal error.

Configuration

In pyproject.toml:

[tool.strict_kwargs]
ignore_names = ["main.func", "builtins.str"]
debug = false

Legacy mypy configuration sections are also supported for migration:

  • mypy.ini / .mypy.ini[mypy_strict_kwargs]
  • setup.cfg[mypy_strict_kwargs]

The same ignore_names entries as mypy-strict-kwargs work (fully-qualified names like package.module.func).

Limitations

This tool uses static analysis (Ruff's Python parser), not a type checker. It resolves many calls within a project but will not catch every case mypy's plugin handles (dynamic callables, complex overloads, etc.).

License

MIT

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.16-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

strict_kwargs-2026.5.16-py3-none-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.34+ x86-64

strict_kwargs-2026.5.16-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b79cfd57f6b581cbcc0e6c5536bca54b8a2aa126649b15a1f46a6937be961a69
MD5 25f81645de1f5bed76d80d02ff77c8dd
BLAKE2b-256 5c8f0897cb9cc173a2961a6929ed4f1440f61e0bb7279ca83e147044a720037a

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.16-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.16-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b5b9aeb479af005d116cc2980312e484f8981f9e2c3a5b3b151d2a08d8800785
MD5 2a79cf789866557eac821ef6a25f1ac3
BLAKE2b-256 bc920a2cbbaf120df85d808f2136654a12b0fbdabb1c42a6fc1128c89941f13e

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.16-py3-none-manylinux_2_34_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.16-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49f843a9b5dabbcb4ed21fe5612b365ee7394d4430ee0d91e3861b130911dbe4
MD5 9086aaf1901ad7a6a143d809aabddd0d
BLAKE2b-256 c6d0ca70610b0c083b4e7d36353a0125d71e510f12d1d5f283d0f20d55d3e54a

See more details on using hashes here.

Provenance

The following attestation bundles were made for strict_kwargs-2026.5.16-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