Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move tomato to src #122

Merged
merged 9 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

# Allow files and directories
!demos
!MANIFEST.in
!tests
!tomato
!setup.py
!requirements.txt
!MANIFEST.in
!sample-data
!setup.py
!src

# ignore unnecessary files inside the folders
**/*~
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ venv/
ENV/
env.bak/
venv.bak/
venv-dev/

# mkdocs documentation
/site
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Introduced code linting (Pull request [#117](https://github.com/sertansenturk/tomato/pull/117))
- 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))
- Moved package to `src/tomato/` and data to `sample-data/` (Pull request [#122](https://github.com/sertansenturk/tomato/pull/122))
- Added Github issue templates (Pull request [#101](https://github.com/sertansenturk/tomato/pull/101))

## tomato v0.13.0
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ RUN python3 -m pip install --upgrade pip && \

# Install tomato
COPY MANIFEST.in setup.py /code/
COPY tomato /code/tomato
COPY src /code/src
RUN cd /code && \
python3 -m pip install . && \
python3 -m pip install . -v && \
cd / && \
rm -rf code

Expand Down
14 changes: 7 additions & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
recursive-include tomato *.json
recursive-include tomato/bin *
recursive-include tomato/config *.cfg
recursive-include tomato/models *
recursive-include tomato/music_data *
recursive-include src/tomato *.json
recursive-include src/tomato/bin *
recursive-include src/tomato/config *.cfg
recursive-include src/tomato/models *
recursive-include src/tomato/music_data *

# temporary to be removed later
recursive-include tomato/symbolic/symbtr/converter/symbtr2musicxml/makams_usuls *
recursive-include tomato/symbolic/symbtr/converter/musicxml2lilypond/data *
recursive-include src/tomato/symbolic/symbtr/converter/symbtr2musicxml/makams_usuls *
recursive-include src/tomato/symbolic/symbtr/converter/musicxml2lilypond/data *
82 changes: 65 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
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 \
help default dev all-editable \
clean clean-all clean-bin clean-build clean-pyc clean-test \
clean-$(VENV_NAME) clean-$(DEV_VENV_NAME) purge \
install install-all install-all-editable \
install-requirements install-dev-requirements \
install-mcr install-tomato \
docker-build test test-docker lint flake8 pylint isort

BIN_DOWN_DIR = src/tomato/bin

VENV_INTERP = python3.6
VENV_NAME ?= venv
DEV_VENV_NAME ?= venv-dev

PIP_INST_EXTRA =
PIP_INST_DEV = development
Expand All @@ -17,6 +23,9 @@ PIP_FLAG =
PIP_INST_FLAG =
PIP_INST_EDIT = -e

REQUIREMENTS_FILE = requirements.txt
DEV_REQUIREMENTS_FILE = requirements.dev.txt

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/
Expand All @@ -25,6 +34,7 @@ MCR_PATH = $(MCR_INST_PATH)v85
DOCKER_TAG = sertansenturk/tomato
DOCKER_VER = latest
DOCKER_FILE = Dockerfile
DOCKER_FLAG =

HELP_PADDING = 28
bold := $(shell tput bold)
Expand All @@ -35,22 +45,31 @@ 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 "$(pretty_command): run \"clean-all\", \"$(VENV_NAME)\", and \"install\"\n" default
@printf "$(pretty_command): run \"clean-all\", \"$(DEV_VENV_NAME)\", and \"install-dev-requirements\"\n" dev
@printf "$(pretty_command): run \"clean-all\", \"$(VENV_NAME)\", and \"install-all-editable\"\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 "$(pretty_command): \"clean\" (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 "$(pretty_command): remove python virtualenv\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 "$(pretty_command): remove python development virtualenv\n" clean-$(DEV_VENV_NAME)
@printf "$(padded_str)DEV_VENV_NAME, development virtualenv name (default: $(DEV_VENV_NAME))\n"
@printf "$(pretty_command): \"clean-all\" plus development virtualenv\n" purge
@printf "\n"
@printf "======= Setup =======\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 "$(pretty_command): create a development virtualenv\n" $(DEV_VENV_NAME)
@printf "$(padded_str)DEV_VENV_NAME, development virtualenv name (default: $(DEV_VENV_NAME))\n"
@printf "$(padded_str)VENV_INTERP, python interpreter (default: $(VENV_INTERP))\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"
Expand All @@ -65,22 +84,25 @@ help:
@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 LilyPond\n" install-lilypond
@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 libraries in $(REQUIREMENTS_FILE) to the virtualenv\n" install-requirements
@printf "$(padded_str)VENV_NAME, virtualenv name to install (default: $(VENV_NAME))\n"
@printf "$(pretty_command): install development libraries in $(DEV_REQUIREMENTS_FILE) to the virtualenv\n" install-dev-requirements
@printf "$(padded_str)DEV_VENV_NAME, development virtualenv name to install (default: $(DEV_VENV_NAME))\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 "$(padded_str)DOCKER_FLAG, additional docker build flags (default: $(DOCKER_FLAG))\n"
@printf "\n"
@printf "======= Test and linting =======\n"
@printf "$(pretty_command): run all test and linting automations using tox\n" test
Expand All @@ -91,11 +113,16 @@ help:
@printf "$(pretty_command): sorts python imports\n" isort

default: clean-all $(VENV_NAME) install

dev: VENV_NAME:=$(DEV_VENV_NAME)
dev: clean-$(DEV_VENV_NAME) $(DEV_VENV_NAME) install-dev-requirements

all-editable: clean-all $(VENV_NAME) install-all-editable

purge: clean-all
purge: clean-all clean-$(DEV_VENV_NAME)

clean-all: clean-pyc clean-build clean-test clean-$(VENV_NAME) clean-bin
clean-all: clean-pyc clean-build clean-test \
clean-bin clean-$(VENV_NAME)

clean: clean-pyc clean-build clean-test

Expand All @@ -106,7 +133,10 @@ clean-pyc:
find . -name '__pycache__' -exec rm -fr {} +

clean-bin:
rm -rf tomato/bin/phraseSeg tomato/bin/extractTonicTempoTuning tomato/bin/alignAudioScore tomato/bin/MusikiToMusicXml
rm -rf $(BIN_DOWN_DIR)/phraseSeg \
$(BIN_DOWN_DIR)/extractTonicTempoTuning \
$(BIN_DOWN_DIR)/alignAudioScore \
$(BIN_DOWN_DIR)/MusikiToMusicXml

clean-build: ## remove build artifacts
rm -rf build/
Expand All @@ -125,17 +155,31 @@ clean-test:
clean-$(VENV_NAME):
rm -rf $(VENV_NAME)

clean-$(DEV_VENV_NAME):
rm -rf $(DEV_VENV_NAME)

$(VENV_NAME):
python3 -m virtualenv -p $(VENV_INTERP) $(VENV_NAME)

install: install-tomato install-mcr
$(DEV_VENV_NAME):
python3 -m virtualenv -p $(VENV_INTERP) $(DEV_VENV_NAME)

install: install-lilypond install-mcr install-tomato

install-all: PIP_INST_EXTRA:=$(PIP_INST_ALL)
install-all: install-tomato install-mcr
install-all: install

install-all-editable: PIP_INST_FLAG:=$(PIP_INST_EDIT)
install-all-editable: install-all

install-requirements: $(VENV_NAME)
source $(VENV_NAME)/bin/activate ; \
pip install -r $(REQUIREMENTS_FILE)

install-dev-requirements: $(DEV_VENV_NAME)
source $(DEV_VENV_NAME)/bin/activate ; \
pip install -r $(DEV_REQUIREMENTS_FILE)

install-tomato: $(VENV_NAME)
source $(VENV_NAME)/bin/activate ; \
pip install --upgrade pip ; \
Expand All @@ -162,10 +206,14 @@ install-mcr:
echo "MCR is already installed to $(MCR_PATH). Skipping..."; \
fi

install-lilypond:
sudo apt -qq install -y lilypond

docker-build:
docker build . \
-f $(DOCKER_FILE) \
-t $(DOCKER_TAG):$(DOCKER_VER)
-t $(DOCKER_TAG):$(DOCKER_VER) \
$(DOCKER_FLAG)

test:
tox
Expand Down
Loading