Skip to main content

A Python library for representing and validating musical form annotation labels.

Project description

musicalform

A Python library and infrastructure for modelling musical form.

PyPI version Python versions License: Unlicense


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:

  1. Analyzes conventional commit messages
  2. Creates a PR with bumped version in pyproject.toml and updated CHANGELOG.md
  3. 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.

Project details


Download files

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

Source Distribution

musicalform-0.3.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

musicalform-0.3.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file musicalform-0.3.0.tar.gz.

File metadata

  • Download URL: musicalform-0.3.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for musicalform-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ad8479c0cc7228387b0d0901dcdb7a7fc6d514f475977a92b40a33f342192e74
MD5 0fa80505be226f4442fc8b43d4c2da84
BLAKE2b-256 a06127ce1272ece8065455fe2793ad5854f9fd98b1395c346ba28f302c1b71cd

See more details on using hashes here.

File details

Details for the file musicalform-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: musicalform-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for musicalform-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e243aafeaf0640591d90c8ff0811317a8f58b6b6c61ca6656debfe336e8c879f
MD5 148ed617e711bcced3a270eb66b9defd
BLAKE2b-256 191492b0bc3be49e18f217ee73362db1a69fdbadd37be9924134e85998b3950f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page