Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 62ff3b3
Author: Greg Chapman <[email protected]>
Date:   Tue Jan 17 16:35:21 2023 -0800

    Update in preparation for 2.0 release.

commit a241a7b
Author: Greg Chapman <[email protected]>
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 096ae8f
Author: Greg Chapman <[email protected]>
Date:   Tue Jan 17 13:20:11 2023 -0800

    Don't be so noisy about unhandled extras.

commit a40c89b
Author: Greg Chapman <[email protected]>
Date:   Tue Jan 17 12:55:27 2023 -0800

    Use new converter21.register() API to register Humdrum and MEI converters.
  • Loading branch information
gregchapman-dev committed Jan 18, 2023
1 parent d857d5b commit 8071154
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions musicdiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pathlib import Path

import music21 as m21
import converter21

from musicdiff.m21utils import M21Utils
from musicdiff.m21utils import DetailLevel
Expand Down Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions musicdiff/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
import sys
import argparse

import music21 as m21
from converter21 import HumdrumConverter

from musicdiff import diff
from musicdiff import DetailLevel

Expand All @@ -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)')
Expand Down
2 changes: 1 addition & 1 deletion musicdiff/m21utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pypi_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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={
Expand Down

0 comments on commit 8071154

Please sign in to comment.