Skip to main content

clapback-client

The contract a tool follows to take part in the clapback commons — look up before you contribute, send what the records require, back off when told to — with no dependency beyond the standard library.

pip install clapback-client
from clapback_client import Corpus, fingerprint_file, hash_fingerprint

key = hash_fingerprint(fingerprint_file("track.flac"))
corpus = Corpus()

row = corpus.lookup(key, pipeline_version)
if row is not None:
    vector = row["embedding"]          # the commons already had it — skip the model
else:
    vector = my_embedder(path)         # your pipeline, declared by `pipeline_version`
    corpus.contribute(
        fingerprint_hash=key,
        embedding=vector,
        pipeline_version=pipeline_version,
        client_id=client_id,
    )

What a tool has to do

Four things. Each is decided in one of the project's records, and this package is those decisions as code so a tool does not have to reimplement them.

  1. Fingerprint the audio and hash it canonically. hash_fingerprint is SHA256 of the AcoustID fingerprint exactly as chromaprint returns it — not as your database happened to store it. That distinction split a corpus once; canonical() is the guard.
  2. Produce the vector through a declared pipeline. This package never embeds. The reference pipeline is clapback-embed, whose PIPELINE_VERSION is the identity to send. A tool with its own pipeline declares its own identity, and its vectors are comparable with each other rather than with the reference's.
  3. Look up before contributing. Corpus.has or Corpus.lookup. A repeat submission is recorded as agreement, so a tool that re-sent its library would manufacture evidence of one install agreeing with itself — the one measurement the commons exists to make honestly.
  4. Send client_id and pipeline_version. Both are required by Corpus.contribute and have no defaults. client_id is a random UUID minted once per install — identity.mint_client_id — on the first contribution, never on install, and stored where the user can find and delete it.

What you get back

  • Skip the recompute. lookup returns the stored vector for a recording the commons already holds under your pipeline.
  • Similarity across libraries you do not own/v1/similar, once the corpus's recording-id key lands.
  • Confirmation — whether your vector for a recording agrees with others' independently computed one.

The commons is worth exactly its coverage of the library asking. Early on, expect misses.

Fingerprinting needs chromaprint, and only fingerprinting does

brew install chromaprint     # or: apt install libchromaprint-tools
pip install pyacoustid

fingerprint_file runs it out of process, because chromaprint is a C library that crashes rather than raises on some malformed inputs and one bad file must not end a run. If your tool already has fingerprints — beets' chroma plugin stores them, Picard computes them natively — hand them to hash_fingerprint directly and skip this.

Opt-in, off by default

Nothing in this package sends anything until you call contribute. A tool that embeds this should keep contribution a separate, explicit setting from lookup, and should tell the user what leaves the machine — a 512-float vector and a one-way hash, never audio, filenames, or metadata — before the first time it does.

Download files

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

Source Distribution

clapback_client-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

clapback_client-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file clapback_client-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for clapback_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ab19019f2749af4ff395c0037fd2cef46fd1222dfafec5311d15b0ada6fe9d9
MD5 d5a5ffb04d89e75fb979e54ceb7d7874
BLAKE2b-256 084f0f31a42d09421de2f90de5c8f3f614f5ad6cdbcc0bac9988c831262a584c

See more details on using hashes here.

Provenance

The following attestation bundles were made for clapback_client-0.1.0.tar.gz:

Publisher: client-release.yml on seethroughlab/clapback

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

File details

Details for the file clapback_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clapback_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for clapback_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2f97ccaae057a22cf8694f608fd9bbbe5478d407d0e54f9dd4005b327163a45
MD5 64219754061afbaa43a366d740caa156
BLAKE2b-256 e6d9b8f83827da28d7d755a5f8741c8b487a4eead2bdf2c716e2ca66fd46a9e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for clapback_client-0.1.0-py3-none-any.whl:

Publisher: client-release.yml on seethroughlab/clapback

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

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 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