musicalform
A Python library and infrastructure for modelling musical form.
Installation
pip install musicalform
Requirements: Python 3.11+, DHParser 1.8.3+
CLI
The package ships a validate command that tests LCMA form-annotation labels against the current grammar:
# Validate a single expression
musicalform validate -e "bi"
# Validate a text file
musicalform validate -f my_label.txt
# Validate all expressions in a CSV (column: 'expression')
musicalform validate -c annotations.csv
# Extract and validate from a JSON timeline file
musicalform validate -j piece.json -o reports/
# Recursively process a directory of JSON files
musicalform validate -d data/ -o all_results.csv
# Verbose mode (show parse trees and skipped files)
musicalform validate -e "bi" -v
Development
Getting Started
git clone <repo-url>
cd musicalform
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
Running Tests and Checks
# Run tests for all supported Python versions
tox
# Run tests for a specific Python version
tox -e py311
tox -e py312
# Or use pytest directly
pytest
# Run linters
tox -e lint
# Run type checking
tox -e typecheck
Workflow
All pull requests should target the development branch. Commits follow conventional commit format, which enables semantic versioning:
| Commit Message | Version Bump | Emoji |
|---|---|---|
feat: add new feature |
Minor (0.x.0) | ✨ |
fix: resolve issue |
Patch (0.0.x) | 🐛 |
BREAKING CHANGE: description |
Major (x.0.0) | ⚠️ |
docs: update documentation |
No release | 📚 |
refactor: reorganize code |
No release | ♻️ |
test: add tests |
No release | ✅ |
perf: improve performance |
No release | ⚡ |
chore: maintenance tasks |
No release | 🔧 |
Release Process
When commits are pushed to development, Release Please automatically:
- Analyzes conventional commit messages
- Creates a PR with bumped version in
pyproject.tomland updatedCHANGELOG.md - When merged, creates a GitHub Release
To publish to PyPI after a release is created:
# Build the package
tox -e build
# Publish to PyPI (requires TWINE_API_TOKEN in environment)
tox -e publish
Check your version at any time with:
musicalform --version
License
This project is released into the public domain under the Unlicense. See LICENSE for details.
Metadata
Release files for musicalform 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| musicalform-0.3.0.tar.gz | 27.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| musicalform-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.6 kB
Release files / musicalform-0.3.0.tar.gz
| Download URL | musicalform-0.3.0.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad8479c0cc7228387b0d0901dcdb7a7fc6d514f475977a92b40a33f342192e74
|
|
BLAKE2b-256 checksum How to use checksums |
a06127ce1272ece8065455fe2793ad5854f9fd98b1395c346ba28f302c1b71cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / musicalform-0.3.0-py3-none-any.whl
| Download URL | musicalform-0.3.0-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e243aafeaf0640591d90c8ff0811317a8f58b6b6c61ca6656debfe336e8c879f
|
|
BLAKE2b-256 checksum How to use checksums |
191492b0bc3be49e18f217ee73362db1a69fdbadd37be9924134e85998b3950f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|