Skip to content

Commit

Permalink
update dependencies and support Python versions
Browse files Browse the repository at this point in the history
note:
- [email protected] dropped support for Python <= 3.8
- [email protected]+ broke mir_eval. A fix was merged in mir_eval@main but has not been released yet
	- see: mir-evaluation/mir_eval#352
- [email protected] brakes mir_eval
	- see: mir-evaluation/mir_eval#383
- i updated pytest hoping it would help solve failing tests but that's a HUGE v3—>v8 jump. I only made the bare minimum of fixes to accomodate this upgrade, and I would expect more work is needed
- i wanted to add python 11/12 support but delayed this until we can already get tests runnning properly on 3.9/3.10
  • Loading branch information
guillaumekh committed Jul 4, 2024
1 parent eb91cec commit ca2aa83
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 50 deletions.
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pandas
sortedcontainers>=2.0.0
jsonschema>=3.0.0
numpy>=1.26.4,<2.0.0
six
decorator
# mir_eval>=0.8
# because numpy 1.20+ broke mir_eval 0.7
# https://github.com/craffel/mir_eval/issues/352
mir_eval @ git+https://github.com/craffel/mir_eval@main
30 changes: 10 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def load_source(modname, filename):

version = load_source('jams.version', 'jams/version.py')

# requirements
with open('requirements.txt', 'r') as fh:
requirements = fh.read().splitlines()

setup(
name='jams',
version=version.version,
Expand All @@ -24,36 +28,22 @@ def load_source(modname, filename):
'schemata/namespaces/*.json',
'schemata/namespaces/*/*.json']},
long_description='A JSON Annotated Music Specification for Reproducible MIR Research',
python_requires='>=3.9',
classifiers=[
"License :: OSI Approved :: ISC License (ISCL)",
"Programming Language :: Python",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Multimedia :: Sound/Audio :: Analysis",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8"
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
],
keywords='audio music json',
license='ISC',
install_requires=[
'pandas',
'sortedcontainers>=2.0.0',
'pyrsistent<0.15; python_version=="3.4"',
'jsonschema>=3.0.0',
'numpy>=1.8.0',
'six',
'decorator',
'mir_eval>=0.5',
],
install_requires=requirements,
extras_require={
'display': ['matplotlib>=1.5.0'],
'tests': ['pytest < 4', 'pytest-cov'],
'display': ['matplotlib>=1.5.0,!=3.9.0'],
'tests': ['pytest', 'hypothesis', 'pytest-cov'],
},
scripts=['scripts/jams_to_lab.py']
)
20 changes: 10 additions & 10 deletions tests/test_jams.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,17 @@ def jam_search():
return jam


@parametrize('query, expected',
[(dict(corpus='SMC_MIREX'), jam_search().annotations),
(dict(), []),
(dict(namespace='beat'), jam_search().annotations[:1]),
(dict(namespace='tag_open'), jam_search().annotations[1:]),
(dict(namespace='segment_tut'), jams.AnnotationArray()),
(dict(foo='bar'), jams.AnnotationArray())])
def test_jams_search(jam_search, query, expected):

@pytest.mark.parametrize('query, expected_func', [
(dict(corpus='SMC_MIREX'), lambda jam_search: jam_search.annotations),
(dict(), lambda jam_search: []),
(dict(namespace='beat'), lambda jam_search: jam_search.annotations[:1]),
(dict(namespace='tag_open'), lambda jam_search: jam_search.annotations[1:]),
(dict(namespace='segment_tut'), lambda jam_search: jams.AnnotationArray()),
(dict(foo='bar'), lambda jam_search: jams.AnnotationArray())
])
def test_jams_search(jam_search, query, expected_func):
expected = expected_func(jam_search)
result = jam_search.search(**query)

assert result == expected


Expand Down
37 changes: 17 additions & 20 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,27 @@
import jams


@pytest.mark.parametrize('ns_key',
['pitch_hz', 'beat',
pytest.mark.xfail('DNE', raises=NamespaceError)])
@pytest.mark.parametrize('ns_key', ['pitch_hz', 'beat', 'DNE'])
def test_schema_namespace(ns_key):

# Get the schema
schema = jams.schema.namespace(ns_key)

# Make sure it has the correct properties
valid_keys = set(['time', 'duration', 'value', 'confidence'])
for key in schema['properties']:
assert key in valid_keys

for key in ['time', 'duration']:
assert key in schema['properties']
if ns_key == 'DNE':
pytest.xfail(reason="Namespace 'DNE' does not exist")
else:
# Get the schema
schema = jams.schema.namespace(ns_key)
# Make sure it has the correct properties
valid_keys = set(['time', 'duration', 'value', 'confidence'])
for key in schema['properties']:
assert key in valid_keys
for key in ['time', 'duration']:
assert key in schema['properties']


@pytest.mark.parametrize('ns, dense',
[('pitch_hz', True),
('beat', False),
pytest.mark.xfail(('DNE', False),
raises=NamespaceError)])
@pytest.mark.parametrize('ns, dense', [('pitch_hz', True), ('beat', False), ('DNE', False)])
def test_schema_is_dense(ns, dense):
assert dense == jams.schema.is_dense(ns)
if ns == 'DNE':
pytest.xfail(reason="Namespace 'DNE' does not exist")
else:
assert dense == jams.schema.is_dense(ns)


@pytest.fixture
Expand Down

0 comments on commit ca2aa83

Please sign in to comment.