Repository navigation
python: v0.2.0
trackparse is now on PyPI. The Python port parses track strings exactly like the npm package: it passes the same 11,891 fixtures, and its JSON output is byte-identical to the JS package for every one of them.
pip install trackparse # or: uv add trackparsefrom trackparse import parse, format_track
track = parse("01. Wilkinson ft. Becky Hill & Tom Cane - Afterglow (Sub Focus VIP Remix) [Official Video]")
[f"{a.name} ({a.role})" for a in track.artists]
# ['Wilkinson (primary)', 'Becky Hill (featured)', 'Tom Cane (featured)']
track.title # 'Afterglow'
track.versions[0].artists[0].name # 'Sub Focus'
track.versions[0].modifiers # ('vip',)
track.junk # (Junk(raw='Official Video', kind='video'),)
format_track(track, joiners="canonical")
# 'Wilkinson feat. Becky Hill & Tom Cane - Afterglow (Sub Focus VIP Remix)'Python
- Python 3.9 to 3.14, no dependencies, typed (
py.typed, passesmypy --strict). parse,parse_artists,format_track,normalize,all_artists,create_parser,SPEC_VERSION. Options are keyword arguments (known_artists=[...]).- Results are frozen dataclasses with snake_case attributes and tuples.
to_dict()returns the spec's camelCase JSON, the same as the JS package. - Checked against JS on the full output of every fixture (
scripts/compare-ports.mjs, 0 differences). - Full API: python/README.md.
Spec
- R0.6 now defines "letter" as Unicode general category L (JS
/\p{L}/u, Pythonstr.isalpha()) instead of Unicode Alphabetic, which Python can't test directly. Letter numbers such asⅠand combining marks no longer count as letters. Only the unspaced-dash split (R6.7, youtube and filename modes) uses this test. Two new fixtures inseparators.jsonpin it.
Releases and CI
js,specandpythonnow share one version and release together. Tags:js-v0.2.0,spec-v0.2.0,python-v0.2.0.- PyPI publishing uses trusted publishing (OIDC, no stored token) with attestations. The wheel and sdist are attached to the GitHub Release.
- New
python.ymlworkflow: lint,mypy --strictand the full test suite on Python 3.9 to 3.14, plus every fixture run against the built wheel in a clean venv.
Changelog
0.2.0 (2026-10-01)
Features
- initial trackparse spec, fixtures and js package (cf346e8)
- python: add the python port of trackparse (a618a42)
Install (Python)
pip install trackparse==0.2.0PyPI: https://pypi.org/project/trackparse/0.2.0/ · implements spec 0.2.0 (SPEC.md)