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

MAINT: Add support for python 3.11 and drop support for 3.7 #121

Merged
merged 4 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 5 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

strategy:
matrix:
os: [ ubuntu-20.04, macOS-10.15, windows-2019 ]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
os: [ ubuntu-20.04, macOS-11, windows-2019 ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]

name: Python version - ${{ matrix.python-version }} - ${{ matrix.os }}
steps:
Expand All @@ -26,15 +26,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Ensure openblas is installed on macOS for numpy
if: matrix.os == 'macOS-10.15'
run: |
brew install openblas
python3 -m pip install --upgrade pip setuptools wheel
OPENBLAS="$(brew --prefix openblas)" pip install -r requirements-dev.txt

- name: Install Dependencies for non-mac OS
if: matrix.os != 'macOS-10.15'
- name: Install Dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
Expand All @@ -48,7 +40,7 @@ jobs:
pytest -v --cov-branch --cov=polyagamma tests/ --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
12 changes: 2 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

strategy:
matrix:
os: [ ubuntu-20.04, macOS-10.15, windows-2019 ]
python-version: [ '3.7' ]
os: [ ubuntu-20.04, macOS-11, windows-2019 ]
python-version: [ '3.8' ]

steps:
- uses: actions/checkout@v2
Expand All @@ -25,15 +25,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Ensure openblas is installed on macOS for numpy
if: matrix.os == 'macOS-10.15'
run: |
brew install openblas
python3 -m pip install --upgrade pip setuptools wheel cibuildwheel==2.4.0
OPENBLAS="$(brew --prefix openblas)" pip install -r requirements-dev.txt

- name: Install Dependencies
if: matrix.os != 'macOS-10.15'
run: |
python3 -m pip install --upgrade pip setuptools wheel cibuildwheel==2.4.0
pip install -r requirements-dev.txt
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = [
"wheel",
"cython==0.29.30",
"setuptools>=61.0.0",
"numpy==1.23.2; python_version>='3.11'",
"numpy==1.21.3; python_version=='3.10'",
"numpy==1.19.0; python_version<='3.9'",
"setuptools-scm",
Expand All @@ -18,7 +19,7 @@ authors = [
description = "Efficiently generate samples from the Polya-Gamma distribution using a NumPy/SciPy compatible interface."
readme = "README.md"
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = ["numpy >= 1.19.0"]
license = {text = "BSD 3-Clause License"}
keywords = ['polya-gamma distribution', 'polya-gamma random sampling']
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
build==0.8.0
codecov==2.1.12
cython==0.29.30
numpy==1.21.3
numpy==1.23.2
pytest==7.1.2
pytest-cov==3.0.0
8 changes: 6 additions & 2 deletions tests/test_polyagamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def test_polyagamma():
# test if non-integer elements of size raise exception
with pytest.raises(TypeError, match="object cannot be interpreted as an integer"):
assert rng_polyagamma(size=(5.1, 2.9))
with pytest.raises(TypeError, match="object cannot be interpreted as an integer"):
# Later versions of numpy seem to return an updated error meesages for the
# following so we leave out the `match` keyword.
with pytest.raises(TypeError):
assert rng_polyagamma(size=10.4)

h = [[[0.59103028], [0.15228518], [0.53494081], [0.85875483], [0.05796053]],
Expand All @@ -40,7 +42,9 @@ def test_polyagamma():
with pytest.raises(ValueError, match="array is not broadcastable"):
rng_polyagamma(z, size=(10, 1, 4))
# test if the expected exception is returned when `size` is the wrong object
with pytest.raises(TypeError, match="object does not support indexing"):
# Later versions of numpy seem to return an updated error meesages for the
# following so we leave out the `match` keyword.
with pytest.raises(TypeError):
rng_polyagamma(z, size={10, 1, 4})


Expand Down