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.2.0.tar.gz (23.8 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.2.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for musicalform-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fa83686b0b426563aabfa18e74fce43a50b5fd2c3d920a3b22f9696045c0758
MD5 aff10a963ffdccf0a001499682e188f2
BLAKE2b-256 274fc78c7e28c1db4c611f8a8e292a10681db241fbcb8a6ae16e41ad9d76a3bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: musicalform-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ad8267a6ad3ca982e0f1c7733bb6cd692fc80c9ca97ddbba02c15857e46eb74
MD5 72ba9e82c1ed407cc9ba13dfbff548b0
BLAKE2b-256 2d61b4972799a28663e46caba45da8119047a4cc274e56fbb348b20191ad42bb

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