musicalform 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- musicalform-0.1.0/LICENSE +24 -0
- musicalform-0.1.0/PKG-INFO +179 -0
- musicalform-0.1.0/README.md +126 -0
- musicalform-0.1.0/pyproject.toml +59 -0
- musicalform-0.1.0/src/musicalform/__init__.py +69 -0
- musicalform-0.1.0/src/musicalform/cli/__init__.py +1 -0
- musicalform-0.1.0/src/musicalform/cli/lcma_standardParser.py +756 -0
- musicalform-0.1.0/src/musicalform/cli/main.py +87 -0
- musicalform-0.1.0/src/musicalform/cli/validate.py +469 -0
- musicalform-0.1.0/src/musicalform/core.py +634 -0
- musicalform-0.1.0/src/musicalform/enums.py +324 -0
- musicalform-0.1.0/src/musicalform/utils.py +105 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: musicalform
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python library for representing and validating musical form annotation labels.
|
|
5
|
+
Keywords: music,music theory,musical form,annotation,musicology
|
|
6
|
+
License: This is free and unencumbered software released into the public domain.
|
|
7
|
+
|
|
8
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
9
|
+
distribute this software, either in source code form or as a compiled
|
|
10
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
11
|
+
means.
|
|
12
|
+
|
|
13
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
14
|
+
of this software dedicate any and all copyright interest in the
|
|
15
|
+
software to the public domain. We make this dedication for the benefit
|
|
16
|
+
of the public at large and to the detriment of our heirs and
|
|
17
|
+
successors. We intend this dedication to be an overt act of
|
|
18
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
19
|
+
software under copyright law.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
25
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
26
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
27
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
For more information, please refer to <https://unlicense.org>
|
|
30
|
+
Classifier: Development Status :: 3 - Alpha
|
|
31
|
+
Classifier: Intended Audience :: Science/Research
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
|
|
36
|
+
Classifier: Topic :: Scientific/Engineering
|
|
37
|
+
Requires-Dist: dhparser>=1.8.3
|
|
38
|
+
Requires-Dist: pandas>=2.0
|
|
39
|
+
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-cov>=4.0 ; extra == 'dev'
|
|
41
|
+
Requires-Dist: tox>=4.0 ; extra == 'dev'
|
|
42
|
+
Requires-Dist: tox-uv>=1.0 ; extra == 'dev'
|
|
43
|
+
Requires-Dist: pre-commit ; extra == 'dev'
|
|
44
|
+
Requires-Dist: autoflake>=2.0 ; extra == 'dev'
|
|
45
|
+
Requires-Dist: black>=24.0 ; extra == 'dev'
|
|
46
|
+
Requires-Dist: isort>=5.13 ; extra == 'dev'
|
|
47
|
+
Requires-Dist: flake8>=7.0 ; extra == 'dev'
|
|
48
|
+
Requires-Dist: flake8-bugbear ; extra == 'dev'
|
|
49
|
+
Requires-Dist: mypy>=1.0 ; extra == 'dev'
|
|
50
|
+
Requires-Python: >=3.11
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
53
|
+
|
|
54
|
+
# musicalform
|
|
55
|
+
|
|
56
|
+
A Python library and infrastructure for modelling musical form.
|
|
57
|
+
|
|
58
|
+
[](https://pypi.org/project/musicalform/)
|
|
59
|
+
[](https://pypi.org/project/musicalform/)
|
|
60
|
+
[](https://unlicense.org/)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install musicalform
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Requirements:** Python 3.11+, DHParser 1.8.3+
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## CLI
|
|
75
|
+
|
|
76
|
+
The package ships a `validate` command that tests LCMA form-annotation labels against the current grammar:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Validate a single expression
|
|
80
|
+
musicalform validate -e "bi"
|
|
81
|
+
|
|
82
|
+
# Validate a text file
|
|
83
|
+
musicalform validate -f my_label.txt
|
|
84
|
+
|
|
85
|
+
# Validate all expressions in a CSV (column: 'expression')
|
|
86
|
+
musicalform validate -c annotations.csv
|
|
87
|
+
|
|
88
|
+
# Extract and validate from a JSON timeline file
|
|
89
|
+
musicalform validate -j piece.json -o reports/
|
|
90
|
+
|
|
91
|
+
# Recursively process a directory of JSON files
|
|
92
|
+
musicalform validate -d data/ -o all_results.csv
|
|
93
|
+
|
|
94
|
+
# Verbose mode (show parse trees and skipped files)
|
|
95
|
+
musicalform validate -e "bi" -v
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
### Getting Started
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone <repo-url>
|
|
106
|
+
cd musicalform
|
|
107
|
+
|
|
108
|
+
# Install in editable mode with dev dependencies
|
|
109
|
+
pip install -e ".[dev]"
|
|
110
|
+
|
|
111
|
+
# Install pre-commit hooks
|
|
112
|
+
pre-commit install
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Running Tests and Checks
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Run tests for all supported Python versions
|
|
119
|
+
tox
|
|
120
|
+
|
|
121
|
+
# Run tests for a specific Python version
|
|
122
|
+
tox -e py311
|
|
123
|
+
tox -e py312
|
|
124
|
+
|
|
125
|
+
# Or use pytest directly
|
|
126
|
+
pytest
|
|
127
|
+
|
|
128
|
+
# Run linters
|
|
129
|
+
tox -e lint
|
|
130
|
+
|
|
131
|
+
# Run type checking
|
|
132
|
+
tox -e typecheck
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Workflow
|
|
136
|
+
|
|
137
|
+
All pull requests should target the **`development`** branch. Commits follow [conventional commit](https://www.conventionalcommits.org/) format, which enables semantic versioning:
|
|
138
|
+
|
|
139
|
+
| Commit Message | Version Bump | Emoji |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| `feat: add new feature` | Minor (0.x.0) | ✨ |
|
|
142
|
+
| `fix: resolve issue` | Patch (0.0.x) | 🐛 |
|
|
143
|
+
| `BREAKING CHANGE: description` | Major (x.0.0) | ⚠️ |
|
|
144
|
+
| `docs: update documentation` | No release | 📚 |
|
|
145
|
+
| `refactor: reorganize code` | No release | ♻️ |
|
|
146
|
+
| `test: add tests` | No release | ✅ |
|
|
147
|
+
| `perf: improve performance` | No release | ⚡ |
|
|
148
|
+
| `chore: maintenance tasks` | No release | 🔧 |
|
|
149
|
+
|
|
150
|
+
### Release Process
|
|
151
|
+
|
|
152
|
+
When commits are pushed to `development`, [Release Please](https://github.com/googleapis/release-please) automatically:
|
|
153
|
+
|
|
154
|
+
1. Analyzes conventional commit messages
|
|
155
|
+
2. Creates a PR with bumped version in `pyproject.toml` and updated `CHANGELOG.md`
|
|
156
|
+
3. When merged, creates a GitHub Release
|
|
157
|
+
|
|
158
|
+
To publish to PyPI after a release is created:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Build the package
|
|
162
|
+
tox -e build
|
|
163
|
+
|
|
164
|
+
# Publish to PyPI (requires TWINE_API_TOKEN in environment)
|
|
165
|
+
tox -e publish
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Check your version at any time with:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
musicalform --version
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
This project is released into the public domain under the [Unlicense](https://unlicense.org/).
|
|
179
|
+
See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# musicalform
|
|
2
|
+
|
|
3
|
+
A Python library and infrastructure for modelling musical form.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/musicalform/)
|
|
6
|
+
[](https://pypi.org/project/musicalform/)
|
|
7
|
+
[](https://unlicense.org/)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install musicalform
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Requirements:** Python 3.11+, DHParser 1.8.3+
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## CLI
|
|
22
|
+
|
|
23
|
+
The package ships a `validate` command that tests LCMA form-annotation labels against the current grammar:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Validate a single expression
|
|
27
|
+
musicalform validate -e "bi"
|
|
28
|
+
|
|
29
|
+
# Validate a text file
|
|
30
|
+
musicalform validate -f my_label.txt
|
|
31
|
+
|
|
32
|
+
# Validate all expressions in a CSV (column: 'expression')
|
|
33
|
+
musicalform validate -c annotations.csv
|
|
34
|
+
|
|
35
|
+
# Extract and validate from a JSON timeline file
|
|
36
|
+
musicalform validate -j piece.json -o reports/
|
|
37
|
+
|
|
38
|
+
# Recursively process a directory of JSON files
|
|
39
|
+
musicalform validate -d data/ -o all_results.csv
|
|
40
|
+
|
|
41
|
+
# Verbose mode (show parse trees and skipped files)
|
|
42
|
+
musicalform validate -e "bi" -v
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
### Getting Started
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone <repo-url>
|
|
53
|
+
cd musicalform
|
|
54
|
+
|
|
55
|
+
# Install in editable mode with dev dependencies
|
|
56
|
+
pip install -e ".[dev]"
|
|
57
|
+
|
|
58
|
+
# Install pre-commit hooks
|
|
59
|
+
pre-commit install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Running Tests and Checks
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Run tests for all supported Python versions
|
|
66
|
+
tox
|
|
67
|
+
|
|
68
|
+
# Run tests for a specific Python version
|
|
69
|
+
tox -e py311
|
|
70
|
+
tox -e py312
|
|
71
|
+
|
|
72
|
+
# Or use pytest directly
|
|
73
|
+
pytest
|
|
74
|
+
|
|
75
|
+
# Run linters
|
|
76
|
+
tox -e lint
|
|
77
|
+
|
|
78
|
+
# Run type checking
|
|
79
|
+
tox -e typecheck
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Workflow
|
|
83
|
+
|
|
84
|
+
All pull requests should target the **`development`** branch. Commits follow [conventional commit](https://www.conventionalcommits.org/) format, which enables semantic versioning:
|
|
85
|
+
|
|
86
|
+
| Commit Message | Version Bump | Emoji |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `feat: add new feature` | Minor (0.x.0) | ✨ |
|
|
89
|
+
| `fix: resolve issue` | Patch (0.0.x) | 🐛 |
|
|
90
|
+
| `BREAKING CHANGE: description` | Major (x.0.0) | ⚠️ |
|
|
91
|
+
| `docs: update documentation` | No release | 📚 |
|
|
92
|
+
| `refactor: reorganize code` | No release | ♻️ |
|
|
93
|
+
| `test: add tests` | No release | ✅ |
|
|
94
|
+
| `perf: improve performance` | No release | ⚡ |
|
|
95
|
+
| `chore: maintenance tasks` | No release | 🔧 |
|
|
96
|
+
|
|
97
|
+
### Release Process
|
|
98
|
+
|
|
99
|
+
When commits are pushed to `development`, [Release Please](https://github.com/googleapis/release-please) automatically:
|
|
100
|
+
|
|
101
|
+
1. Analyzes conventional commit messages
|
|
102
|
+
2. Creates a PR with bumped version in `pyproject.toml` and updated `CHANGELOG.md`
|
|
103
|
+
3. When merged, creates a GitHub Release
|
|
104
|
+
|
|
105
|
+
To publish to PyPI after a release is created:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Build the package
|
|
109
|
+
tox -e build
|
|
110
|
+
|
|
111
|
+
# Publish to PyPI (requires TWINE_API_TOKEN in environment)
|
|
112
|
+
tox -e publish
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Check your version at any time with:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
musicalform --version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
This project is released into the public domain under the [Unlicense](https://unlicense.org/).
|
|
126
|
+
See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.7"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "musicalform"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Python library for representing and validating musical form annotation labels."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["music", "music theory", "musical form", "annotation", "musicology"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Science/Research",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"License :: OSI Approved :: The Unlicense (Unlicense)",
|
|
20
|
+
"Topic :: Scientific/Engineering",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"DHParser>=1.8.3",
|
|
24
|
+
"pandas>=2.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=8.0",
|
|
30
|
+
"pytest-cov>=4.0",
|
|
31
|
+
"tox>=4.0",
|
|
32
|
+
"tox-uv>=1.0",
|
|
33
|
+
"pre-commit",
|
|
34
|
+
"autoflake>=2.0",
|
|
35
|
+
"black>=24.0",
|
|
36
|
+
"isort>=5.13",
|
|
37
|
+
"flake8>=7.0",
|
|
38
|
+
"flake8-bugbear",
|
|
39
|
+
"mypy>=1.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
musicalform = "musicalform.cli.main:run"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools]
|
|
46
|
+
package-dir = {"" = "src"}
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.black]
|
|
52
|
+
line-length = 120
|
|
53
|
+
target-version = ["py311"]
|
|
54
|
+
exclude = 'lcma_standardParser\.py'
|
|
55
|
+
|
|
56
|
+
[tool.isort]
|
|
57
|
+
profile = "black"
|
|
58
|
+
line_length = 120
|
|
59
|
+
extend_skip = ["lcma_standardParser.py"]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""musicalform: A Python library for representing and validating musical form annotation labels."""
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from importlib.metadata import version as _get_version
|
|
5
|
+
|
|
6
|
+
__version__ = _get_version("musicalform")
|
|
7
|
+
except Exception:
|
|
8
|
+
__version__ = "0.1.0" # fallback for development
|
|
9
|
+
|
|
10
|
+
from musicalform.core import (
|
|
11
|
+
AnnotationLabel,
|
|
12
|
+
FormalFunction,
|
|
13
|
+
FormalType,
|
|
14
|
+
FormLabel,
|
|
15
|
+
FunctionalTransformation,
|
|
16
|
+
GenericFunction,
|
|
17
|
+
MaterialReferences,
|
|
18
|
+
PlaceholderLabel,
|
|
19
|
+
References,
|
|
20
|
+
ReferencingLabel,
|
|
21
|
+
SingleFunction,
|
|
22
|
+
SingleReference,
|
|
23
|
+
SpecificFunction,
|
|
24
|
+
TransformationalReferences,
|
|
25
|
+
)
|
|
26
|
+
from musicalform.enums import (
|
|
27
|
+
MAIN_TO_SUBTYPES,
|
|
28
|
+
CertaintyName,
|
|
29
|
+
FancyStrEnum,
|
|
30
|
+
FunctionSpecificity,
|
|
31
|
+
MainType,
|
|
32
|
+
MaterialOperator,
|
|
33
|
+
PlaceholderName,
|
|
34
|
+
ReferenceSentinel,
|
|
35
|
+
SpecificFunctionName,
|
|
36
|
+
SubType,
|
|
37
|
+
UnitName,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"__version__",
|
|
42
|
+
# enums
|
|
43
|
+
"FancyStrEnum",
|
|
44
|
+
"SpecificFunctionName",
|
|
45
|
+
"UnitName",
|
|
46
|
+
"FunctionSpecificity",
|
|
47
|
+
"MainType",
|
|
48
|
+
"SubType",
|
|
49
|
+
"MAIN_TO_SUBTYPES",
|
|
50
|
+
"MaterialOperator",
|
|
51
|
+
"PlaceholderName",
|
|
52
|
+
"CertaintyName",
|
|
53
|
+
"ReferenceSentinel",
|
|
54
|
+
# core
|
|
55
|
+
"FormalFunction",
|
|
56
|
+
"SingleFunction",
|
|
57
|
+
"SpecificFunction",
|
|
58
|
+
"GenericFunction",
|
|
59
|
+
"FunctionalTransformation",
|
|
60
|
+
"FormalType",
|
|
61
|
+
"References",
|
|
62
|
+
"SingleReference",
|
|
63
|
+
"MaterialReferences",
|
|
64
|
+
"TransformationalReferences",
|
|
65
|
+
"ReferencingLabel",
|
|
66
|
+
"PlaceholderLabel",
|
|
67
|
+
"FormLabel",
|
|
68
|
+
"AnnotationLabel",
|
|
69
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CLI package for musicalform."""
|