Skip to main content

songscan

Read songs out of PDFs. A chord chart becomes ChordPro, with the song's details (title, artists, key, tempo, time, capo, copyright) alongside; sheet music will become MusicXML.

A PDF's own text is read first: charts typed up in a word processor or chart app keep their words and where each sits on the page, so their chords can be put back over the syllables they are played on, without asking anyone. Anything else (scans, photos, sheet music, or text that isn't plainly a chord chart) is read by Claude, looking at its pages.

Installation

uv add "songscan @ git+https://github.com/jnhmcknight/songscan.git"

Reading scans needs an Anthropic API key, in ANTHROPIC_API_KEY or a client you pass in. PDFs with their own text don't use it.

Usage

from songscan import ScanError, scan_pdf

try:
    result = scan_pdf(pdf_bytes)
except ScanError as error:
    ...  # error.retryable: whether trying again later may work

result.kind       # "chord_chart", "score" or "other"
result.chordpro   # a chord chart's ChordPro, details and all; else None
result.meta       # ScanMeta: title, artists, key, tempo, time, capo, copyright
result.source     # "text" (the PDF's own) or "vision" (Claude's reading)
result.warnings   # anything to check, or that couldn't be done

To choose the client or model:

import anthropic

result = scan_pdf(pdf_bytes, client=anthropic.Anthropic(api_key=...), model="claude-opus-5-5")

Development

uv sync
uv run pytest
uv run ruff check && uv run black --check . && uv run pyright

Tests that read PDFs with vision use a stand-in for Claude. To run them against the real API instead (which costs a little), set SONGSCAN_LIVE_API=1 with a key in ANTHROPIC_API_KEY:

SONGSCAN_LIVE_API=1 uv run pytest

Tests of how songscan handles the API's answers and errors use the stand-in either way.

Metadata

Release files for songscan 0.1.0

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

Source distribution (sdist)

Source distribution for songscan 0.1.0
File Size Uploaded Provenance Actions
songscan-0.1.0.tar.gz 9.0 kB Without provenance Details for songscan-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for songscan 0.1.0
File Interpreter ABI Platform Actions
songscan-0.1.0-py3-none-any.whl Python 3 none any Details for songscan-0.1.0-py3-none-any.whl

Total release size: 19.8 kB

Release files / songscan-0.1.0.tar.gz

Download URL songscan-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0abef5fe7358b0661949d99a844888dc960bff6806599cc2e7fa0b357a56fbbe
BLAKE2b-256 checksum
How to use checksums
c401cd931f19e5298298db949219e70c213ff150ef24b5e93e781394b91d4f3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / songscan-0.1.0-py3-none-any.whl

Download URL songscan-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7b789301c26c491856d6edbd109093502fc29711925dad733ec66f30a7bd4ac
BLAKE2b-256 checksum
How to use checksums
f2c420d2892320755f5a1d1f5b153a7794247d0b7cfb7f8cb91878a7c19b6127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for songscan 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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