diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c1a5a4d..7ef78e0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - os: [ ubuntu-20.04, macOS-11, windows-2019 ] + os: [ ubuntu-20.04, macOS-12, windows-2019 ] python-version: [ '3.9', 'pypy3.9', '3.10', '3.11', '3.12' ] fail-fast: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a98caa..7d36c1d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,39 +17,39 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, macOS-11, windows-2019 ] + os: [ ubuntu-20.04, macOS-12, windows-2019 ] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-tags: 'true' fetch-depth: 0 - name: Set up QEMU if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Cythonize C-extensions run: | - python3 -m pip install --upgrade pip cython==3.0.* + python3 -m pip install --upgrade pip cibuildwheel==2.19.2 + python3 -m pip install -r requirements-dev.txt cythonize polyagamma/*.pyx - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.19.2 with: package-dir: . output-dir: wheelhouse config-file: "pyproject.toml" - - name: Set up Python - if: ${{ matrix.os == 'ubuntu-20.04' }} - uses: actions/setup-python@v4.7.0 - with: - python-version: '3.9' - - name: Build source distribution if: ${{ matrix.os == 'ubuntu-20.04' }} run: | @@ -65,23 +65,23 @@ jobs: name: wheels_and_sdist path: wheelhouse if-no-files-found: error - - upload_pypi: - needs: [ build_wheels_and_sdist ] - runs-on: ubuntu-20.04 - environment: - name: pypi - url: https://pypi.org/p/polyagamma - permissions: - id-token: write - steps: - - name: Pull built wheels and sdist - uses: actions/download-artifact@v3 - with: - name: wheels_and_sdist - path: wheelhouse - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.10 - with: - packages_dir: wheelhouse + # + # upload_pypi: + # needs: [ build_wheels_and_sdist ] + # runs-on: ubuntu-20.04 + # environment: + # name: pypi + # url: https://pypi.org/p/polyagamma + # permissions: + # id-token: write + # steps: + # - name: Pull built wheels and sdist + # uses: actions/download-artifact@v3 + # with: + # name: wheels_and_sdist + # path: wheelhouse + # + # - name: Publish to PyPI + # uses: pypa/gh-action-pypi-publish@v1.8.10 + # with: + # packages_dir: wheelhouse diff --git a/pyproject.toml b/pyproject.toml index e94d76e..6fa9092 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,12 @@ requires = [ # the used version of python. This does not affect required numpy version at # installation time; `project.dependencies` is most relevant for required numpy # when installtng at user level. - "numpy==1.26.0; python_version=='3.12' and platform_python_implementation!='PyPy'", - "numpy==1.23.2; python_version=='3.11' and platform_python_implementation!='PyPy'", - "numpy==1.21.3; python_version=='3.10' and platform_python_implementation!='PyPy'", - "numpy==1.19.3; python_version=='3.9' and platform_python_implementation!='PyPy'", + "numpy==2.0.0; python_version=='3.12' and platform_python_implementation!='PyPy'", + "numpy==2.0.0; python_version=='3.11' and platform_python_implementation!='PyPy'", + "numpy==2.0.0; python_version=='3.10' and platform_python_implementation!='PyPy'", + "numpy==2.0.0; python_version=='3.9' and platform_python_implementation!='PyPy'", # PyPy specific requirements - "numpy==1.25.0; python_version=='3.9' and platform_python_implementation=='PyPy'", + "numpy==2.0.0; python_version=='3.9' and platform_python_implementation=='PyPy'", ] build-backend = "setuptools.build_meta" diff --git a/requirements-dev.txt b/requirements-dev.txt index 3ec7f7c..d921df4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ cython==3.0.* -numpy==1.26.0 +numpy==2.0.0 pre-commit==3.4.0 pytest==7.4.0 pytest-cov==4.1.0 +setuptools==70.3.0 diff --git a/tests/test_polyagamma.py b/tests/test_polyagamma.py index f0f2484..524f665 100644 --- a/tests/test_polyagamma.py +++ b/tests/test_polyagamma.py @@ -172,7 +172,7 @@ def test_polyagamma_pdf_cdf(method, h, z): x = random_polyagamma(h, z, size=5000, method=method, random_state=rng) x.sort() d = polyagamma_pdf(x, h=h, z=z) - area_under_curve = np.trapz(d, x) + area_under_curve = np.trapezoid(d, x) # relative tolerance is set so that 0.998 can pass the tests. assert np.isclose(1.0, area_under_curve, rtol=1e-2) @@ -181,7 +181,7 @@ def test_polyagamma_pdf_cdf(method, h, z): # calculate the cdf of the distribution at the mean of the samples cdf = polyagamma_cdf(xx, h=h, z=z) # estimate empirical cdf from the sampled and corresponding density - ecdf = np.trapz(d[mask], x[mask]) + ecdf = np.trapezoid(d[mask], x[mask]) # test if the empirical cdf is equal to the distribution's to 2 decimals assert np.allclose(ecdf, cdf, rtol=1e-2)