zuke.tools.knip

← Python API reference

@zuke/knip 1.1.0: @zuke/knip — a typed KnipTasks wrapper for the [Knip](https://knip.dev) CLI (unused files, dependencies, and exports), for use in Zuke builds.

Symbols

#

KnipRunSettings

class
class KnipRunSettings(ToolSettings)

Settings for a knip run.

  • production() -> Self

    Restrict analysis to production code paths (--production).

  • strict() -> Self

    Treat the production set strictly (--strict).

  • fix() -> Self

    Auto-remove unused exports/dependencies where possible (--fix).

  • cache() -> Self

    Enable the analysis cache (--cache).

  • no_exit_code() -> Self

    Always exit 0, even when issues are found (--no-exit-code).

  • config(path: str) -> Self

    Use an explicit config file (--config).

  • workspace(name: str) -> Self

    Restrict to a single workspace (--workspace).

  • reporter(name: str) -> Self

    Choose the reporter, e.g. json or compact (--reporter).

  • include(*types: str) -> Self

    Limit to specific issue types, e.g. files, dependencies (--include).

#

KnipTasks

class
class KnipTasks

Typed task functions for the knip CLI.

  • static async run(ctx: ServiceContext, configure: Callable[[KnipRunSettings], KnipRunSettings] | None=None) -> ExecResult

    Find unused files, dependencies, and exports: knip.