Skip to main content

konform

Multi-rule Python linter and language server — fast, configurable, and CI-ready.

Rules

KIS001 — Module-only imports

Checks that every from X import Y only imports a sub-module, not an object (function, class, or constant), following the Google Python Style Guide §2.2.

# Bad — KIS001: `join` is a function, not a module
from os.path import join

# Good
import os.path
from os import path       # `path` is a module

This rule is sometimes fixable: konform rewrites the import automatically when it's safe to do so. It leaves the violation for you to fix by hand when the new import's name is already bound elsewhere in the file -- either as a local variable, or by a different import that would then overlap with it (two from X import Y statements silently bound to the same name but pointing at different modules).

KIS002 — Unnecessary import alias

Flags from X import Y as Z when the alias Z buys nothing -- Y isn't bound to anything else in the module, so the alias only adds a layer of indirection.

# Bad — KIS002: `bar_baz` isn't needed, nothing else is named `baz`
from foo.bar import baz as bar_baz

# Good
from foo.bar import baz

The alias is left alone when it's actually doing something: renaming away a collision with a local name or another import, a leading-underscore "don't re-export this" marker, a self-alias (import x as x, which is Ruff's PLC0414 territory), or a relative import (from . import x as y, which has no stable module identity to key a collision check on). Plain import X as Z statements are out of scope too -- dropping the alias there changes what gets bound, unlike from X import Y as Z.

This rule is sometimes fixable: konform drops the alias and renames every use of it back to the original name. It leaves the violation for you to fix by hand when the alias is shadowed somewhere, or bound to more than one import in the file.

KPT — User-defined pattern rules

Load regex patterns from konform_patterns.toml (auto-discovered next to pyproject.toml) or inline in pyproject.toml:

[[tool.konform.KPT.rules]]
id      = "KPT001"
message = "Use the project logger instead of bare print()."
pattern = '^\s*print\s*\('
files   = ["src/**/*.py"]
level   = "warning"

Installation

pip install konform

Wheels ship a pre-compiled Rust binary — no Rust installation needed at runtime.

Usage

# Lint all Python files under src/
konform check src/

# Lint and apply auto-fixes in one pass
konform check --fix src/

# Apply fixes only (no lint report)
konform check --fix src/

# Show a unified diff of what format would change
konform check --diff src/

# Output violations as JSON (e.g. for tooling)
konform check --output-format json src/

# Suppress hints and summary (violations only)
konform check -q src/

# No output — just exit 1 on violations
konform check -s src/

# List all rules
konform rule --list

# Explain a rule
konform rule --explain KIS001

# Clear the local cache
konform clean

Configuration

Add a [tool.konform] section to pyproject.toml (or a standalone konform.toml):

[tool.konform]
cache-dir = ".konform_cache"
workers   = 0         # 0 = os.cpu_count()
src       = [".", "src"]   # search roots for KIS001's module-existence probe;
                            # see "Module search roots" below.

[tool.konform.lint]
select = []        # [] = all rules; prefix match: "KIS" = all KIS* rules
ignore = []
level  = "error"   # "warning" | "error"

# ── KIS001 — import style ──────────────────────────────────────────────────
[tool.konform.lint.module-only-imports]
exceptions = [
    "__future__", "typing", "typing_extensions", "collections.abc",
    "mycompany.compat",
]
level = "error"
unresolved-level = "warning"   # "warning" (default) | "error" | "off"
                                # Used when a package isn't installed in this
                                # environment, so KIS001 can't tell whether the
                                # imported name is a module or not.

# ── KIS002 — unnecessary import alias ──────────────────────────────────────
[tool.konform.lint.unnecessary-import-alias]
level = "warning"

# ── KPT001 — user-defined patterns ─────────────────────────────────────────
[tool.konform.lint.user-defined-patterns]
level = "warning"
# Optional: load patterns from an external file instead of inline rules.
# rules_file = "konform_patterns.toml"

[[tool.konform.lint.user-defined-patterns.rules]]
id      = "KPT001"
message = "Use the project logger instead of bare print()."
pattern = '^\s*print\s*\('
files   = ["src/**/*.py"]
level   = "warning"

# Sub-rules are attached to this rule entry. This inline form makes the
# parent/child relation explicit and avoids table-order confusion.
sub_rules = [
  {
    pattern = ['print\(.*password', 'print\(.*secret'],
    message = "Never print credentials.",
    help = "Use redaction helpers before logging.",
  },
]

Each rule's settings live in its own table, keyed by a stable config name (shown by konform rule --list) rather than by rule code — so renaming a rule code (with noqa-aliases covering old suppression comments) never forces you to also rewrite your config.

When using [[tool.konform.lint.user-defined-patterns.rules.sub_rules]], TOML binds each sub-rule to the most recently declared [[tool.konform.lint.user-defined-patterns.rules]] entry.

Pattern files

Patterns can also live in a standalone konform_patterns.toml placed next to pyproject.toml. konform auto-discovers it (no config key needed):

# konform_patterns.toml
[[rules]]
id      = "KPT002"
message = "Remove breakpoint() — debugging artefact."
pattern = '^\s*breakpoint\s*\(\s*\)'
level   = "error"

Module search roots

KIS001 needs to know whether an imported name is a real module (import os.path) or just an attribute of one (from os.path import join). It answers this by searching the filesystem, starting from your Python environment's sys.path plus a configurable set of extra roots -- this matters for local packages that aren't installed (e.g. a src/ layout, or code laid out some other way).

The extra roots are resolved the same way as Ruff's src setting, including its precedence:

  1. [tool.konform] src = [...], if set.
  2. Otherwise, [tool.ruff] src = [...], if your project already configures Ruff for a non-standard layout.
  3. Otherwise, the default [".", "src"] (covers both flat and src layouts out of the box).

Each entry is resolved relative to the directory containing pyproject.toml / konform.toml. For example, if your package lives under lib/:

[tool.konform]
src = ["lib"]

Suppressing violations

from os.path import join   # noqa: KIS001   ← exact rule
from os.path import join   # noqa: KIS       ← whole category
from os.path import join   # noqa             ← everything on this line

Aliasing noqa codes

When a rule code changes (e.g. a rule is renamed, or a project migrates from another linter's codes), old # noqa comments would otherwise stop working. Define aliases in your config so they keep suppressing the renamed/canonical rule:

# pyproject.toml
[tool.konform.lint.noqa-aliases]
IS001 = "KIS001"
IS    = "KIS"
from os.path import join   # noqa: IS001   ← suppresses KIS001 via alias

Upgrading from an older config format

When konform's config shape changes (as it did in 0.3.0, moving rule selection/settings under [tool.konform.lint]), it auto-migrates an outdated pyproject.toml / konform.toml the first time you run any konform command: the file is rewritten in place (comments and other [tool.*] sections are preserved) and a summary of what changed is printed to stderr. No action is needed beyond re-running konform once.

Language Server (LSP)

konform ships a built-in LSP server that shares the same rule engine as the CLI — no second process, no stale results.

konform server   # starts the LSP over stdin/stdout

Neovim (nvim-lspconfig)

vim.api.nvim_create_autocmd("FileType", {
  pattern = "python",
  callback = function()
    vim.lsp.start({
      name = "konform",
      cmd  = { "konform", "server" },
      root_dir = vim.fs.dirname(
        vim.fs.find({ "pyproject.toml", "konform.toml" }, { upward = true })[1]
      ),
    })
  end,
})

VS Code (settings.json)

Add via the generic None ls or any client that supports a custom LSP command:

{
  "nls.server": {
    "command": ["konform", "server"]
  }
}

Zed

Install the zed-konform extension (see extensions/zed-extension/README.md) and Zed will auto-install the konform binary for you — no manual setup required. To override the binary path or pass extra arguments, set:

{
  "lsp": {
    "konform": {
      "binary": {
        "path": "konform",
        "arguments": ["server"]
      }
    }
  }
}

Development

# Compile the Rust binary and install it in the dev venv (required before tests)
hatch run develop

# Run tests with coverage
hatch test -c

# Build release wheels for all platforms
hatch run maturin:build-all

CLI reference

konform check  [OPTIONS] <PATHS>…    Lint files (default subcommand)
konform check --fix-only [OPTIONS] <PATHS>…  Apply all auto-fixes in-place, exit 0
konform server                       Start the LSP server (stdin/stdout)
konform rule   --list                List all rules
konform rule   --explain <CODE>      Show full rule documentation
konform clean  [--config PATH]       Delete the cache directory
konform version                      Print konform's version

Global options (available on all subcommands):
  --color auto|always|never          Colour output control
  --isolated                         Ignore all config files
  -v / --verbose                     Extra output
  -q / --quiet                       Violations only (no summary/hints)
  -s / --silent                      No output; exit code only

Metadata

Release files for konform 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for konform 0.3.0
File Size Uploaded Provenance Actions
konform-0.3.0.tar.gz 147.6 kB With provenance Details for konform-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for konform 0.3.0
File Actions
konform-0.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for konform-0.3.0-py3-none-win_amd64.whl
konform-0.3.0-py3-none-win32.whl Python 3 none Windows x86-32 Details for konform-0.3.0-py3-none-win32.whl
konform-0.3.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for konform-0.3.0-py3-none-musllinux_1_2_x86_64.whl
konform-0.3.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for konform-0.3.0-py3-none-musllinux_1_2_aarch64.whl
konform-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for konform-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
konform-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl Python 3 none Linux glibc 2.17+ x86-32 Details for konform-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
konform-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl Python 3 none Linux glibc 2.17+ ARMv7l Details for konform-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
konform-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for konform-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
konform-0.3.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for konform-0.3.0-py3-none-macosx_11_0_arm64.whl
konform-0.3.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for konform-0.3.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 30.5 MB

Release files / konform-0.3.0.tar.gz

Download URL konform-0.3.0.tar.gz
Size 147.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d5b75fc2c9eb52dfb94892d4bbd830ea38b678d1a5f1dc39427310bb3373699e
BLAKE2b-256 checksum
How to use checksums
268b4bbd4f744c531678afd24cf9f530600f45450842aa30f99322dc135b3d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-win_amd64.whl

Download URL konform-0.3.0-py3-none-win_amd64.whl
Size 3.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a78f3e256471f1b477f09a26ce89551be3f324d3151d769e15675b70b88c2424
BLAKE2b-256 checksum
How to use checksums
ba396f062cd125d4e1f37ac1e2f4831b13415b3b5db2e529c033def6633ede46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-win32.whl

Download URL konform-0.3.0-py3-none-win32.whl
Size 2.9 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
2a62d977e1ae4ef2a9b8de7b655227957fd5847e94af6848af69d2e8c450151d
BLAKE2b-256 checksum
How to use checksums
05fe00b40295a97f952ffbf9b87daadf15703005f9904d0b9f2beecbf20fbaf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-musllinux_1_2_x86_64.whl

Download URL konform-0.3.0-py3-none-musllinux_1_2_x86_64.whl
Size 3.2 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
68030016a0fe801bb207c5dbdfc36a456b61f7f40f7e5b14db437f3bd7483d47
BLAKE2b-256 checksum
How to use checksums
682499eca93fc530f6d324a4ddacd04d147216efcfdf86f8f7fa1a2dbb2a8330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-musllinux_1_2_aarch64.whl

Download URL konform-0.3.0-py3-none-musllinux_1_2_aarch64.whl
Size 3.0 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
4621295084855572c6be2d4b1ded94210339bdca6ece89eab7f4cbcd9e7674d2
BLAKE2b-256 checksum
How to use checksums
7d7c578d766ee67f827a7809bfdb2d6f396022ead234a0535795f67b86bd3825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL konform-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4305d62f8965730c4868bfc7b20bb83c5ba8e47bf5a8eb7c8dbf3cce3c950bec
BLAKE2b-256 checksum
How to use checksums
70cd011fad337fc8cbf5eb5f9eafa533ba3d0a37042e0a365249743f9d02f7b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL konform-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Size 3.2 MB
Tags Linux glibc 2.17+ x86-32 Python 3
SHA-256 checksum
How to use checksums
af33aa07dd42401be600ea8e9d6a1fcbfb6339b315debf848648161f908c0aae
BLAKE2b-256 checksum
How to use checksums
922eee9221dab3aee38f72c0de893583f4051c48bb466c0de5371b904529be3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL konform-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 2.9 MB
Tags Linux glibc 2.17+ ARMv7l Python 3
SHA-256 checksum
How to use checksums
69aa1d2f4dde3a387033faa20291cc295f2fdff655214c74b700c1eabf70135c
BLAKE2b-256 checksum
How to use checksums
cb5643cbf5e7a1ac77e8dcb99cd7d12594d6f922729ace1075c430fc1c461af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL konform-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
93ca74e01130775fe05659e0fe8a9209c4eafaa8a7308c7b295f07f7f01ffe8a
BLAKE2b-256 checksum
How to use checksums
35c9873576b52ae9d6b46a2180ccfeaa90c4efe4317b8f6db1fb8122de5bdc03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-macosx_11_0_arm64.whl

Download URL konform-0.3.0-py3-none-macosx_11_0_arm64.whl
Size 2.9 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bf0a8b13df9aa9fed0215408d1257b4d5270e4c6fd3e2c01094f162501f6f510
BLAKE2b-256 checksum
How to use checksums
d5cd2a03f25b55146affd346bc400e00bed94c614dd5dda560776ccd0ed587d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / konform-0.3.0-py3-none-macosx_10_12_x86_64.whl

Download URL konform-0.3.0-py3-none-macosx_10_12_x86_64.whl
Size 3.0 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
bebf0a6c427fb6153abd4ba26407b883be53527da50fcfa1cf077bf05d7452d5
BLAKE2b-256 checksum
How to use checksums
b888cdc5fd3cf41dc9f1b28e9d5c0c721186d083636b0a0222e68afd9c5d2dae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Security for konform 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for konform-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page