diff --git a/.travis.yml b/.travis.yml index bf708ac..9e9308b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python jobs: include: - - name: "docker smoke tests" + - name: "docker" if: branch IN (master, dev) services: docker python: 3.6 @@ -10,7 +10,7 @@ jobs: install: - pip install -U pip - pip install tox-travis - script: tox -e docker-run-tests + script: tox -e docker after_success: - - name: "Python 3.5" diff --git a/Changelog.md b/Changelog.md index 7e2d204..5f27bcf 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,10 +4,11 @@ - Added docker support (Pull request [#107](https://github.com/sertansenturk/tomato/pull/107)) - Improved `tomato` setup (Pull request [#118](https://github.com/sertansenturk/tomato/pull/118)) -- Dropped Python 2 support; users are encouraged to switch to `tomato` docker (Pull request [#110](https://github.com/sertansenturk/tomato/pull/110)) -- Dropped Mac OSX support; users are encouraged to switch to `tomato` docker (Pull request [#108](https://github.com/sertansenturk/tomato/pull/108)) +- Dropped Python 2 support; users must to switch to Python 3.5 to 3.7 (Pull request [#110](https://github.com/sertansenturk/tomato/pull/110)) +- Stopped active Mac OSX support; users are encouraged to switch to `tomato` docker (Pull request [#108](https://github.com/sertansenturk/tomato/pull/108)) - Introduced code linting (Pull request [#117](https://github.com/sertansenturk/tomato/pull/117)) -- Added dockerized smoke tests for completeanalyzer and scoreconverter classes (Pull request [#120](https://github.com/sertansenturk/tomato/pull/120)) +- Introduced `Makefile` (Pull request [#121](https://github.com/sertansenturk/tomato/pull/121)) +- Introduced dockerized tests for completeanalyzer and scoreconverter classes (Pull request [#120](https://github.com/sertansenturk/tomato/pull/120)) - Added Github issue templates (Pull request [#101](https://github.com/sertansenturk/tomato/pull/101)) ## tomato v0.13.0 diff --git a/Makefile b/Makefile index 11bea95..58672ed 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,186 @@ -clean-dir: - rm -rf env dist build tomato.egg-info tomato/bin/phraseSeg tomato/bin/extractTonicTempoTuning tomato/bin/alignAudioScore tomato/bin/MusikiToMusicXml +SHELL := /bin/bash +.DEFAULT_GOAL := default +.PHONY: \ + help default all-editable + clean clean-all clean-bin clean-build clean-pyc clean-test clean-$(VENV_NAME) purge \ + install install-all install-all-editable install-mcr install-tomato \ + docker-build test test-docker lint flake8 pylint isort -create-virtualenv: - virtualenv -p python3.6 env +VENV_INTERP = python3.6 +VENV_NAME ?= venv -pip-install-development: - pip install --upgrade pip - python -m pip install -e .[development] -v +PIP_INST_EXTRA = +PIP_INST_DEV = development +PIP_INST_DEMO = demo +PIP_INST_ALL = $(PIP_INST_DEV),$(PIP_INST_DEMO) +PIP_FLAG = +PIP_INST_FLAG = +PIP_INST_EDIT = -e -build-docker-image: - docker build . -t sertansenturk/tomato:latest +MCR_DOWN_URL = http://www.mathworks.com/supportfiles/downloads/R2015a/deployment_files/R2015a/installers/glnxa64/MCR_R2015a_glnxa64_installer.zip +MCR_DOWNLOAD_PATH = /tmp/mcr-install +MCR_INST_PATH = /usr/local/MATLAB/MATLAB_Runtime/ +MCR_PATH = $(MCR_INST_PATH)v85 -docker-test-import: - make build-docker-image && \ - docker run sertansenturk/tomato python3 -c \ - "import tomato.symbolic.symbtrconverter; import tomato.joint.completeanalyzer" +DOCKER_TAG = sertansenturk/tomato +DOCKER_VER = latest +DOCKER_FILE = Dockerfile -docker-run-tests: - make build-docker-image && \ - docker build . -f docker/tests/Dockerfile.smoke -t sertansenturk/tomato-smoke:latest && \ - docker run sertansenturk/tomato-smoke python3 -m pytest tests +HELP_PADDING = 28 +bold := $(shell tput bold) +sgr0 := $(shell tput sgr0) +padded_str := %-$(HELP_PADDING)s +pretty_command := $(bold)$(padded_str)$(sgr0) + +help: + @printf "======= General ======\n" + @printf "$(pretty_command): run \"default\" (see below)\n" + @printf "$(pretty_command): run \"clean-all\", \"$(VENV_NAME)\", and \"install\" sequentially\n" default + @printf "$(pretty_command): run \"clean-all\", \"$(VENV_NAME)\", and \"install-all-editable\" sequentially\n" all-editable + @printf "\n" + @printf "======= Cleanup ======\n" + @printf "$(pretty_command): remove all build, test, coverage and python artifacts\n" clean + @printf "$(pretty_command): remove all (see: above) plus virtualenv, and tomato binaries\n" clean-all + @printf "$(padded_str)VENV_NAME, virtualenv name (default: $(VENV_NAME))\n" + @printf "$(pretty_command): remove tomato binaries\n" clean-bin + @printf "$(pretty_command): remove build artifacts\n" clean-build + @printf "$(pretty_command): remove python file artifacts\n" clean-pyc + @printf "$(pretty_command): remove test artifacts\n" clean-test + @printf "$(pretty_command): remove python virtualenv folder\n" clean-$(VENV_NAME) + @printf "$(padded_str)VENV_NAME, virtualenv name (default: $(VENV_NAME))\n" + @printf "$(pretty_command): alias of \"clean-all\"\n" purge + @printf "\n" + @printf "======= Setup =======\n" + @printf "$(pretty_command): install tomato in a virtualenv, and install MCR\n" install + @printf "$(padded_str)VENV_NAME, virtualenv name to install (default: $(VENV_NAME))\n" + @printf "$(padded_str)MCR_INST_PATH, path to install MCR (default: $(MCR_INST_PATH))\n" + @printf "$(padded_str)PIP_FLAG, pip flags (default: $(PIP_FLAG))\n" + @printf "$(padded_str)PIP_INST_FLAG, pip install flags (default: $(PIP_INST_FLAG))\n" + @printf "$(pretty_command): install tomato in a virtualenv with all extra dependencies, and install MCR\n" install-all + @printf "$(padded_str)VENV_NAME, virtualenv name to install (default: $(VENV_NAME))\n" + @printf "$(padded_str)MCR_INST_PATH, path to install MCR (default: $(MCR_INST_PATH))\n" + @printf "$(padded_str)PIP_FLAG, pip flags (default: $(PIP_FLAG))\n" + @printf "$(padded_str)PIP_INST_FLAG, pip install flags (default: $(PIP_INST_FLAG))\n" + @printf "$(pretty_command): install tomato in editable mode and in a virtualenv with all extra dependencies, and install MCR\n" install-all-editable + @printf "$(padded_str)VENV_NAME, virtualenv name to install (default: $(VENV_NAME))\n" + @printf "$(padded_str)MCR_INST_PATH, path to install MCR (default: $(MCR_INST_PATH))\n" + @printf "$(padded_str)PIP_FLAG, pip flags (default: $(PIP_FLAG))\n" + @printf "$(pretty_command): install MATLAB Runtime Compiler (MCR)\n" install-mcr + @printf "$(padded_str)MCR_DOWNLOAD_PATH, temporary folder to download MCR into (default: $(MCR_DOWNLOAD_PATH))\n" + @printf "$(padded_str)MCR_INST_PATH, path to install MCR (default: $(MCR_INST_PATH))\n" + @printf "$(pretty_command): install tomato in a virtualenv\n" install-tomato + @printf "$(padded_str)VENV_NAME, virtualenv name to install (default: $(VENV_NAME))\n" + @printf "$(padded_str)PIP_FLAG, pip flags (default: $(PIP_FLAG))\n" + @printf "$(padded_str)PIP_INST_FLAG, pip install flags (default: $(PIP_INST_FLAG))\n" + @printf "$(padded_str)PIP_INST_EXTRA, install from extras_require (default: $(PIP_INST_EXTRA), possible values: $(PIP_INST_ALL))\n" + @printf "$(pretty_command): create a virtualenv\n" $(VENV_NAME) + @printf "$(padded_str)VENV_NAME, virtualenv name (default: $(VENV_NAME))\n" + @printf "$(padded_str)VENV_INTERP, python interpreter (default: $(VENV_INTERP))\n" + @printf "\n" + @printf "======= Docker =======\n" + @printf "$(pretty_command): build docker image\n" docker-build + @printf "$(padded_str)DOCKER_TAG, docker image tag (default: $(DOCKER_TAG))\n" + @printf "$(padded_str)DOCKER_VER, docker image version (default: $(DOCKER_VER))\n" + @printf "\n" + @printf "======= Test and linting =======\n" + @printf "$(pretty_command): run all test and linting automations using tox\n" test + @printf "$(pretty_command): run docker build and test automation using tox\n" test-docker + @printf "$(pretty_command): run all style checking and linting automation using tox \n" lint + @printf "$(pretty_command): run flake8 for style guide (PEP8) checking using tox\n" flake8 + @printf "$(pretty_command): run pylint using tox\n" pylint + @printf "$(pretty_command): sorts python imports\n" isort + +default: clean-all $(VENV_NAME) install +all-editable: clean-all $(VENV_NAME) install-all-editable + +purge: clean-all + +clean-all: clean-pyc clean-build clean-test clean-$(VENV_NAME) clean-bin + +clean: clean-pyc clean-build clean-test + +clean-pyc: + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + find . -name '__pycache__' -exec rm -fr {} + + +clean-bin: + rm -rf tomato/bin/phraseSeg tomato/bin/extractTonicTempoTuning tomato/bin/alignAudioScore tomato/bin/MusikiToMusicXml + +clean-build: ## remove build artifacts + rm -rf build/ + rm -rf dist/ + rm -rf .eggs/ + rm -rf .pytest_cache + find . -name '.eggs' -type d -exec rm -rf {} + + find . -name '*.egg-info' -exec rm -rf {} + + find . -name '*.egg' -exec rm -f {} + + +clean-test: + rm -fr .tox/ + rm -f .coverage + rm -fr htmlcov/ + +clean-$(VENV_NAME): + rm -rf $(VENV_NAME) + +$(VENV_NAME): + python3 -m virtualenv -p $(VENV_INTERP) $(VENV_NAME) + +install: install-tomato install-mcr + +install-all: PIP_INST_EXTRA:=$(PIP_INST_ALL) +install-all: install-tomato install-mcr + +install-all-editable: PIP_INST_FLAG:=$(PIP_INST_EDIT) +install-all-editable: install-all + +install-tomato: $(VENV_NAME) + source $(VENV_NAME)/bin/activate ; \ + pip install --upgrade pip ; \ + if [ "$(PIP_INST_EXTRA)" = "" ]; then \ + python -m pip $(PIP_FLAG) install $(PIP_INST_FLAG) .; \ + else \ + python -m pip $(PIP_FLAG) install $(PIP_INST_FLAG) .[$(PIP_INST_EXTRA)]; \ + fi + +install-mcr: + if [ -z "$$(ls -A $(MCR_PATH))" ]; then \ + echo "Installing MCR to $(MCR_PATH)..."; \ + mkdir $(MCR_DOWNLOAD_PATH) ; \ + cd $(MCR_DOWNLOAD_PATH) ; \ + wget --progress=bar:force $(MCR_DOWN_URL) ; \ + unzip -q MCR_R2015a_glnxa64_installer.zip ; \ + $(MCR_DOWNLOAD_PATH)/install \ + -destinationFolder $(MCR_INST_PATH) \ + -agreeToLicense yes \ + -mode silent ; \ + cd / ; \ + rm -rf $(MCR_DOWNLOAD_PATH) ; \ + else \ + echo "MCR is already installed to $(MCR_PATH). Skipping..."; \ + fi + +docker-build: + docker build . \ + -f $(DOCKER_FILE) \ + -t $(DOCKER_TAG):$(DOCKER_VER) + +test: + tox + +test-docker: + tox -e docker + +lint: + tox -e lint + +flake8: + tox -e flake8 + +pylint: + tox -e pylint + +isort: + isort --skip-glob=.tox --recursive . diff --git a/README.md b/README.md index e598f62..bbb5a18 100644 --- a/README.md +++ b/README.md @@ -92,13 +92,13 @@ sudo apt-get install python3 python3.5-dev python3-pip libxml2-dev libxslt1-dev It is recommended to install `tomato` and its dependencies into a virtualenv. In the terminal, do the following: ```bash -virtualenv -p python3 env +virtualenv -p python3 venv ``` Activate the virtual environment: ```bash -source env/bin/activate +source venv/bin/activate ``` Then, change the current directory to the repository folder and install by: @@ -117,7 +117,7 @@ python -m pip install -e . If you want to run the demo Jupyter notebooks and/or make development, you may include the extras to the installation by: ```bash -python -m pip install -e .[demos,development] +python -m pip install -e .[demo,development] ``` The requirements are installed during the setup. If that step does not work for some reason, you can install the requirements by calling: diff --git a/docker/tests/Dockerfile.smoke b/docker/tests/Dockerfile similarity index 100% rename from docker/tests/Dockerfile.smoke rename to docker/tests/Dockerfile diff --git a/setup.py b/setup.py index 2f2ecf9..09397ce 100644 --- a/setup.py +++ b/setup.py @@ -6,12 +6,13 @@ from urllib.request import urlopen from setuptools import find_packages, setup + from tomato import __version__ # Get the long description from the README file here = os.path.abspath(os.path.dirname(__file__)) try: - with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + with open(os.path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() except FileNotFoundError: # not necessary, e.g. in Docker long_description = "" @@ -25,15 +26,20 @@ def setup(cls): Raises: OSError: if the OS is not supported. """ - bin_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'tomato', 'bin') + bin_folder = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "tomato", "bin" + ) # find os sys_os = cls._get_os() # read configuration file - config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'tomato', 'config', 'bin.cfg') + config_file = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "tomato", + "config", + "bin.cfg", + ) config = configparser.ConfigParser() config.optionxform = str @@ -46,13 +52,14 @@ def setup(cls): @staticmethod def _get_os(): - process_out = subprocess.check_output(['uname']).lower().decode( - "utf-8") - - if any(ss in process_out for ss in ['darwin', 'macosx']): - sys_os = 'macosx' - elif 'linux' in process_out: - sys_os = 'linux' + process_out = ( + subprocess.check_output(["uname"]).lower().decode("utf-8") + ) + + if any(ss in process_out for ss in ["darwin", "macosx"]): + sys_os = "macosx" + elif "linux" in process_out: + sys_os = "linux" else: raise OSError("Unsupported OS.") @@ -61,15 +68,15 @@ def _get_os(): @staticmethod def _download_binary(fpath, bin_url, sys_os): response = urlopen(bin_url) - if fpath.endswith('.zip'): # binary in zip + if fpath.endswith(".zip"): # binary in zip with zipfile.ZipFile(BytesIO(response.read())) as z: z.extractall(os.path.dirname(fpath)) - if sys_os == 'macosx': # mac executables are in .app - fpath = os.path.splitext(fpath)[0] + '.app' + if sys_os == "macosx": # mac executables are in .app + fpath = os.path.splitext(fpath)[0] + ".app" else: # remove the zip extension fpath = os.path.splitext(fpath)[0] else: # binary itself - with open(fpath, 'wb') as fp: + with open(fpath, "wb") as fp: fp.write(response.read()) # make the binary executable @@ -82,60 +89,70 @@ def _download_binary(fpath, bin_url, sys_os): BinarySetup.setup() -setup(name='tomato', - version=__version__, - author='Sertan Senturk', - author_email='contact AT sertansenturk DOT com', - maintainer='Sertan Senturk', - maintainer_email='contact AT sertansenturk DOT com', - url='https://github.com/sertansenturk/tomato', - description='Turkish-Ottoman Makam (M)usic Analysis TOolbox', - long_description=long_description, - long_description_content_type='text/markdown', - download_url=( - 'https://github.com/sertansenturk/tomato.git' - if 'dev' in __version__ else - 'https://github.com/sertansenturk/tomato/releases/tag/' - 'v{0:s}'.format(__version__)), - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Information Technology', - 'License :: OSI Approved :: GNU Affero General Public License v3 or ' - 'later (AGPLv3+)', - 'Natural Language :: English', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Topic :: Multimedia :: Sound/Audio :: Analysis', - 'Topic :: Scientific/Engineering :: Information Analysis', - ], - platforms='Linux', - license='agpl 3.0', - keywords=( - "music-scores analysis tomato audio-recordings lilypond tonic " - "makam-music score music-information-retrieval " - "computational-analysis"), - packages=find_packages(exclude=['docs', 'tests']), - include_package_data=True, - python_requires='>=3.5,<3.8', - install_requires=[ - "numpy>=1.9.0", # numerical operations - "scipy>=0.17.0", # temporary mat file saving for MCR binary inputs - "pandas>=0.18.0,<=0.24.2", # tabular data processing - "matplotlib>=1.5.1,<=3.0.3", # plotting - "json_tricks>=3.12.1", # saving json files with classes and numpy - "eyeD3>=0.7.5,<=0.8.11", # reading metadata embedded in recordings - "python-Levenshtein>=0.12.0", # semiotic structure labeling - "networkx>=1.11", # semiotic structure labeling clique computation - "lxml>=3.6.0", # musicxml conversion - "musicbrainzngs>=0.6", # metadata crawling from musicbrainz - "essentia>=2.1b5;platform_system=='Linux'" # audio signal processing - ], - extras_require={ - "development": ["tox", "pylint", "pylint-fail-under", "flake8"], - "demos": ["jupyter"] - }) +setup( + name="tomato", + version=__version__, + author="Sertan Senturk", + author_email="contact AT sertansenturk DOT com", + maintainer="Sertan Senturk", + maintainer_email="contact AT sertansenturk DOT com", + url="https://github.com/sertansenturk/tomato", + description="Turkish-Ottoman Makam (M)usic Analysis TOolbox", + long_description=long_description, + long_description_content_type="text/markdown", + download_url=( + "https://github.com/sertansenturk/tomato.git" + if "dev" in __version__ + else "https://github.com/sertansenturk/tomato/releases/tag/" + "v{0:s}".format(__version__) + ), + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Science/Research", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: GNU Affero General Public License v3 or " + "later (AGPLv3+)", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Topic :: Multimedia :: Sound/Audio :: Analysis", + "Topic :: Scientific/Engineering :: Information Analysis", + ], + platforms="Linux", + license="agpl 3.0", + keywords=( + "music-scores analysis tomato audio-recordings lilypond tonic " + "makam-music score music-information-retrieval " + "computational-analysis" + ), + packages=find_packages(exclude=["docs", "tests"]), + include_package_data=True, + python_requires=">=3.5,<3.8", + install_requires=[ + "numpy>=1.9.0", # numerical operations + "scipy>=0.17.0", # temporary mat file saving for MCR binary inputs + "pandas>=0.18.0,<=0.24.2", # tabular data processing + "matplotlib>=1.5.1,<=3.0.3", # plotting + "json_tricks>=3.12.1", # saving json files with classes and numpy + "eyeD3>=0.7.5,<=0.8.11", # reading metadata embedded in recordings + "python-Levenshtein>=0.12.0", # semiotic structure labeling + "networkx>=1.11", # semiotic structure labeling clique computation + "lxml>=3.6.0", # musicxml conversion + "musicbrainzngs>=0.6", # metadata crawling from musicbrainz + "essentia>=2.1b5;platform_system=='Linux'", # audio signal processing + ], + extras_require={ + "development": [ + "tox", + "pylint", + "pylint-fail-under", + "flake8", + "black", + ], + "demo": ["jupyter"], + }, +) diff --git a/tests/joint/test_completeanalyzer.py b/tests/joint/test_complete_analyzer.py similarity index 68% rename from tests/joint/test_completeanalyzer.py rename to tests/joint/test_complete_analyzer.py index 8f7ddba..2c0fef2 100644 --- a/tests/joint/test_completeanalyzer.py +++ b/tests/joint/test_complete_analyzer.py @@ -1,4 +1,5 @@ import os + import pytest @@ -7,21 +8,22 @@ def test_smoke_complete_analyzer(): from tomato.joint.completeanalyzer import CompleteAnalyzer # score input - symbtr_name = 'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede' + symbtr_name = "ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede" demo_folder = os.path.join("demos", symbtr_name) - txt_score_filename = os.path.join(demo_folder, symbtr_name + '.txt') - mu2_score_filename = os.path.join(demo_folder, symbtr_name + '.mu2') + txt_score_filename = os.path.join(demo_folder, symbtr_name + ".txt") + mu2_score_filename = os.path.join(demo_folder, symbtr_name + ".mu2") # audio input - audio_mbid = 'f970f1e0-0be9-4914-8302-709a0eac088e' - audio_filename = os.path.join(demo_folder, audio_mbid, audio_mbid + '.mp3') - completeAnalyzer = CompleteAnalyzer() + audio_mbid = "f970f1e0-0be9-4914-8302-709a0eac088e" + audio_filename = os.path.join(demo_folder, audio_mbid, audio_mbid + ".mp3") + complete_analyzer = CompleteAnalyzer() - complete_features = completeAnalyzer.analyze( + complete_features = complete_analyzer.analyze( symbtr_txt_filename=txt_score_filename, symbtr_mu2_filename=mu2_score_filename, symbtr_name=symbtr_name, audio_filename=audio_filename, - audio_metadata=audio_mbid) + audio_metadata=audio_mbid, + ) assert complete_features is not None diff --git a/tests/symbolic/test_symbtrconverter.py b/tests/symbolic/test_symbtr_converter.py similarity index 62% rename from tests/symbolic/test_symbtrconverter.py rename to tests/symbolic/test_symbtr_converter.py index 6b83700..03e40f4 100644 --- a/tests/symbolic/test_symbtrconverter.py +++ b/tests/symbolic/test_symbtr_converter.py @@ -1,4 +1,5 @@ import os + import pytest @@ -7,23 +8,23 @@ def test_smoke_symbtr_converter(): from tomato.symbolic.symbtrconverter import SymbTrConverter # inputs - symbtr_name = 'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede' + symbtr_name = "ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede" score_folder = os.path.join("demos", symbtr_name) - txt_score_filename = os.path.join(score_folder, symbtr_name + '.txt') - mu2_score_filename = os.path.join(score_folder, symbtr_name + '.mu2') - work_mbid = 'e7924b0d-c8a0-4b4a-b253-8eec898eac1e' + txt_score_filename = os.path.join(score_folder, symbtr_name + ".txt") + mu2_score_filename = os.path.join(score_folder, symbtr_name + ".mu2") + work_mbid = "e7924b0d-c8a0-4b4a-b253-8eec898eac1e" # outputs - xml_filename = os.path.join(score_folder, symbtr_name + '.xml') - ly_filename = os.path.join(score_folder, symbtr_name + '.ly') + xml_filename = os.path.join(score_folder, symbtr_name + ".xml") + ly_filename = os.path.join(score_folder, symbtr_name + ".ly") svg_filename_template = os.path.join(score_folder, symbtr_name) # parameters render_metadata = True # Add the metadata stored in MusicXML to Lilypond - svg_paper_size = 'junior-legal' # The paper size of the svg output pages + svg_paper_size = "junior-legal" # The paper size of the svg output pages - symbTrConverter = SymbTrConverter() - xml_out, ly_out, svg_out, txt_ly_mapping = symbTrConverter.convert( + symbtr_converter = SymbTrConverter() + _, _, svg_out, _ = symbtr_converter.convert( txt_score_filename, mu2_score_filename, symbtr_name=symbtr_name, @@ -32,6 +33,7 @@ def test_smoke_symbtr_converter(): xml_out=xml_filename, ly_out=ly_filename, svg_out=svg_filename_template, - svg_paper_size=svg_paper_size) + svg_paper_size=svg_paper_size, + ) assert svg_out is not None diff --git a/tests/test_converter.py b/tests/test_converter.py index e2cd93a..c98a4aa 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -1,6 +1,6 @@ import numpy as np -import pytest +import pytest from tomato.converter import Converter diff --git a/tomato/__init__.py b/tomato/__init__.py index 2569e9c..103aa86 100644 --- a/tomato/__init__.py +++ b/tomato/__init__.py @@ -1 +1 @@ -__version__ = '0.14.0.dev5' +__version__ = '0.14.0.dev6' diff --git a/tomato/audio/makamtonic/inputparser.py b/tomato/audio/makamtonic/inputparser.py index bee0251..925c714 100644 --- a/tomato/audio/makamtonic/inputparser.py +++ b/tomato/audio/makamtonic/inputparser.py @@ -27,8 +27,8 @@ import numpy as np -from ..pitchdistribution import PitchDistribution from ...converter import Converter +from ..pitchdistribution import PitchDistribution logger = logging.Logger( # pylint: disable-msg=C0103 __name__, level=logging.INFO) diff --git a/tomato/audio/makamtonic/knnclassifier.py b/tomato/audio/makamtonic/knnclassifier.py index 9945632..588fea1 100644 --- a/tomato/audio/makamtonic/knnclassifier.py +++ b/tomato/audio/makamtonic/knnclassifier.py @@ -28,10 +28,10 @@ import numpy as np +from ...converter import Converter +from ..pitchdistribution import PitchDistribution from .inputparser import InputParser from .knn import KNN -from ..pitchdistribution import PitchDistribution -from ...converter import Converter class KNNClassifier(InputParser): diff --git a/tox.ini b/tox.ini index 272fffb..80606a0 100644 --- a/tox.ini +++ b/tox.ini @@ -62,13 +62,19 @@ commands = {[testenv:pylint]commands} [testenv:docker] +setenv = + DOCKER_TAG = sertansenturk/tomato + DOCKER_VER = latest + DOCKER_FILE = Dockerfile commands = - make docker -whitelist_externals = make -skip_install = true - -[testenv:docker-run-tests] -commands = - make docker-run-tests -whitelist_externals = make + docker build . \ + -t sertansenturk/tomato:latest + docker build . \ + -f docker/tests/Dockerfile \ + -t sertansenturk/tomato-test:latest + docker run \ + sertansenturk/tomato-test:latest \ + python3 -m pytest tests +deps = +whitelist_externals = docker skip_install = true