diff --git a/.github/workflows/core-test.yml b/.github/workflows/core-test.yml index 595f60562..49a52a800 100644 --- a/.github/workflows/core-test.yml +++ b/.github/workflows/core-test.yml @@ -25,10 +25,12 @@ jobs: fail-fast: true matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest"] - python-version: ['3.9', '3.10', '3.11', '3.12'] - numpy-version: ['1.22.4', '1.23.5', '1.24.1', '1.25.1', '1.26.4'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + numpy-version: ['1.22.4', '1.23.5', '1.24.4', '1.25.1', '1.26.4', '2.0.2','2.1'] # numpy 1.22: 3.10, 1.23: 3.11, 1.24: 3.11, 1.25: 3.11, 1.26: 3.12 exclude: + - python-version: '3.9' + numpy-version: '2.1' - python-version: '3.11' numpy-version: '1.22.4' - python-version: '3.12' @@ -36,17 +38,30 @@ jobs: - python-version: '3.12' numpy-version: '1.23.5' - python-version: '3.12' - numpy-version: '1.24.1' + numpy-version: '1.24.4' - python-version: '3.12' numpy-version: '1.25.1' + - python-version: '3.13' + numpy-version: '1.22.4' + - python-version: '3.13' + numpy-version: '1.23.5' + - python-version: '3.13' + numpy-version: '1.24.4' + - python-version: '3.13' + numpy-version: '1.25.1' + - python-version: '3.13' + numpy-version: '1.26.4' + - python-version: '3.13' + numpy-version: '2.0.2' + steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install numpy ${{ matrix.numpy-version }} run: | diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index c609cc540..e5e0cd3a5 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: ['3.9', '3.11.9'] + python-version: ['3.9', '3.12'] defaults: # by default run in bash mode (required for conda usage) run: @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get current year-month id: date @@ -38,7 +38,7 @@ jobs: run: | echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 # Loading cache of ephys_testing_dataset id: cache-datasets with: diff --git a/environment_testing.yml b/environment_testing.yml index 8ff8bd984..64488e835 100644 --- a/environment_testing.yml +++ b/environment_testing.yml @@ -4,3 +4,6 @@ channels: dependencies: - datalad - pip + # temporary have this here for IO testing while we decide how to deal with + # external packages not 2.0 ready + - numpy=1.26.4 diff --git a/neo/core/spiketrain.py b/neo/core/spiketrain.py index 8ba21d894..c4191829d 100644 --- a/neo/core/spiketrain.py +++ b/neo/core/spiketrain.py @@ -979,7 +979,7 @@ def _merge_array_annotations(self, others, sorting=None): omitted_keys_other = [ key - for key in np.unique([key for other in others for key in other.array_annotations]) + for key in set([key for other in others for key in other.array_annotations]) if key not in self.array_annotations ] diff --git a/neo/test/coretest/test_spiketrain.py b/neo/test/coretest/test_spiketrain.py index 9db5e8f5d..f483f3fce 100644 --- a/neo/test/coretest/test_spiketrain.py +++ b/neo/test/coretest/test_spiketrain.py @@ -313,6 +313,10 @@ def test__create_from_quantity_array(self): def test__create_from_quantity_array_with_dtype(self): times = np.arange(10, dtype="f4") * pq.ms + # this step is required for NumPy 2.0 which now casts to float64 in the case either value/array + # is float64 even if not necessary + # https://numpy.org/devdocs/numpy_2_0_migration_guide.html + times = times.astype(dtype="f4") t_start = 0.0 * pq.s t_stop = 12.0 * pq.ms train1 = SpikeTrain(times, t_start=t_start, t_stop=t_stop) @@ -343,6 +347,10 @@ def test__create_from_quantity_array_no_start_stop_units(self): def test__create_from_quantity_array_no_start_stop_units_with_dtype(self): times = np.arange(10, dtype="f4") * pq.ms + # this step is required for NumPy 2.0 which now casts to float64 in the case either value/array + # is float64 even if not necessary + # https://numpy.org/devdocs/numpy_2_0_migration_guide.html + times = times.astype(dtype="f4") t_start = 0.0 t_stop = 12.0 train1 = SpikeTrain(times, t_start=t_start, t_stop=t_stop) @@ -1143,7 +1151,7 @@ def test_merge_multiple(self): expected *= time_unit sorting = np.argsort(expected) expected = expected[sorting] - np.testing.assert_array_equal(result.times, expected) + np.testing.assert_array_equal(result.times.magnitude, expected.magnitude) # Make sure array annotations are merged correctly self.assertTrue("label" not in result.array_annotations) diff --git a/pyproject.toml b/pyproject.toml index 4c9315722..c6fd2fa19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.14.0.dev0" authors = [{name = "Neo authors and contributors"}] description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats" readme = "README.rst" -requires-python = ">=3.9,<3.13" # 3.13 will require NumPy > 2.0 (Windows issue in CI) +requires-python = ">=3.9" license = {text = "BSD 3-Clause License"} classifiers = [ "Development Status :: 4 - Beta", @@ -23,7 +23,7 @@ classifiers = [ dependencies = [ "packaging", - "numpy>=1.22.4,<2.0.0", + "numpy>=1.22.4", "quantities>=0.16.1" ] @@ -45,7 +45,7 @@ iocache = [ ] test = [ - "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable + # "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable "pytest", "pytest-cov", # datalad # this dependency is covered by conda (environment_testing.yml) @@ -105,7 +105,7 @@ plexon2 = ["zugbruecke>=0.2; sys_platform!='win32'", "wenv; sys_platform!='win32 all = [ "coverage", "coveralls", - "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable + # "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable "h5py", "igor2", "ipython",