Skip to main content

kmapper-iscc-scan

Workspace-based ISCC content inventory and similarity clustering CLI.

Developed by kmapper GmbH, not related to the k-means mapper algorithm from topological data analysis.

How it works

This CLI is built on the ISCC (International Standard Content Code), an ISO standard (ISO 24138) for content-derived, decentralized media identifiers.

Scanning walks a directory recursively and generates an ISCC for each supported file. The ISCC encodes information about the file's content (not just its name or hash) so two files with different names but identical content will produce the same code. Each result is written as a sidecar .iscc.json file next to (or mirroring) the original file in the workspace.

Compiling aggregates all sidecar files from all scans into a single CSV inventory. It uses the Content Unit embedded in each ISCC to cluster files by similarity via Hamming distance. The result lets you identify:

  • Exact duplicates — same content, regardless of filename
  • Near-duplicates and similar content — e.g. a .pptx presentation and its .pdf handout will appear in the same cluster

Installation

1. Check your Python version

python --version

You need Python 3.12 or higher. If the command is not found or the version is too old, see below.

Installing Python

macOS / Linux: Download from python.org or use your system package manager.

Windows: The easiest option is uv, a fast Python manager written in Rust:

# Install uv
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Install Python 3.12
uv python install 3.12

2. Install the package

pip install kmapper-iscc-scan

Usage

Scanning

Scan a directory recursively (i.e. including all subdirectories) to generate an ISCC for each relevant file and store the metadata files in your given workspace directory:

# Scan a directory into a workspace
kmapper-iscc-scan scan /path/to/content /path/to/workspace

The above command will create a default batch name for your scanned directory. You can optionally determine your own batch name with:

kmapper-iscc-scan scan /path/to/content /path/to/workspace --batch my-batch

Compiling

Compile all the metadata files from all your different scans into one inventory CSV file, including clustering of identical or similar files:

# Compile an inventory CSV with similarity clustering
kmapper-iscc-scan compile /path/to/workspace

The above command will use a default Hamming distance of 10 (i.e. approx. 84.38% similarity). You can optionally set your own Hamming distance (0–64) or indicate a similarity in percent (0–100):

# Optionally compile with your own Hamming distance
kmapper-iscc-scan compile /path/to/workspace --hamming 15

# Optionally compile with your own similarity in percent
kmapper-iscc-scan compile /path/to/workspace --similarity 90

The inventory CSV

The CSV contains one row per file. The three grouping columns follow a hierarchy — each level is a subset of the one below:

  • instance_group — files that are byte-for-byte identical (exact copies, regardless of filename or location). Files in the same instance group are always also in the same data group.
  • data_group — files with the same data structure (e.g. the same PDF re-saved with slightly different metadata, causing the raw bytes to differ). Files in the same data group are always also in the same content cluster.
  • content_cluster — files with similar content regardless of format or encoding (e.g. a .pptx presentation and its .pdf handout). This is the broadest grouping.

The following example shows a selection of columns to illustrate the grouping. The actual CSV also includes batch, paths, filesize, ISCC code, and the individual ISCC units.

filename mediatype instance_group data_group content_cluster hamming_threshold similarity_threshold
demo.pptx pptx 1 1 1 10 84.38
demo_final.pptx pptx 1 1 1 10 84.38
document_v1.docx docx 1 10 84.38
version_basel_on-site.docx docx 1 10 84.38
final_print-version.pdf pdf 1 10 84.38
screenshot.png png 2 2 2 10 84.38
screenshot_jira_v2.png png 2 2 2 10 84.38

demo.pptx and demo_final.pptx are byte-for-byte identical despite their different names. Together with the .docx and .pdf files they form a content cluster of similar documents. The two screenshots are exact copies in a separate cluster.

Checking the Scans

Check which directories have already been scanned:

# Show workspace status
kmapper-iscc-scan status /path/to/workspace

Workspace structure

workspace/
  scan_log.json
  sidecars/
    my-batch/
      subdir/
        file.pdf.iscc.json
  iscc_inventory.csv

Development

Set up a local environment with uv:

uv sync

This creates a .venv and installs the dependencies (and the project itself, in editable mode). Run the CLI without a separate install step:

uv run kmapper-iscc-scan scan /path/to/content /path/to/workspace
# or, directly by path:
uv run python src/kmapper_iscc_scan/kmapper_iscc_scan.py scan /path/to/content /path/to/workspace

License

MIT

Metadata

Release files for kmapper-iscc-scan 0.2.2

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

Source distribution (sdist)

Source distribution for kmapper-iscc-scan 0.2.2
File Size Uploaded
kmapper_iscc_scan-0.2.2.tar.gz 110.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kmapper-iscc-scan 0.2.2
File Interpreter ABI Platform
kmapper_iscc_scan-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 121.1 kB

Release files / kmapper_iscc_scan-0.2.2.tar.gz

Download URL kmapper_iscc_scan-0.2.2.tar.gz
Size 110.8 kB
Tags Source
SHA-256 checksum
How to use checksums
350865ce24206e9c1d3ff1e6f61647a2004374b63537f7767f18666a53b09aee
BLAKE2b-256 checksum
How to use checksums
8012bc146b7db6287366129abd2faac587370031bc2e896bf18a0c3d04e3ab73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"SlimbookOS","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / kmapper_iscc_scan-0.2.2-py3-none-any.whl

Download URL kmapper_iscc_scan-0.2.2-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78dd949c489e3c929e9165a217846b31946661bae142ae459fc902ca36740865
BLAKE2b-256 checksum
How to use checksums
beeed3e5a8b2bfc889c64d1a91e16909315e1f1eb600ed0f1266ad1ffc0ae557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"SlimbookOS","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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