Knip is the standard answer for JavaScript and TypeScript clean-up: in its own words, it "finds and fixes unused dependencies, exports and files." Python teams who use it on the frontend tend to ask the same question next: what's the Python version?

There isn't one tool that does all of it. But most of what Knip checks has a Python equivalent, spread across two or three tools. This page maps them one by one and is honest about where the gaps are.


Knip's checks, mapped to Python

Knip (JS/TS)The Python questionWhat covers it
Unused exportsIs this function, class or method used anywhere in the project?Vulture, Skylos
Unused filesIs this module imported by anything?Gap. Skylos reports empty or docstring-only Python files (SKY-E002), not unimported ones
Unused dependenciesIs this package in pyproject.toml or requirements.txt ever imported?Skylos SKY-U005 (with --quality); deptry
FixesCan the tool remove it for me?Ruff's F401 fix for imports in one file; skylos clean for unused imports and functions

Two related dependency questions come up in Python too:

  • Is an import missing from the declared dependencies? Skylos reports these as SKY-D223 "check this" notes; deptry also covers it.
  • Does an imported package exist at all? Skylos reports a dependency that doesn't exist on PyPI as SKY-D222, a hallucinated dependency.

Python packaging also makes some Knip checks less relevant. There are no exports maps or barrel files to keep tidy, and __all__ is optional, so "unused export" in Python usually just means "unused function or class".


Unused code across modules

This is the part Ruff doesn't do: Ruff's unused-code rules work one file at a time (see Does Ruff detect dead code?).

  • Vulture reports unused functions, classes, methods, properties, attributes and variables across the files you give it, with a confidence value. It's MIT-licensed and exits with code 3 when it finds dead code, so it can fail CI.
  • Skylos builds a project-wide graph, follows dead code transitively, and knows common framework entry points (Flask and FastAPI routes, Django views, pytest fixtures and others), so they aren't reported as unused.

Skylos 4.47.1 on a small demo project:

$ skylos . --format concise
app/main.py:14  SKY-U001  unused function: unused_report
app/report.py:5  SKY-U001  unused function: Report.render_pdf
app/report.py:9  SKY-U004  unused class: OldExporter
app/old_helpers.py:1  SKY-E002  Empty Python file (no code, or docstring-only)

For a fuller comparison of the Python dead-code tools, see deadcode vs Vulture vs Skylos.


Unused and missing dependencies

With --quality, Skylos compares your declared dependencies (pyproject.toml, requirements.txt, a requirements/ folder, setup.py, setup.cfg) with the imports in your Python files:

$ skylos . --quality --ai-defects --format concise
app/main.py:1  SKY-D223  Unverified import 'yaml'. the declared dependencies 'requests', 'rich' could not be checked for this import path, so it is not confirmed as an undeclared or hallucinated dependency.
pyproject.toml:4  SKY-U005  Declared dependency 'requests' appears unused. No matching import found in any Python file.

Two things to know:

  • SKY-U005 skips tools that are never imported. Packages such as pytest, ruff, mypy, black and gunicorn are run, not imported, so they aren't reported as unused.
  • SKY-D223 is a prompt, not a verdict. Import names often differ from distribution names (yaml comes from PyYAML), so Skylos reports imports it can't tie to a declared dependency as "unverified" rather than "missing". A package that doesn't exist on PyPI at all is a different finding, SKY-D222, and that one matters for hallucinated imports in AI-written code.

If dependency hygiene is your main problem, also look at deptry, which describes itself as "a command line utility to check for unused, missing and transitive dependencies in a Python project." We haven't compared the two in depth, so try both on your project.


The gap: modules nothing imports

Knip's "unused files" check is the one Python has no good answer for. Skylos does this for TypeScript and JavaScript (SKY-E003, "Unused TypeScript/JavaScript file (not imported by any other file)"), but in 4.47.1 it doesn't do it for Python. For Python it only reports files that are empty or contain just a docstring.

It's a harder problem in Python than in a bundled TS app. A module can be loaded by a test runner, a console-script entry point, a Django INSTALLED_APPS string, a plugin entry point or importlib.import_module. Until a tool handles that well, the practical options are:

  • read the unused-function findings by file: a module where everything is reported unused is a good candidate for deletion;
  • run your test suite under coverage and look for modules with zero lines executed.

If your repo is TypeScript or mixed

TypeScript or JavaScript only: use Knip. It's ISC-licensed, widely used (about 12.4k GitHub stars on 9 Oct 2026), and it checks things Skylos doesn't, such as unused package.json dependencies. In our TypeScript demo, Skylos reported the unused file and the unused functions but said nothing about two unused npm dependencies:

$ skylos . --format concise
src/legacy.ts:1  SKY-U001  unused function: oldHelper
src/text.ts:5  SKY-U001  unused function: titleCase
src/legacy.ts:1  SKY-E003  Unused TypeScript/JavaScript file (not imported by any other file)

Mixed Python and TypeScript: run Knip on the TypeScript packages. On the Python side, run a dead-code tool and a dependency check. Skylos can scan both languages in one run, which keeps CI simple, but it doesn't replace Knip's dependency checks on the JS side.


A starting setup for Python

pip install skylos

skylos .                          # unused functions, classes, methods, imports, variables
skylos . --quality                # adds SKY-U005 unused declared dependencies
skylos clean . --dry-run          # preview removing unused imports and functions

Add --strict to make the scan exit 1 when it finds anything, for pre-commit or CI. The dead-code docs cover confidence levels and how to mark code as used.



Try it

pip install skylos
skylos . --quality