Skip to content

Commit

Permalink
Fix build and test system
Browse files Browse the repository at this point in the history
* test only on recent versions of python
* test for compatibility with numpy v1
* force minimum version compatibility for numpy v1
  • Loading branch information
taobrienlbl committed Sep 10, 2024
1 parent 4b213c0 commit 37050fa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
48 changes: 39 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
# exclude MacOS arm64 on 3.7
exclude:
- os: macos-latest
python-version: '3.7'
python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -33,7 +29,41 @@ jobs:
pip install -e .
- name: Run linting tests on files in src
run: ruff src
run: ruff check src

- name: Run tests
run: pytest
run: pytest

# test old versions of numpy; this follows advice in
# https://numpy.org/doc/stable/dev/depending_on_numpy.html#depending-on-numpy
old_numpy_test:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Build wheel via wheel, then install it
run: |
python -m pip install build
python -m build # This will pull in numpy 2.0 in an isolated env
python -m pip install dist/*.whl
- name: Test against oldest supported numpy version
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install numpy==1.26.4
# now run test suite
pip install -r requirements.txt
pip install pytest ruff
pip install -e .
pytest
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[project]
name = "fastkde"
dynamic = ["dependencies", "version", "optional-dependencies", "description", "readme", "authors", "keywords"]
dynamic = ["version", "optional-dependencies", "description", "readme", "authors", "keywords"]
dependencies = [
"numpy>=1.26.4",
"scipy",
"xarray",
]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
Expand All @@ -16,7 +21,7 @@ requires = [
"wheel",
"toml",
"setuptools_scm>=4.1.2",
"oldest-supported-numpy; python_version>='3.5'",
"numpy>=2.0.0",
]

build-backend = "setuptools.build_meta"
Expand Down

0 comments on commit 37050fa

Please sign in to comment.