Skip to content

Commit

Permalink
Merge pull request #20 from Starlink/u/timj/numpy2
Browse files Browse the repository at this point in the history
Modernize numpy
  • Loading branch information
timj committed Aug 17, 2024
2 parents b91c26d + 4a42125 commit a13fcc1
Show file tree
Hide file tree
Showing 6 changed files with 675 additions and 438 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,53 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "setup.cfg"
allow-prereleases: true

- name: Update pip/wheel infrastructure
run: |
python -m pip install --upgrade pip
pip install wheel
pip install wheel uv
- name: Install pytest packages
run: pip install pytest
run: uv pip install --system pytest

- name: List installed packages
run: pip list -v

- name: Build and install
run: pip install -v -e .
run: uv pip install --system -v -e .

- name: Run tests
run: |
pytest test_pal.py
pytest -Wd test_pal.py
pypi_sdist_build:
runs-on: ubuntu-latest
needs: [build_and_test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
# Full git history.
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand All @@ -69,22 +70,23 @@ jobs:
- name: Build and create distribution
run: |
python -m build --sdist
python -m build --sdist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: palpy-sdist
path: dist/*


pypi_wheel_build:
strategy:
matrix:
os: ["ubuntu-latest", "macos-11"]
os: ["ubuntu-latest", "macos-12"]
runs-on: ${{ matrix.os }}
needs: [build_and_test]
if: startsWith(github.ref, 'refs/tags/')
env:
CIBW_BUILD: "cp3{8,9,10,11}-{manylinux_x86_64,manylinux_aarch64,macosx_arm64,macosx_x86_64}"
CIBW_BUILD: "cp3{8,9,10,11,12,13}-{manylinux_x86_64,manylinux_aarch64,macosx_arm64,macosx_x86_64}"
CIBW_ARCHS_MACOS: "x86_64 arm64"
# use line below to enable aarch64 builds
# CIBW_ARCHS_LINUX: "auto aarch64"
Expand All @@ -98,13 +100,13 @@ jobs:
# with:
# platforms: arm64

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand All @@ -115,8 +117,9 @@ jobs:
- name: Build and create distribution
run: |
python -m cibuildwheel --output-dir dist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: palpy-${{ matrix.os }}
path: dist/*

pypi-publish:
Expand All @@ -127,9 +130,10 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
pattern: palpy-*
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.8.4
-----

- Fix build problems with numpy 2.
- Test with python 3.12 and 3.13.

1.8.3
-----

Expand Down
12 changes: 6 additions & 6 deletions pal.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def caldjVector(np.ndarray[long, ndim=1] iy not None,
if flag == 0:
mjd_out[ii] = mjd
else:
mjd_out[ii] = np.NaN
mjd_out[ii] = np.nan

return mjd_out

Expand Down Expand Up @@ -654,7 +654,7 @@ def daf2rVector(np.ndarray[long, ndim=1] ideg_in not None,
if flag==0:
ang_out[i] = rad
else:
ang_out[i] = np.NaN
ang_out[i] = np.nan

return ang_out

Expand Down Expand Up @@ -1442,8 +1442,8 @@ def ds2tpVector( np.ndarray[double, ndim=1] ra not None,
xiout[i] = xi
etaout[i] = eta
else:
xiout[i] = np.NaN
etaout[i] = np.NaN
xiout[i] = np.nan
etaout[i] = np.nan

return xiout, etaout

Expand Down Expand Up @@ -1633,7 +1633,7 @@ def dtf2dVector( np.ndarray[long, ndim=1] ihour not None,
if flag==0:
days[ii] = value
else:
days[ii] = np.NaN
days[ii] = np.nan

return days

Expand Down Expand Up @@ -1700,7 +1700,7 @@ def dtf2rVector(np.ndarray[long, ndim=1] ihour, np.ndarray[long, ndim=1] imin,
if flag==0:
radians[ii] = value
else:
radians[ii] = np.NaN
radians[ii] = np.nan

return radians

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"oldest-supported-numpy",
"numpy",
"cython",
"setuptools",
"setuptools-scm>=8.0"
Expand Down
Loading

0 comments on commit a13fcc1

Please sign in to comment.