Skip to content

Commit

Permalink
Fix/remove python 3.7 (#536)
Browse files Browse the repository at this point in the history
* add python 3.11 to CI workflow
* drop support for python 3.7
* update the libstd for the CI runner to fix bugs related to newer scipy versions
* fix dtype error appearing with quantities 0.14.0
  • Loading branch information
Moritz-Alexander-Kern committed Feb 6, 2023
1 parent e2d9f55 commit 0896873
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 20 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will setup GitHub-hosted runners and install the required dependencies for elephant tests.
# This workflow will set up GitHub-hosted runners and install the required dependencies for elephant tests.
# On a pull requests and on pushes to master it will run different tests for elephant.

name: tests
Expand Down Expand Up @@ -57,8 +57,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10"]
# python versions for elephant: [3.8, 3.9, "3.10", 3.11]
python-version: [3.8, 3.9, "3.10", 3.11]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
# do not cancel all in-progress jobs if any matrix job fails
Expand All @@ -82,7 +82,7 @@ jobs:
- name: Cache test_env
uses: actions/cache@v3
with:
path: ~/test_env
path: /home/runner/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements files
# cache will be reset on changes to any requirements or every month
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-tests.txt') }}
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.6, 3.7, 3.8, 3.9]
# python versions for elephant: [3.8, 3.9, 3.10, 3.11]
python-version: [3.8,]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [windows-latest]
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.6, 3.7, 3.8, 3.9]
# python versions for elephant: [3.8, 3.9, 3.10, 3.11]
python-version: [3.9]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
Expand Down Expand Up @@ -273,6 +273,7 @@ jobs:

- name: Setup environment
run: |
sudo apt-get update
sudo apt install -y libopenmpi-dev openmpi-bin
python -m pip install --upgrade pip
Expand Down Expand Up @@ -331,6 +332,7 @@ jobs:
run: |
conda config --add channels conda-forge # bugfix with scipy==1.8.1: libstdcxx-ng 12.1.0 required
conda update conda
conda install -c conda-forge libstdcxx-ng=12 # fix libstdc++.so.6: version for new scipy versions > 1.9.1
conda env update --file requirements/environment-tests.yml --name base
activate base
conda install -c conda-forge openmpi
Expand Down Expand Up @@ -387,6 +389,7 @@ jobs:

- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y libopenmpi-dev openmpi-bin
python -m pip install --upgrade pip
pip install -r requirements/requirements-docs.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp27-* cp33-* cp34-* cp35-* cp36-* pp*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
CIBW_SKIP: "cp27-* cp33-* cp34-* cp35-* cp36-* cp37-* pp*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_ARCHS: "auto64"

- uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Below is the explanation of how to proceed with these two steps.
Prerequisites
*************

Elephant requires `Python <http://python.org/>`_ 3.7, 3.8, 3.9 or 3.10.
Elephant requires `Python <http://python.org/>`_ 3.8, 3.9, 3.10 or 3.11.

.. tabs::

Expand All @@ -25,7 +25,7 @@ Elephant requires `Python <http://python.org/>`_ 3.7, 3.8, 3.9 or 3.10.

.. code-block:: sh
conda create --name elephant python=3.7 numpy scipy tqdm
conda create --name elephant python=3.8 numpy scipy tqdm
2. Activate your environment:

Expand Down
2 changes: 1 addition & 1 deletion elephant/cell_assembly_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def cell_assembly_detection(binned_spiketrain, max_lag, reference_lag=2,
times = np.where(pattern['times'] > 0)[0] * bin_size + t_start
pattern['times'] = times
pattern['lags'] = pattern['lags'] * bin_size
pattern['signature'] = np.array(pattern['signature'], dtype=np.int32)
pattern['signature'] = np.array(pattern['signature'], dtype=int)

# Give as output only the maximal groups
if verbose:
Expand Down
4 changes: 2 additions & 2 deletions elephant/test/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ def test_binned_spiketrain_n_bins_not_int(self):
def test_to_array(self):
x = cv.BinnedSpikeTrain(self.spiketrain_a, bin_size=1 * pq.s,
n_bins=10, t_stop=10. * pq.s)
arr_float = x.to_array(dtype=np.float32)
assert_array_equal(arr_float, x.to_array().astype(np.float32))
arr_float = x.to_array(dtype=float)
assert_array_equal(arr_float, x.to_array().astype(float))

# Test if error is raised when providing insufficient number of
# parameters
Expand Down
2 changes: 1 addition & 1 deletion elephant/test/test_spade.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def test_spade_raise_error(self):
corr='invalid_key')
# Test negative number of subset for stability
self.assertRaises(ValueError, spade.approximate_stability, (),
np.array([]), n_subsets=-3)
np.ndarray([]), n_subsets=-3)

def test_pattern_set_reduction(self):
winlen = 6
Expand Down
2 changes: 1 addition & 1 deletion elephant/test/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def setUp(self):
def test_lvr_with_quantities(self):
seq = pq.Quantity(self.test_seq, units='ms')
assert_array_almost_equal(statistics.lvr(seq), self.target, decimal=9)
seq = pq.Quantity(self.test_seq, units='ms').rescale('s')
seq = pq.Quantity(self.test_seq, units='ms').rescale('s', dtype=float)
assert_array_almost_equal(statistics.lvr(seq), self.target, decimal=9)

def test_lvr_with_plain_array(self):
Expand Down
2 changes: 2 additions & 0 deletions elephant/test/test_unitary_event_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def test__UE_surrogate(self):
item1))

def test_jointJ_window_analysis(self):

sts1 = self.sts1_neo
sts2 = self.sts2_neo

Expand Down Expand Up @@ -498,6 +499,7 @@ def test_Riehle_et_al_97_UE(self):

def test_multiple_neurons(self):
np.random.seed(12)

# Create a list of lists containing 3 Trials with 5 spiketrains
spiketrains = \
[StationaryPoissonProcess(
Expand Down
2 changes: 1 addition & 1 deletion requirements/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge # required for MPI

dependencies:
- python>=3.7
- python>=3.8

- mpi4py
- numpy>=1.19.5
Expand Down
2 changes: 1 addition & 1 deletion requirements/environment-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge # required for MPI

dependencies:
- python>=3.7
- python>=3.8

- mpi4py
- numpy>=1.19.5
Expand Down
2 changes: 1 addition & 1 deletion requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
- conda-forge # required for MPI

dependencies:
- python>=3.7
- python>=3.8
- mpi4py
- numpy>=1.19.5
- scipy
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,18 @@
"Documentation": "https://elephant.readthedocs.io/en/latest/",
"Source Code": "https://github.com/NeuralEnsemble/elephant",
},
"python_requires": ">=3.7",
"python_requires": ">=3.8",
"classifiers": [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering']
}
Expand Down

0 comments on commit 0896873

Please sign in to comment.