Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard pyproject.toml #57

Merged
merged 21 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
numpy: ["--pre numpy"]
# numpy: ["--pre numpy"]
include:
- python-version: "3.9"
numpy: numpy==1.22.0
Expand All @@ -41,25 +41,15 @@ jobs:
with:
cbrnr marked this conversation as resolved.
Show resolved Hide resolved
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Setup Poetry
run: |
pip install -U pip
pip install poetry==1.7.0
poetry install --only dev
poetry run pip install ${{matrix.numpy}}
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Pre-commit
run: |
poetry run pre-commit run --all-files
uv run --extra dev --with ${{matrix.numpy}} pre-commit run --all-files
- name: Pytest
run: |
poetry run pytest -Werror --cov --cov-report term-missing --cov-fail-under=100
uv run --extra dev --with ${{matrix.numpy}} pytest -Werror --cov --cov-report term-missing --cov-fail-under=100
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,3 @@ repos:
language: python
types_or: [python, pyi]
require_serial: true

- repo: https://github.com/python-poetry/poetry
rev: '1.7.0'
hooks:
- id: poetry-check
10 changes: 5 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ build:
os: ubuntu-22.04
tools:
python: "3.9"
jobs:
pre_build:
- pip install poetry==1.7.0
- poetry config virtualenvs.create false
- poetry install
# jobs:
# pre_build:
# - pip install uv
# - uv sync
# - source $READTHEDOCS_VIRTUALENV_PATH/activate

sphinx:
configuration: docs/source/conf.py
77 changes: 41 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
[tool.poetry]
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "edfio"
version = "0.0.0"
description = "Read and write EDF/EDF+ files."
license = "Apache-2.0"
authors = ["The Siesta Group <opensource@thesiestagroup.com>"]
license = { text = "Apache-2.0" }
authors = [
{ name = "The Siesta Group", email = "opensource@thesiestagroup.com" }
]
readme = "README.md"
repository = "https://github.com/the-siesta-group/edfio"
documentation = "https://edfio.readthedocs.io"
requires-python = ">=3.9"
dependencies = [
"numpy >= 1.22.0"
]
dynamic = ["version"]

[tool.poetry.dependencies]
python = "^3.9"
numpy = ">=1.22.0"
[project.optional-dependencies]
dev = [
"pytest>=7.4.3",
"pytest-cov>=4.1.0",
"pre-commit>=3.5.0",
"mypy>=1.6.1",
"ruff>=0.3.4",
"sphinx>=7.2.6",
"myst-parser>=2.0.0",
"pydata-sphinx-theme>=0.14.3",
"numpydoc>=1.6.0"
]

[tool.poetry.group.dev.dependencies]
pytest = "7.4.3"
pytest-cov = "4.1.0"
pre-commit = "3.5.0"
mypy = "1.6.1"
ruff = "0.3.4"
sphinx = "7.2.6"
myst-parser = "2.0.0"
pydata-sphinx-theme = "0.14.3"
numpydoc = "1.6.0"
[project.urls]
repository = "https://github.com/the-siesta-group/edfio"
documentation = "https://edfio.readthedocs.io"

[tool.poetry-dynamic-versioning]
vcs = "git"
style = "semver"
enable = true
[tool.hatch.version]
source = "vcs"
raw-options = { version_scheme = "release-branch-semver" }

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"
[tool.mypy]
python_version = "3.9"
ignore_missing_imports = true
disallow_untyped_defs = true
warn_unreachable = true
strict_equality = true
pretty = true
warn_unused_ignores = true
packages = ["edfio"]

[tool.ruff]
target-version = "py39"
Expand Down Expand Up @@ -70,13 +85,3 @@ ban-relative-imports = "all"

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.mypy]
python_version = "3.9"
ignore_missing_imports = true
disallow_untyped_defs = true
warn_unreachable = true
strict_equality = true
pretty = true
warn_unused_ignores = true
packages = ["edfio"]
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import pytest


@pytest.fixture()
@pytest.fixture
def tmp_file(tmp_path: Path) -> Path:
return tmp_path / "target.edf"
6 changes: 3 additions & 3 deletions tests/test_edf_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ def test_decode_edfplus_date_invalid_month_name():
_decode_edfplus_date("02-MAI-1951")


@pytest.fixture()
@pytest.fixture
def patient():
return Patient._from_str("MCH-0234567 F 02-MAY-1951 Haagse_Harry")


@pytest.fixture()
@pytest.fixture
def recording():
return Recording._from_str(
"Startdate 02-MAR-2002 EMG561 BK/JOP Sony. MNC R Median Nerve."
)


@pytest.fixture()
@pytest.fixture
def edf(patient, recording):
return Edf([EdfSignal(np.arange(10), 1)], patient=patient, recording=recording)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_edf_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def sine(duration, f, fs):
return np.sin(2 * np.pi * f * t)


@pytest.fixture()
@pytest.fixture
def dummy_edf_signal() -> EdfSignal:
data = sine(5, 2, 128)
return EdfSignal(data, 128)
Expand Down
Loading