From 2c54cd8c718ae11b8a341c97a8b6fa04363b483b Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 27 Jul 2021 16:01:42 +0200 Subject: [PATCH 1/5] incr si dependencies --- setup.py | 2 +- spiketoolkit/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4552ecd2..474715a7 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ package_data={}, install_requires=[ 'numpy', - 'spikeextractors>=0.9.4', + 'spikeextractors>=0.9.7', 'spikemetrics>=0.2.4', 'spikefeatures', 'scikit-learn', diff --git a/spiketoolkit/version.py b/spiketoolkit/version.py index c584cf2c..4a603d90 100644 --- a/spiketoolkit/version.py +++ b/spiketoolkit/version.py @@ -1 +1 @@ -version = '0.7.5' +version = '0.7.6' From c9da1bb093cbef7fb8247cdb922bc70dbac33d58 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 27 Jul 2021 16:07:17 +0200 Subject: [PATCH 2/5] Use Github workflows --- .github/workflows/python-package.yml | 39 ++++++++++++++++++++++ .github/workflows/python-publish.yml | 48 ++++++++++++++++++++++++++++ .travis.yml | 32 ------------------- 3 files changed, 87 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/python-publish.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..f999fc9a --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +name: Python Package using Conda + +on: [push] + +jobs: + build-and-test: + name: Test on (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + steps: + - uses: actions/checkout@v2 + - uses: s-weigand/setup-conda@v1 + with: + python-version: 3.8 + - name: Which python + run: | + conda --version + which python + - name: Install dependencies + run: | + pip install numpy>=1.20 + pip install pandas>=1.2 + pip install https://github.com/SpikeInterface/spikeextractors/archive/master.zip + pip install https://github.com/SpikeInterface/spikemetrics/archive/master.zip + pip install https://github.com/SpikeInterface/spikefeatures/archive/master.zip + pip install -e . + pip install pytest==4.3 + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest and build coverage report + run: | + pytest diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 00000000..b8864771 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,48 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Test and Upload Python Package + +on: + push: + tags: + - '*' + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + - name: Install dependencies + run: | + pip install numpy>=1.20 + pip install pandas>=1.2 + pip install -e . + pip install pytest==4.3 + - name: Lint with flake8 + run: | + conda install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest and build coverage report + run: | + pytest + - name: Publish on PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ee433763..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -jobs: - include: - - name: "Python 3.7.0 on Xenial Linux" - os: linux - language: python - python: - - '3.7' - deploy: - provider: pypi - user: alejoe91 - on: - tags: true - password: - secure: Ya7Z6AouMhTiBA7G8sUNncA92h+j+JTW4a8AwyDklFB/0poxrhUZwpfMj80yaLfEGspTFaUCvc5oBQB3bLbrHmYAFP3TQKm2X8tQSR5XZXew1uvtGBVMebW4DHSFeQLEVyHjY6q8tzA0jSbHetVlc+Vfv3xtAeD4w7Ff2x4HoWQJUKMkdVvROi/OIjLeTqiMc7LOGfDtT0AJUFp86u1auv8Mriw9L06dKI9E9SFd1t85sOv/RosTtQD/f8o0kHZbkkkpQOSLsh5xQZ472pGk/zfvAk1BEB7hr1eaWNeJqdk/NQL1ONr5nvs5O0SzURz/PH8lAMBdV1tr5NzBWXy7dTtHPW7WXvJlvZR/s39XZFRnSWXJlhvZRoGrY54tzpYjnH5+dkzdZYcTcCIgpmNPGGZ8cckq5E4pQTAduhIwfTJ5v8EMBMFqXpr9+T+ynk/MXkDX2x1VSGetTpR2IR+mAx49xi7gC+4YmbJk7Y0lATNpoCSAcf0pSrYHtPsrUhU/2sd4PGFxkrqTTluf1LJb/g+IFSF8EnaQFCoBcxmJUVDyM+LReAhTjaENFKB9r7H75YZE9h0xcC0N/dGEeZGE3DVmfkfJIDGtdDezXuWlrWZQT6ICvItasA8RZn1v+MtwuenQI8050emwvaNvStypkQEpcYuTkV59FzT828pK5cE= - - - name: "Python 3.7.0 on Windows" - os: windows - language: shell - before_install: - - choco install python --version 3.7.0 - - python -m pip install --upgrade pip - env: PATH=/c/Python37:/c/Python37/Scripts:$PATH - -install: -- pip install numpy>=1.20 -- pip install pandas>=1.2 -- pip install https://github.com/SpikeInterface/spikeextractors/archive/master.zip -- pip install https://github.com/SpikeInterface/spikemetrics/archive/master.zip -- pip install https://github.com/SpikeInterface/spikefeatures/archive/master.zip -- pip install . -- pip install pytest==4.3 -script: pytest From 3ede45d51489e6225bf37bc162080aa9d041c12b Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 27 Jul 2021 16:09:46 +0200 Subject: [PATCH 3/5] remove flake8 --- .github/workflows/python-package.yml | 8 +------- .github/workflows/python-publish.yml | 9 +-------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f999fc9a..829bf0f2 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -27,13 +27,7 @@ jobs: pip install https://github.com/SpikeInterface/spikemetrics/archive/master.zip pip install https://github.com/SpikeInterface/spikefeatures/archive/master.zip pip install -e . - pip install pytest==4.3 - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + pip install pytest - name: Test with pytest and build coverage report run: | pytest diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b8864771..c06dfabe 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -28,14 +28,7 @@ jobs: pip install numpy>=1.20 pip install pandas>=1.2 pip install -e . - pip install pytest==4.3 - - name: Lint with flake8 - run: | - conda install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + pip install pytest - name: Test with pytest and build coverage report run: | pytest From 7fd4df08ee285cacb5d105c0a14cc4da2e76e7fd Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 27 Jul 2021 16:19:47 +0200 Subject: [PATCH 4/5] don't force numpy as pandas --- .github/workflows/python-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 829bf0f2..d8cd54f3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -21,8 +21,6 @@ jobs: which python - name: Install dependencies run: | - pip install numpy>=1.20 - pip install pandas>=1.2 pip install https://github.com/SpikeInterface/spikeextractors/archive/master.zip pip install https://github.com/SpikeInterface/spikemetrics/archive/master.zip pip install https://github.com/SpikeInterface/spikefeatures/archive/master.zip From 14d383387e5ff48ff25c3a2c4a13e454a34380e6 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 27 Jul 2021 16:27:19 +0200 Subject: [PATCH 5/5] Remove numpy deprecation warnings --- spiketoolkit/preprocessing/mask.py | 2 +- spiketoolkit/preprocessing/transform.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spiketoolkit/preprocessing/mask.py b/spiketoolkit/preprocessing/mask.py index 266b7ed3..ff867804 100644 --- a/spiketoolkit/preprocessing/mask.py +++ b/spiketoolkit/preprocessing/mask.py @@ -13,7 +13,7 @@ def __init__(self, recording, bool_mask): self._mask = bool_mask assert len(bool_mask) == recording.get_num_frames(), "'bool_mask' should be a boolean array with length of " \ "number of frames" - assert np.array(bool_mask).dtype in (bool, np.bool), "'bool_mask' should be a boolean array" + assert np.array(bool_mask).dtype == bool, "'bool_mask' should be a boolean array" self.is_dumpable = False BasePreprocessorRecordingExtractor.__init__(self, recording) self._kwargs = {'recording': recording.make_serialized_dict(), 'bool_mask': bool_mask} diff --git a/spiketoolkit/preprocessing/transform.py b/spiketoolkit/preprocessing/transform.py index a0f7e249..4bc8ff35 100644 --- a/spiketoolkit/preprocessing/transform.py +++ b/spiketoolkit/preprocessing/transform.py @@ -28,7 +28,7 @@ def get_traces(self, channel_ids=None, start_frame=None, end_frame=None, return_ traces = self._recording.get_traces(channel_ids=channel_ids, start_frame=start_frame, end_frame=end_frame, return_scaled=return_scaled) - if isinstance(self._scalar, (int, float, np.integer, np.float)): + if isinstance(self._scalar, (int, float, np.integer)): traces = traces*self._scalar else: if len(self._scalar) == len(channel_ids): @@ -37,7 +37,7 @@ def get_traces(self, channel_ids=None, start_frame=None, end_frame=None, return_ channel_idxs = np.array([self._recording.get_channel_ids().index(ch) for ch in channel_ids]) scalar = np.array(self._scalar)[channel_idxs] traces = traces * scalar[:, np.newaxis] - if isinstance(self._offset, (int, float, np.integer, np.float)): + if isinstance(self._offset, (int, float, np.integer)): traces = traces + self._offset else: if len(self._offset) == len(channel_ids):