chordsym
Chord symbols without dependencies (standard library only): is this token a chord, which root and quality, which pitch classes, which key does a song's chord list suggest, and how do the chords read moved by N semitones.
>>> from chordsym import parse_chord, chord_tones, transpose_chord, transposition_table, estimate_key
>>> parse_chord("F#m7"), chord_tones("Cmaj7")
((6, 'minor'), (0, 4, 7, 11))
>>> transpose_chord("C/E", 3, flats=True)
'Eb/G'
>>> transposition_table(["G", "D", "Em", "C"], 3)["chords"]
{'G': 'Bb', 'D': 'F', 'Em': 'Gm', 'C': 'Eb'}
It reads the spellings found in scraped chord charts (C6/9, Bm5-/7, Brazilian 7M, E7(#9), D/F#), not only textbook ones. Pitch classes are ints 0-11 (C = 0).
In the browser: the TypeScript twin
The same functions ship to npm as chordsym (in ts/), with camelCase names and keyword arguments as an options object:
import { parseChord, transposeChord, estimateKey } from "chordsym";
parseChord("Am7"); // [9, "minor"]
transposeChord("C/E", 3, { flats: true }); // "Eb/G"
estimateKey(["Am", "Dm", "E7"]); // { tonic: 9, minor: true }
The two are kept identical by construction, not by care:
- One grammar. Every regular expression and table lives in
chordsym/_grammar.py, written in the subset of regex syntax that means the same in Python and JavaScript (no\d,\s,\w,\b).python -m chordsym._codegenwrites it tots/src/grammar.generated.ts, and a test fails if that file is stale. - One set of golden cases.
fixtures/cases.jsonholds about 1,500 calls with their expected results, errors included (ValueErrorin Python isRangeErrorin TypeScript). pytest and vitest both run every one and compare them as JSON text, so order matters. To add a case, append it and runpython -m chordsym._fixtures, which records the Python results; review the diff, since a changed expectation is a behaviour change on both sides. - A wide net before releases.
python scripts/twin_differential.py(aftercd ts && npm run build) runs about 75,000 generated chord spellings and 3,000 songs through both and reports any difference.
Where the languages differ, the TypeScript side says so in its types: transpositionTable(...).chords is a Map (a plain object would reorder integer-like keys), and a Key is a plain { tonic, minor } object checked by every function that takes one (keyEquals compares two).
Versions: an npm release carries the version of the Python release it was cut from (lockstep at release points, so chordsym@X.Y.Z on npm and PyPI are the same behaviour).
Seeded from songleaf (thorwhalen/songleaf#31). Planned: dialects (Harte, Chordonomicon, Nashville/Roman) as strategies; pychord and music21 as test oracles only.
Metadata
Release files for chordsym 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chordsym-0.0.2.tar.gz | 31.9 kB | Without provenance | Details for chordsym-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chordsym-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for chordsym-0.0.2-py3-none-any.whl |
Total release size: 43.1 kB
Release files / chordsym-0.0.2.tar.gz
| Download URL | chordsym-0.0.2.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f3cc9b4cd6fd6359dfe07debb2b58a047af43588590581ea0dbcde9a4f6c90f
|
|
BLAKE2b-256 checksum How to use checksums |
40a637368540d3b62327667dbff23d5cf4a545c4a10c57371de718d6181d7b1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / chordsym-0.0.2-py3-none-any.whl
| Download URL | chordsym-0.0.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62e552988904d7711ae34cc125da91f26957ea24cf75701e47e39a3ebd9c5a8c
|
|
BLAKE2b-256 checksum How to use checksums |
660a966a8b3b56198dbe014c76cbc6374bf940a85db467c1894fa8cbaebb9813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for chordsym 0.0.2
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.