From 80711546b0db2a87823dfaf6896f6df9b4d13ff4 Mon Sep 17 00:00:00 2001 From: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:33:20 -0800 Subject: [PATCH] Squashed commit of the following: commit 62ff3b38bf8718fd1f7110f7e02ebbe709fab27f Author: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Tue Jan 17 16:35:21 2023 -0800 Update in preparation for 2.0 release. commit a241a7bed5c6c970d4348884ec6bbe3adc7154a7 Author: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Tue Jan 17 14:46:46 2023 -0800 Move converter21 registration from __main__.py to __init__.py so that callers of the diff() API will get that automatically as well. commit 096ae8f47663c2fa82fd1801577c3cecc6544813 Author: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Tue Jan 17 13:20:11 2023 -0800 Don't be so noisy about unhandled extras. commit a40c89be89700517f6865a90ec396b0147eb7323 Author: Greg Chapman <75333244+gregchapman-dev@users.noreply.github.com> Date: Tue Jan 17 12:55:27 2023 -0800 Use new converter21.register() API to register Humdrum and MEI converters. --- musicdiff/__init__.py | 5 +++++ musicdiff/__main__.py | 8 -------- musicdiff/m21utils.py | 2 +- pypi_README.md | 2 +- setup.py | 8 ++++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/musicdiff/__init__.py b/musicdiff/__init__.py index 4559b6b..09930a5 100644 --- a/musicdiff/__init__.py +++ b/musicdiff/__init__.py @@ -18,6 +18,7 @@ from pathlib import Path import music21 as m21 +import converter21 from musicdiff.m21utils import M21Utils from musicdiff.m21utils import DetailLevel @@ -81,6 +82,10 @@ def diff(score1: Union[str, Path, m21.stream.Score], Returns: int: The number of differences found (0 means the scores were identical, None means the diff failed) ''' + # Use the new Humdrum/MEI importers from converter21 in place of the ones in music21... + # Comment out this line to go back to music21's built-in Humdrum/MEI importers. + converter21.register() + badArg1: bool = False badArg2: bool = False diff --git a/musicdiff/__main__.py b/musicdiff/__main__.py index e6c42b7..f5ff0af 100644 --- a/musicdiff/__main__.py +++ b/musicdiff/__main__.py @@ -15,9 +15,6 @@ import sys import argparse -import music21 as m21 -from converter21 import HumdrumConverter - from musicdiff import diff from musicdiff import DetailLevel @@ -28,11 +25,6 @@ ''' if __name__ == "__main__": - # Use the new Humdrum importer from converter21 in place of the one in music21... - # Comment out these two lines to go back to music21's built-in Humdrum importer. - m21.converter.unregisterSubconverter(m21.converter.subConverters.ConverterHumdrum) - m21.converter.registerSubconverter(HumdrumConverter) - parser = argparse.ArgumentParser( prog='python3 -m musicdiff', description='Music score notation diff (MusicXML, MEI, Humdrum, etc)') diff --git a/musicdiff/m21utils.py b/musicdiff/m21utils.py index b13b8e5..4767820 100644 --- a/musicdiff/m21utils.py +++ b/musicdiff/m21utils.py @@ -771,7 +771,7 @@ def extra_to_string(extra: m21.base.Music21Object) -> str: if isinstance(extra, (m21.expressions.ArpeggioMark, m21.expressions.ArpeggioMarkSpanner)): return M21Utils.arpeggiomark_to_string(extra) - print(f'Unexpected extra: {extra.classes[0]}', file=sys.stderr) + # print(f'Unexpected extra: {extra.classes[0]}', file=sys.stderr) return '' @staticmethod diff --git a/pypi_README.md b/pypi_README.md index 19994ac..44cb321 100644 --- a/pypi_README.md +++ b/pypi_README.md @@ -45,7 +45,7 @@ Many thanks to [Francesco Foscarin](https://github.com/fosfrancesco) for allowin ## License The MIT License (MIT) -Copyright (c) 2022, Francesco Foscarin, Greg Chapman +Copyright (c) 2023, Francesco Foscarin, Greg Chapman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/setup.py b/setup.py index 6351ef7..e5dee01 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages import pathlib -musicdiffversion = '1.4.0' +musicdiffversion = '2.0.0' here = pathlib.Path(__file__).parent.resolve() @@ -56,12 +56,12 @@ packages=find_packages(), - python_requires='>=3.7', + python_requires='>=3.9', install_requires=[ - 'music21>=7.2', + 'music21>=8.2', 'numpy', - 'converter21>=1.2' + 'converter21>=2.0' ], project_urls={