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:

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

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

Uploaded Python 3Windows x86-64

strict_kwargs-2026.5.16.post1-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.post1-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.post1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16.post1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 765c02602099e7e1227dda8654f083e61c1f6e25003fac0fb57ef8dcea3c1a1f
MD5 84f3653c6b8b775861b066d12155177e
BLAKE2b-256 99dcbb095522304b5c17f75a73c46d3aafdc25d1f2ea476bda5a27c861d282bb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16.post1-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a47335d8e205b1473dc27067768cc8fe0026421f5ddaddb8ee885923f75619c6
MD5 fc50af19d6dcc683e80bd6aaee2980c3
BLAKE2b-256 d3daa5f0691873ae35dfd43aa4d56d001105e57c2ca1ed578b2565d4e6407e96

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for strict_kwargs-2026.5.16.post1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43c850f3ea3d650d490d08fc4c78837aa7d83426ecec1973b374aacb0211c63b
MD5 6482326d3986a1054fb78ce112094993
BLAKE2b-256 1773f305bb704dad1f408b0beeee1dfc2c1436a4f8f22ca9c1c29cd359cd370d

See more details on using hashes here.

Provenance

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