diff --git a/.travis.yml b/.travis.yml index 00fd745..77afc2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: python python: - - 2.7 - - 3.6 + - "3.6" + - "3.7" install: - - pip install --pre -e .[tests] + - pip install --pre -e . script: - pytest diff --git a/README.md b/README.md index 06f6f0d..bab1ab8 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ How demanding is the computation? [Check out this paper!](https://arxiv.org/abs/ - [`augmentation.AdditiveNoise`](#additivenoise) ## News +* 20 Feb 2020 + - Kapre ver 0.1.7 + - No vanilla Keras dependency + - Tensorflow >= 1.15 only + - Not tested on Python 2.7 anymore; only on Python 3.6 and 3.7. + * 20 Feb 2019 - Kapre ver 0.1.4 - Fixed amplitude-to-decibel error as raised in [#46](https://github.com/keunwoochoi/kapre/issues/46) @@ -40,23 +46,10 @@ How demanding is the computation? [Check out this paper!](https://arxiv.org/abs/ ## Installation ([↑up to contents](#contents)) -1. For keras >= 2.0 +Kapre is now working with tensorflow >= 1.15. + ```sh -pip install kapre -``` -Or, -```sh -git clone https://github.com/keunwoochoi/kapre.git -cd kapre -python setup.py install -``` - -2. For Keras 1.x (note: it is not updated anymore;) -```sh -git clone https://github.com/keunwoochoi/kapre.git -cd kapre -git checkout a2bde3e -python setup.py install +pip install git+https://github.com/keunwoochoi/kapre.git ``` ## Usage diff --git a/kapre/__init__.py b/kapre/__init__.py index f71648c..4ddaaeb 100644 --- a/kapre/__init__.py +++ b/kapre/__init__.py @@ -1,6 +1,4 @@ -from __future__ import absolute_import - -__version__ = '0.1.4' +__version__ = '0.1.7' VERSION = __version__ from . import time_frequency diff --git a/kapre/augmentation.py b/kapre/augmentation.py index f41510a..01ccb5a 100644 --- a/kapre/augmentation.py +++ b/kapre/augmentation.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import import numpy as np from tensorflow.keras import backend as K from tensorflow.keras.layers import Layer, InputSpec diff --git a/kapre/backend.py b/kapre/backend.py index f664123..422d721 100644 --- a/kapre/backend.py +++ b/kapre/backend.py @@ -16,8 +16,6 @@ from tensorflow.keras import backend as K import numpy as np import librosa -# Forward compatability to replace xrange -from builtins import range EPS = 1e-7 diff --git a/kapre/backend_keras.py b/kapre/backend_keras.py index 1b091d7..8a71974 100644 --- a/kapre/backend_keras.py +++ b/kapre/backend_keras.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import import numpy as np from tensorflow.keras import backend as K diff --git a/kapre/filterbank.py b/kapre/filterbank.py index 03fd271..ec088af 100644 --- a/kapre/filterbank.py +++ b/kapre/filterbank.py @@ -1,13 +1,8 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import from tensorflow.keras.layers import Layer from tensorflow.keras import backend as K from kapre import backend -# Todo: Filterbank(); init with mel, log, linear, etc. -# not parameterised, just a matrix multiplication - class Filterbank(Layer): """ ### `Filterbank` diff --git a/kapre/time_frequency.py b/kapre/time_frequency.py index 269003b..fde9616 100644 --- a/kapre/time_frequency.py +++ b/kapre/time_frequency.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import import numpy as np from tensorflow.keras import backend as K from tensorflow.keras.layers import Layer diff --git a/kapre/utils.py b/kapre/utils.py index e53c3ba..00adc51 100644 --- a/kapre/utils.py +++ b/kapre/utils.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import import numpy as np from tensorflow.keras import backend as K from tensorflow.keras.layers import Layer diff --git a/setup.py b/setup.py index 903a899..5328c95 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,19 @@ from setuptools import setup setup(name='kapre', - version='0.1.6', + version='0.1.7', description='Kapre: Keras Audio Preprocessors. Keras layers for audio pre-processing in deep learning', author='Keunwoo Choi', url='http://github.com/keunwoochoi/kapre/', - # download_url='http://github.com/keunwoochoi/kapre/releases', # TODO - author_email='keunwoo.choi@qmul.ac.uk', + author_email='gnuchoi@gmail.com', license='MIT', packages=['kapre'], - package_data={'': ['tests/speech_test_file.npz', 'tests/test_audio_mel_g0.npy', 'tests/test_audio_stft_g0.npy']}, + package_data={'kapre': ['tests/speech_test_file.npz', 'tests/test_audio_mel_g0.npy', 'tests/test_audio_stft_g0.npy']}, include_package_data=True, install_requires=[ 'numpy >= 1.8.0', 'librosa >= 0.5', 'tensorflow >= 1.15', - 'future' ], - extras_require={ - 'tests': ['tensorflow'], - }, keywords='audio music deep learning keras', zip_safe=False) diff --git a/tests/test_utils.py b/tests/test_utils.py index f17b1c8..0aeabac 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,7 +4,6 @@ import tensorflow.keras.backend as K from tensorflow.keras.backend import image_data_format import kapre -import pdb import librosa from kapre.utils import AmplitudeToDB, Normalization2D diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..836ceb9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,40 @@ +[tox] +envlist = py37,python3.6,black +skipsdist = False +usedevelop = True +indexserver = + spotify = https://artifactory.spotify.net/artifactory/api/pypi/pypi/simple + +[testenv] +whitelist_externals = python + +[testenv:py37] +basepython = python3.7 +deps = + pytest +commands = + py.test {posargs} + +[testenv:py36] +basepython = python3.6 +deps = + pytest +commands = + py.test {posargs} + +[testenv:black] +; "black" is a code formatter, much like gofmt. It requires 3.6 or higher. +; Tingle has 3.6 available to it; but feel free to uncomment the line +; `ignore_outcome` if it fails. Docs: https://github.com/ambv/black +;ignore_outcome = true +basepython = python3.7 +deps = black +skip_install = true +commands = + ; remove the '--diff' and '--check' flags to automatically write out corrections + black --line-length 100 --diff --check --skip-string-normalization --target-version=py37 {toxinidir}/kapre + black --line-length 100 --diff --check --skip-string-normalization --target-version=py37 {toxinidir}/tests + +; The sections defined below are for configuring specific tools that are used +; in the above testenvs. Usually, if the tool is ran directly/outside of tox, +; i.e. `(env) $ pytest`, it will still pick up this configuration.