Skip to content

Commit

Permalink
Merge pull request #43 from ocefpaf/test_against_np2
Browse files Browse the repository at this point in the history
Test against numpy 2.0
  • Loading branch information
ocefpaf authored May 30, 2024
2 parents a619341 + 8654729 commit 5d407fa
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 20 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, ubuntu-latest, macos-latest]
experimental: [false]
include:
- python-version: "3.12"
os: "ubuntu-latest"
experimental: true
fail-fast: false
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
Expand All @@ -28,12 +36,15 @@ jobs:
--file requirements-dev.txt
--channel conda-forge
- name: Install unstable dependencies
if: matrix.experimental == true
run: |
micromamba install conda-forge/label/numpy_dev::numpy
- name: Install ciso
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall
- name: Tests
shell: bash -l {0}
run: |
python -m pytest -rxs ciso/tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.egg-info
.ipynb_checkpoints/
_ciso*.c
_ciso*.html
_ciso*.so
build/
ciso/_version.py
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-ast
Expand All @@ -13,32 +13,32 @@ repos:
files: requirements-dev.txt

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
exclude: docs/source/conf.py
args: [--max-line-length=105]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: [toml]
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.4.2
hooks:
- id: black
language_version: python3

- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
rev: v0.3.9
hooks:
- id: blackdoc

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.3.0
hooks:
- id: codespell
exclude: >
Expand All @@ -49,19 +49,19 @@ repos:
- --quiet-level=2

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
rev: v3.15.2
hooks:
- id: pyupgrade
args:
- --py36-plus

- repo: https://github.com/dosisod/refurb
rev: v1.16.0
rev: v2.0.0
hooks:
- id: refurb

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
rev: v3.1.0
hooks:
- id: add-trailing-comma

Expand Down
3 changes: 2 additions & 1 deletion ciso/_ciso.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cimport cython
import numpy as np
cimport numpy as np

NaN = np.NaN
np.import_array()
NaN = np.nan


@cython.boundscheck(False)
Expand Down
4 changes: 2 additions & 2 deletions ciso/ciso.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def zslice(q, p, p0):
if p0 < p.min() or p.max() < p0:
raise ValueError(f"p0 {p0} is outside p bounds ({p.min}, {p.max}).")

q = np.asfarray(q)
p = np.asfarray(p)
q = np.asarray(q, dtype=float)
p = np.asarray(p, dtype=float)

if q.ndim == 3:
K, J, I = q.shape # noqa
Expand Down
1 change: 0 additions & 1 deletion ciso/tests/test_ciso.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys

import numpy as np
import pytest
Expand Down
16 changes: 12 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[build-system]
requires = ["setuptools>=41.2", "setuptools_scm", "cython", "numpy", "wheel"]
requires = [
"setuptools>=41.2",
"setuptools-scm",
"cython",
"oldest-supported-numpy ; python_version < '3.9'",
"numpy>=2.0.0rc1 ; python_version >= '3.9'",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -10,11 +17,12 @@ authors = [
{email = "[email protected]"},
{name = "Robert Hetland"}
]
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "BSD-2-Clause"}
dependencies = [
"cython",
"numpy>=1.19",
"cython>=3",
"oldest-supported-numpy ; python_version < '3.9'",
"numpy>=2.0.0rc1 ; python_version >= '3.9'",
]

[project.optional-dependencies]
Expand Down

0 comments on commit 5d407fa

Please sign in to comment.