Skip to content

Commit

Permalink
Merge branch 'cbrnr:main' into accelerometer_feature_addition
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-p-2000 authored Jan 24, 2025
2 parents 9bb5e28 + 40d9067 commit 64fd527
Show file tree
Hide file tree
Showing 16 changed files with 266 additions and 128 deletions.
13 changes: 13 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[run]
branch = True
source = sleepecg
omit =
*/examples/*
*/setup.py

[report]
exclude_lines =
pragma: no cover
if __name__ == .__main__.:
@abstractmethod
@abstractclassmethod
151 changes: 151 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Test
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- 'docs/**'
push:
branches:
- main
release:
types:
- published

jobs:
style:
name: Check style
runs-on: ubuntu-22.04
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: pre-commit/[email protected]

build_wheels:
needs: style
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-15, macos-13]
arch: [native]
include:
- os: ubuntu-22.04
arch: aarch64
fail-fast: false
timeout-minutes: 15 # Linux ~1 min, Windows ~4 min, aarch64 emulated ~8 min with tests (~3 min without)
name: cibuildwheel (${{ matrix.os }} ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set wheel tests to be skipped on emulated archs on PRs
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ matrix.arch }}" == "aarch64" ]]; then
echo "CIBW_TEST_SKIP=*" | tee -a $GITHUB_ENV
fi
shell: bash
# For aarch64 support https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- uses: docker/setup-qemu-action@v3
with:
platforms: all
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
- name: Build wheels and run tests
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl

test:
needs: build_wheels
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-15, macos-13]
python-version: ['3.12']
include:
- os: ubuntu-22.04
python-version: '3.13'
fail-fast: false
name: Test wheels (${{ matrix.os }} py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 5
defaults:
run:
shell: bash -eo pipefail {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
pattern: artifact-${{ matrix.os }}-native
merge-multiple: true
path: dist
- run: ls -al dist
- name: Triage dependencies
run: |
echo "PIP_EXTRA=wfdb numba pytest-error-for-skips" | tee -a $GITHUB_ENV
echo "PYTEST_EXTRA=--error-for-skips" | tee -a $GITHUB_ENV
- run: python -m pip install ./dist/*.whl pytest pytest-cov edfio $PIP_EXTRA --only-binary="numpy,numba,edfio"
- run: pytest -rfEXs --cov=sleepecg --cov-report=xml --tb=short --cov-branch --color=yes $PYTEST_EXTRA tests/
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: success() || failure()

build_sdist:
needs: style
name: Build source distribution
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.12
- name: Build sdist
run: |
set -eo pipefail
python -m pip install build numpy
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz

check_wheels:
needs: [build_wheels, build_sdist]
name: Check wheels and source distribution
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist
- run: ls -al dist
shell: bash
- uses: actions/setup-python@v5
with:
python-version: 3.12
- run: python -m pip install twine
- run: python -m twine check --strict dist/*

upload-pypi:
name: Upload to PyPI
needs: [check_wheels, test]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist
- uses: pypa/[email protected]
63 changes: 0 additions & 63 deletions .github/workflows/release.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/test.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
__pycache__/
site/
sleepecg.egg-info/
/build
/coverage.xml
/.coverage
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
rev: v0.9.2
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.14.1
hooks:
- id: mypy
exclude: ^tests|^examples
args: [--python-version=3.9]
args: [--python-version=3.10]
additional_dependencies:
- types-PyYAML
- types-requests
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
## [UNRELEASED] - YYYY-MM-DD
### Added
- Add support to store NSRR token in environment variable or user config ([#243](https://github.com/cbrnr/sleepecg/pull/243) by [Simon Pusterhofer](https://github.com/simon-p-2000))
- Add Python 3.13+ support by transforming wheel builds using ABI3 mode ([#251](https://github.com/cbrnr/sleepecg/pull/251) by [Eric Larson](https://github.com/larsoner))

### Changed
- Split `get_config` function into `get_config` and `get_config_value` to get the entire configuration (as a dictionary) or an individual configuration key, respectively ([#229](https://github.com/cbrnr/sleepecg/pull/225) by [Clemens Brunner](https://github.com/cbrnr))

### Removed
- Remove Python 3.9 support ([#241](https://github.com/cbrnr/sleepecg/pull/241) by [Clemens Brunner](https://github.com/cbrnr))

### Fixed
- Fix `plot_ecg` for newer versions of Matplotlib ([#225](https://github.com/cbrnr/sleepecg/pull/225) by [Clemens Brunner](https://github.com/cbrnr))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Python](https://img.shields.io/pypi/pyversions/sleepecg.svg?logo=python&logoColor=white)
![Python](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fcbrnr%2Fsleepecg%2Frefs%2Fheads%2Fmain%2Fpyproject.toml&logo=python&logoColor=white)
[![PyPI](https://img.shields.io/pypi/v/sleepecg)](https://pypi.org/project/sleepecg/)
[![Docs](https://readthedocs.org/projects/sleepecg/badge/?version=latest)](https://sleepecg.readthedocs.io/en/stable/index.html)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05411/status.svg)](https://doi.org/10.21105/joss.05411)
Expand Down
25 changes: 25 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
comment: false
github_checks: # too noisy, even though "a" interactively disables them
annotations: false

codecov:
notify:
require_ci_to_pass: false

coverage:
status:
patch:
default:
informational: true
target: 95%
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
project:
default: false
library:
informational: true
target: 90%
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
Loading

0 comments on commit 64fd527

Please sign in to comment.