Skip to content

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection

simplified / created train environment and testenv in tox.ini and pyproject.toml. Moved all tests relating to data into their own test directory. Updated path to resources accordingly.

Benjie Genchel4975d8291d9b
diff --git a/pyproject.toml b/pyproject.toml
index 3762def..f6957ed 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,7 +22,6 @@ dependencies = [
"apache_beam",
"librosa>=0.8.0",
"mir_eval>=0.6",
- "mirdata",
"numpy>=1.18",
"onnxruntime; platform_system == 'Windows' and python_version < '3.11'",
"pretty_midi>=0.2.9",
@@ -32,8 +31,6 @@ dependencies = [
"tensorflow>=2.4.1,<2.15.1; platform_system != 'Darwin' and python_version >= '3.11'",
"tensorflow-macos>=2.4.1,<2.15.1; platform_system == 'Darwin' and python_version > '3.11'",
"tflite-runtime; platform_system == 'Linux' and python_version < '3.11'",
- "smart_open",
- "sox",
"typing_extensions",
]
@@ -56,6 +53,7 @@ basic-pitch = "basic_pitch.predict:main"
[project.optional-dependencies]
train = [
+ "basic_pitch[tf,test]",
"apache_beam",
"mirdata",
"smart_open",
@@ -77,7 +75,7 @@ coreml = ["coremltools"]
onnx = ["onnxruntime"]
docs = ["mkdocs>=1.0.4"]
dev = [
- "basic_pitch[test,tf,coreml,onnx,docs]",
+ "basic_pitch[train,test,tf,coreml,onnx,docs]",
"mypy",
"tox",
"mirdata"
diff --git a/tests/test_guitarset.py b/tests/data/test_guitarset.py
similarity index 97%
rename from tests/test_guitarset.py
rename to tests/data/test_guitarset.py
index 6fb0919..7701ca6 100644
--- a/tests/test_guitarset.py
+++ b/tests/data/test_guitarset.py
@@ -29,7 +29,7 @@ from basic_pitch.data.datasets.guitarset import (
)
from basic_pitch.data.pipeline import WriteBatchToTfRecord
-RESOURCES_PATH = pathlib.Path(__file__).parent / "resources"
+RESOURCES_PATH = pathlib.Path(__file__).parent.parent / "resources"
TRACK_ID = "00_BN1-129-Eb_comp"
diff --git a/tests/test_pipeline.py b/tests/data/test_pipeline.py
similarity index 100%
rename from tests/test_pipeline.py
rename to tests/data/test_pipeline.py
diff --git a/tests/test_tf_example_serialization.py b/tests/data/test_tf_example_serialization.py
similarity index 100%
rename from tests/test_tf_example_serialization.py
rename to tests/data/test_tf_example_serialization.py
diff --git a/tox.ini b/tox.ini
index 091df5f..41a7006 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,7 +11,7 @@ requires =
[testenv]
deps = -e .[test]
commands =
- pytest tests --ignore tests/test_nn.py {posargs}
+ pytest tests --ignore tests/test_nn.py --ignore tests/data {posargs}
setenv =
SOURCE = {toxinidir}/basic_pitch
TEST_SOURCE = {toxinidir}/tests
@@ -27,6 +27,15 @@ setenv =
TEST_SOURCE = {toxinidir}/tests
LINE_LENGTH = "120"
+[testenv:train]
+deps = -e .[train]
+commands =
+ pytest tests/data {posargs}
+setenv =
+ SOURCE = {toxinidir}/basic_pitch
+ TEST_SOURCE = {toxinidir}/tests/data
+ LINE_LENGTH = "120"
+
[testenv:manifest]
deps = check-manifest
skip_install = true