Skip to main content

konform

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

Rules

KIS001 — Google-style 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

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]
select    = []        # [] = all rules; prefix match: "KIS" = all KIS* rules
ignore    = []
level     = "error"   # "warning" | "error"
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.

# ── KIS — import style ────────────────────────────────────────────────────
[tool.konform.KIS]
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.

# ── KPT — user-defined patterns ───────────────────────────────────────────
[tool.konform.KPT]
level = "warning"
# Optional: load patterns from an external file instead of inline rules.
# rules_file = "konform_patterns.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"

# 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.",
  },
]

When using [[tool.konform.KPT.rules.sub_rules]], TOML binds each sub-rule to the most recently declared [[tool.konform.KPT.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.noqa_aliases]
IS001 = "KIS001"
IS    = "KIS"
from os.path import join   # noqa: IS001   ← suppresses KIS001 via alias

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

{
  "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

Download files

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

Source Distribution

konform-0.2.0.tar.gz (121.0 kB view details)

Uploaded Source

Built Distributions

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

konform-0.2.0-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

konform-0.2.0-py3-none-win32.whl (2.9 MB view details)

Uploaded Python 3Windows x86

konform-0.2.0-py3-none-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

konform-0.2.0-py3-none-musllinux_1_2_aarch64.whl (3.0 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

konform-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

konform-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

konform-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

konform-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

konform-0.2.0-py3-none-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

konform-0.2.0-py3-none-macosx_10_12_x86_64.whl (3.0 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file konform-0.2.0.tar.gz.

File metadata

  • Download URL: konform-0.2.0.tar.gz
  • Upload date:
  • Size: 121.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for konform-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f75d9032035f701213fc3bfa1c47899263b39d546baaad11b28f508cb68035f
MD5 e74924d01402309583346958dbf8ed66
BLAKE2b-256 13047498f2dccdd825636e8cec346d88d176bcfddce0072571e07a04e61d2681

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0.tar.gz:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: konform-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for konform-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6ee1129a11950affc7107f61d4554f1cd22a6f3aefeccc577f36d958a48162c8
MD5 3983e9d8cf01717711e581fb6018d2f0
BLAKE2b-256 a69db463aa0147252bb1f6dd54307ff29f90772fecec59e0b7abcbd170b7f3a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-win_amd64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-win32.whl.

File metadata

  • Download URL: konform-0.2.0-py3-none-win32.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for konform-0.2.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 bcf07085216706ab6c55cf6e5a6eabdaaa543049ec2e349fc23312950d484f87
MD5 58dc24d2d8521821e012d902a3887be4
BLAKE2b-256 f71f0b1900b2638c2b3474f103c627fb1df99a2a9b30be1d6866ce060a33cfcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-win32.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b1b0d3cf4b2dd52d78b43222f784ebc8ad31de2ecdd52d0359a678152fb8d0b5
MD5 ba6fb181eb8cc2a79ed61fdf591eb146
BLAKE2b-256 532f0c289bbf5e4e22fb39131ac9ae3851b2dc0831d254af6d8ba1ab2e2f9151

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 427bc6b3587f0b9a3799a5ef3723314bca17bd4e15d89744b9975bfa98518876
MD5 81a13204c17025c08a1d3534b24077ce
BLAKE2b-256 dbe892f3dcee8924082a52161e91fd03cbe627a238c73449602c0445f9cf7705

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cb4720acea10a2e1678dc4f78ea4653cf7b19f002e605e577a53cfc313fbd98
MD5 c09bd1e1fb7b1e0a7b6f7b8a67a05b85
BLAKE2b-256 b173706b6470babf5b3a649ac9f4f253527e01f8eb74a8d246c147deb9a280a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7cfd8b5770721641af6abfca1c90b4983fb82da9850b5376b304bee6ca37ec4b
MD5 d84d65e246954f13ef379bcc9497bfbd
BLAKE2b-256 68f00bbb4e9dd62d09909318135202cfa0202a8877db6608d05a5ed201313dc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 db7abb2e1fcfd0a53d72766f9a2a5994d40fac359a383f1243278a96d0f0dde0
MD5 108682beb958349a6d7e688b8df736fb
BLAKE2b-256 12d3fbebd28264758be0153ddd26550db4083684e768d8c3bc5ee2900c8abfae

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ee158c6a8db103d4fb4b42421c1b1ca1dccdb40902c393ce460602f1bd88bf60
MD5 dad377017e74a03a5bf4e5872db7fdda
BLAKE2b-256 6d51ed2c9ad91bb6edb275046bc43f23501fbab217ce3db0b2693f63ce69e959

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69d5a027f8e10230bf026561dcb3b4878765721270f1a7d2959141301e39c010
MD5 1cbdffe770196f2330abce2a642961e1
BLAKE2b-256 2ef73387a292f97e5d777bd33c601352c515578e1cd05d33140f5b02ce7e9de4

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on benediktziegler/konform

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

File details

Details for the file konform-0.2.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for konform-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 10f9018d9e59b4f738fe28dfa127d129de604380f42678098d5300c180cad280
MD5 4ca6ddfa30cafe0b1667443cf61d5e37
BLAKE2b-256 7029bd1fb777d4208dc9ca13f65370dbd0d61c5f8a0e00b70d5b4bf1ae2ca767

See more details on using hashes here.

Provenance

The following attestation bundles were made for konform-0.2.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on benediktziegler/konform

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

Release history Release notifications | RSS feed

This release

0.2.0 This release

11 files

0.1.2

11 files

0.1.1

11 files

0.1.0

11 files

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