Metadata-Version: 2.3
Name: musicalform
Version: 0.3.0
Summary: A Python library for representing and validating musical form annotation labels.
Keywords: music,music theory,musical form,annotation,musicology
License: This is free and unencumbered software released into the public domain.
         
         Anyone is free to copy, modify, publish, use, compile, sell, or
         distribute this software, either in source code form or as a compiled
         binary, for any purpose, commercial or non-commercial, and by any
         means.
         
         In jurisdictions that recognize copyright laws, the author or authors
         of this software dedicate any and all copyright interest in the
         software to the public domain. We make this dedication for the benefit
         of the public at large and to the detriment of our heirs and
         successors. We intend this dedication to be an overt act of
         relinquishment in perpetuity of all present and future rights to this
         software under copyright law.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
         IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
         OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
         ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
         OTHER DEALINGS IN THE SOFTWARE.
         
         For more information, please refer to <https://unlicense.org>
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
Classifier: Topic :: Scientific/Engineering
Requires-Dist: dhparser>=1.8.3
Requires-Dist: pandas>=2.0
Requires-Dist: pytest>=8.0 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.0 ; extra == 'dev'
Requires-Dist: tox>=4.0 ; extra == 'dev'
Requires-Dist: tox-uv>=1.0 ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: autoflake>=2.0 ; extra == 'dev'
Requires-Dist: black>=24.0 ; extra == 'dev'
Requires-Dist: isort>=5.13 ; extra == 'dev'
Requires-Dist: flake8>=7.0 ; extra == 'dev'
Requires-Dist: flake8-bugbear ; extra == 'dev'
Requires-Dist: mypy>=1.0 ; extra == 'dev'
Requires-Python: >=3.11
Provides-Extra: dev
Description-Content-Type: text/markdown

# musicalform

A Python library and infrastructure for modelling musical form.

[![PyPI version](https://img.shields.io/pypi/v/musicalform.svg)](https://pypi.org/project/musicalform/)
[![Python versions](https://img.shields.io/pypi/pyversions/musicalform.svg)](https://pypi.org/project/musicalform/)
[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](https://unlicense.org/)

---

## Installation

```bash
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:

```bash
# 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

```bash
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

```bash
# 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](https://www.conventionalcommits.org/) 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](https://github.com/googleapis/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:

```bash
# 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:

```bash
musicalform --version
```

---

## License

This project is released into the public domain under the [Unlicense](https://unlicense.org/).
See [LICENSE](LICENSE) for details.
