Skip to content

Commit

Permalink
Bump dependencies for NumPy 2 compatibility (#511)
Browse files Browse the repository at this point in the history
All tests pass and `demo.ipynb` works without any errors or warnings
using NumPy >= 2.
  • Loading branch information
tompollard authored Jan 21, 2025
2 parents e5c6fe5 + ec5e24f commit ca9c7f3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 37 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build documentation
run: |
cd docs
make html
51 changes: 21 additions & 30 deletions .github/workflows/run-tests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Link repository with GitHub Actions
# https://docs.github.com/en/actions/learn-github-actions/introduction-to-github-actions
name: Test

name: run-tests
on:
push:
branches:
Expand All @@ -10,30 +8,38 @@ on:
branches:
- main

# Set the language, install dependencies, and run the tests
env:
NPY_PROMOTION_STATE: weak_and_warn

jobs:
build:
runs-on: ${{ matrix.os }}
test:
name: Python ${{ matrix.python-version }} / ${{ matrix.os }} / ${{ matrix.numpy }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
numpy: ["numpy"]
include:
- os: ubuntu-latest
python-version: "3.9"
numpy: "numpy==1.26.4"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v3
- uses: astral-sh/setup-uv@v3
- name: Install Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install libsndfile
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install -y libsndfile1
run: sudo apt-get install -y libsndfile1
- name: Run tests
run: uv run --extra dev pytest
- name: Check source code format
run: uv run --with ${{ matrix.numpy }} --extra dev pytest
- name: Check style
run: uv run --extra dev black --check --diff .

test-deb10-i386:
name: Python 3.7 on Debian 10 i386
runs-on: ubuntu-latest
container: i386/debian:10
steps:
Expand All @@ -49,26 +55,11 @@ jobs:
python3-soundfile \
python3-pytest \
git
python3 --version
# Note: "actions/checkout@v2" requires libstdc++6:amd64 to be
# installed in the container. To keep things simple, use
# "actions/checkout@v1" instead.
# https://github.com/actions/checkout/issues/334
- uses: actions/checkout@v1

- name: Run tests
run: |
pytest-3
build-documentation:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build documentation
run: |
cd docs
make html
run: pytest-3
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.9"
python: "3.10"

# Build from the docs/ directory with Sphinx
sphinx:
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ description = "The WFDB Python package: tools for reading, writing, and processi
authors = [{name = "The Laboratory for Computational Physiology", email = "[email protected]"}]
license = {text = "MIT License"}
readme = "README.md"
requires-python = ">= 3.8"
requires-python = ">= 3.9"
dependencies = [
"numpy >= 1.10.1, < 2.0.0",
"scipy >= 1.0.0",
"pandas >= 1.3.0",
"numpy >= 1.26.4",
"scipy >= 1.13.0",
"pandas >= 2.2.3",
"soundfile >= 0.10.0",
"matplotlib >= 3.2.2",
"requests >= 2.8.1",
Expand All @@ -35,7 +35,7 @@ documentation = "https://wfdb.readthedocs.io/"

[tool.black]
line-length = 80
target-version = ['py37']
target-version = ["py39"]

[tool.hatch.build.targets.sdist]
exclude = [
Expand Down
2 changes: 1 addition & 1 deletion wfdb/processing/peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def find_peaks(sig):
"""
r"""
Find hard peaks and soft peaks in a signal, defined as follows:
- Hard peak: a peak that is either /\ or \/.
Expand Down

0 comments on commit ca9c7f3

Please sign in to comment.