Skip to content

condor

Finds unused Python code: functions nobody calls, classes nobody uses, leftover imports and variables, unreachable code. A faster vulture with fewer false positives.

$ uvx cndr src/
src/app/loader.py:12: unused function 'useful_load' (60% confidence)
src/app/models.py:3: unused import 'json' (90% confidence)
src/app/worker.py:41: unreachable code after 'return' (100% confidence)

Install

The package is cndr; it installs the condor and cndr commands.

  • Run once

    uvx cndr .

  • Install the tool

    uv tool install cndr

  • In a project

    uv add --dev cndr

Use

$ condor src/ tests/                # files or directories
$ condor . --min-confidence 80      # only the surest findings
$ condor . --only function,class    # only some kinds
$ condor . --format json            # or sarif
$ condor . --make-whitelist > whitelist.py

Exit status: 0 nothing found, 3 dead code found, 1 a file could not be parsed, 2 bad options. condor --help lists every option.

Configure

In pyproject.toml ([tool.vulture] works too):

[tool.condor]
paths = ["src", "tests"]
exclude = ["*/migrations/*"]
ignore_names = ["visit_*"]
min_confidence = 60

False positives

Code used by a framework or by name looks unused. condor knows the common cases through plugins. For the rest: add # noqa to the line, add the name to ignore_names, or keep a whitelist made with --make-whitelist and pass it as a path.