diff --git a/.github/workflows/ci-minimal.yml b/.github/workflows/ci-minimal.yml index e168090..8947a64 100644 --- a/.github/workflows/ci-minimal.yml +++ b/.github/workflows/ci-minimal.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python: ["3.7"] steps: - uses: actions/checkout@v4 @@ -24,10 +24,10 @@ jobs: python-version: ${{ matrix.python }} - name: Install rubberband-cli and ffmpeg - run: sudo apt-get update && sudo apt-get install -y rubberband-cli ffmpeg + run: sudo apt-get update && sudo apt-get install -y rubberband-cli - name: Install dependencies - run: pip install -e .[tests] + run: pip install --use-deprecated=legacy-resolver --no-deps -e .[tests] - name: Run test run: python -m pytest tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f81e9fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-20.04 + strategy: + matrix: + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + + - name: Install rubberband-cli and ffmpeg + run: sudo apt-get update && sudo apt-get install -y rubberband-cli + + - name: Install dependencies + run: pip install -e .[tests] + + - name: Run test + run: python -m pytest tests + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b945191..0000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -sudo: false - -addons: - apt: - packages: - - rubberband-cli - -cache: - directories: - - $HOME/env - -language: python - -notifications: - email: false - -python: - - "3.6" - -matrix: - include: - - python: 3.6 - dist: xenial - - python: 3.7 - dist: xenial - - -before_install: - - bash .travis_dependencies.sh - - export PATH="$HOME/env/miniconda$TRAVIS_PYTHON_VERSION/bin:$PATH"; - - hash -r - - source activate test-environment - -install: - # install your own package into the environment - - pip install -e .[tests] - -script: - - python --version - - pytest - -after_success: - - coveralls - - pip uninstall -y pyrubberband - -after_failure: - - pip uninstall -y pyrubberband diff --git a/.travis_dependencies.sh b/.travis_dependencies.sh deleted file mode 100644 index 3aaf6be..0000000 --- a/.travis_dependencies.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -ENV_NAME="test-environment" -set -e - -conda_create () -{ - - hash -r - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda config --add channels pypi - conda info -a - deps='pip numpy scipy pandas requests pytest coverage numpydoc matplotlib sphinx scikit-learn seaborn' - - conda create -q -n $ENV_NAME "python=$TRAVIS_PYTHON_VERSION" $deps -} - -src="$HOME/env/miniconda$TRAVIS_PYTHON_VERSION" -if [ ! -d "$src" ]; then - mkdir -p $HOME/env - pushd $HOME/env - - # Download miniconda packages - wget http://repo.continuum.io/miniconda/Miniconda-3.16.0-Linux-x86_64.sh -O miniconda.sh; - - # Install environment - bash miniconda.sh -b -p $src - - export PATH="$src/bin:$PATH" - conda_create - - source activate $ENV_NAME - - conda install -c conda-forge ffmpeg - - pip install soundfile - pip install python-coveralls - pip install pytest-cov - source deactivate - popd -else - echo "Using cached dependencies" -fi diff --git a/pyrubberband/pyrb.py b/pyrubberband/pyrb.py index 90436c1..91b5c4e 100644 --- a/pyrubberband/pyrb.py +++ b/pyrubberband/pyrb.py @@ -14,7 +14,6 @@ import os import subprocess import tempfile -import six import numpy as np import soundfile as sf @@ -22,11 +21,7 @@ __all__ = ['time_stretch', 'pitch_shift', 'timemap_stretch'] __RUBBERBAND_UTIL = 'rubberband' - -if six.PY2: - DEVNULL = open(os.devnull, 'w') -else: - DEVNULL = subprocess.DEVNULL +DEVNULL = subprocess.DEVNULL def __rubberband(y, sr, **kwargs): @@ -65,7 +60,7 @@ def __rubberband(y, sr, **kwargs): # Execute rubberband arguments = [__RUBBERBAND_UTIL, '-q'] - for key, value in six.iteritems(kwargs): + for key, value in kwargs.items(): arguments.append(str(key)) if len(str(value).strip()): arguments.append(str(value)) @@ -82,10 +77,9 @@ def __rubberband(y, sr, **kwargs): y_out = np.squeeze(y_out) except OSError as exc: - six.raise_from(RuntimeError('Failed to execute rubberband. ' - 'Please verify that rubberband-cli ' - 'is installed.'), - exc) + raise RuntimeError('Failed to execute rubberband. ' + 'Please verify that rubberband-cli ' + 'is installed.') from exc finally: # Remove temp files diff --git a/setup.cfg b/setup.cfg index be1c1f6..6ae334f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,7 +21,6 @@ classifiers = Intended Audience :: Developers Topic :: Multimedia :: Sound/Audio :: Analysis Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -33,10 +32,9 @@ classifiers = [options] packages = find: install_package_data = True -python_requires = >=3.6 +python_requires = >=3.7 install_requires = - numpy - six + numpy >= 1.0 soundfile >= 0.12.1 [options.extras_require] @@ -45,4 +43,3 @@ docs = tests = pytest pytest-cov - contextlib2 diff --git a/tests/test_pyrb.py b/tests/test_pyrb.py index 4f4e658..93c0ea4 100644 --- a/tests/test_pyrb.py +++ b/tests/test_pyrb.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from contextlib2 import nullcontext as dnr +from contextlib import nullcontext as dnr import pyrubberband