Skip to content

Commit

Permalink
Housekeeping: build with numpy 2.0; update JAX lowering syntax; etc. (#…
Browse files Browse the repository at this point in the history
…129)

* update deps

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* disable unstable test

* Don't print

* Faster building; slower running

* fast run wheels

* building

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
dfm and pre-commit-ci[bot] authored Jun 23, 2024
1 parent b4c25b1 commit 657d0d7
Show file tree
Hide file tree
Showing 15 changed files with 1,577 additions and 1,518 deletions.
29 changes: 1 addition & 28 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U coveralls coverage[toml] nox
python -m pip install -U nox
- name: Run tests
run: |
python -m nox --non-interactive --error-on-missing-interpreter \
--session ${{ matrix.session }}-${{ matrix.python-version }}
- name: Combine and upload coverage
run: |
python -m coverage combine
python -m coverage xml -i
python -m coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{matrix.os}}-${{matrix.session}}-${{matrix.python-version}}


tests-pymc:
runs-on: ubuntu-latest
defaults:
Expand Down Expand Up @@ -88,19 +77,3 @@ jobs:
run: |
python -m nox --non-interactive --error-on-missing-interpreter \
--session pymc_mamba-3.10
coverage:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Finish coverage collection
run: |
python -m pip install -U pip
python -m pip install -U coveralls
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 30 additions & 16 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
name: Wheels
on:
release:
types: [published]
push:
branches:
- main
tags:
- "*"
workflow_dispatch:
inputs:
prerelease:
description: "Run a pre-release, testing the build"
required: false
type: boolean
default: false

jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os:
- "ubuntu-22.04"
- "macos-12"
- "macos-14"
- "windows-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: pypa/[email protected]
env:
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}
Expand All @@ -34,28 +44,32 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.9"
- name: Build sdist
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U build
python -m build --sdist .
python -m pip install -U build twine
- name: Build sdist
run: python -m build --sdist .
- name: Check the sdist
run: python -m twine check dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

upload_pypi:
environment:
name: pypi
url: https://pypi.org/p/celerite2
permissions:
id-token: write
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.15...3.27)
project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX)

set(PYBIND11_NEWPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)

include_directories(
"c++/include"
"c++/vendor/eigen"
"python/celerite2")

pybind11_add_module(driver "python/celerite2/driver.cpp")
target_compile_features(driver PUBLIC cxx_std_14)
install(TARGETS driver LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})

pybind11_add_module(backprop "python/celerite2/backprop.cpp")
target_compile_features(backprop PUBLIC cxx_std_14)
install(TARGETS backprop LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})

pybind11_add_module(xla_ops "python/celerite2/jax/xla_ops.cpp")
target_compile_features(xla_ops PUBLIC cxx_std_14)
install(TARGETS xla_ops LIBRARY DESTINATION "${SKBUILD_PROJECT_NAME}/jax")
2 changes: 1 addition & 1 deletion c++/vendor/eigen
Submodule eigen updated from 0fd6b4 to d791d4
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import nox

ALL_PYTHON_VS = ["3.8", "3.9", "3.10"]
TEST_CMD = ["coverage", "run", "-m", "pytest", "-v"]
TEST_CMD = ["python", "-m", "pytest", "-v"]


def _session_run(session, path):
Expand Down
65 changes: 57 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
[build-system]
requires = [
"setuptools>=40.6.0",
"wheel",
"setuptools_scm",
"oldest-supported-numpy",
"pybind11>=2.4",
[project]
name = "celerite2"
description = "Fast and scalable Gaussian Processes in 1D"
authors = [{ name = "Dan Foreman-Mackey", email = "[email protected]" }]
readme = "README.md"
requires-python = ">=3.9"
license = { text = "MIT License" }
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
]
dynamic = ["version"]
dependencies = ["numpy"]

[project.optional-dependencies]
test = ["pytest", "scipy", "celerite"]
pymc3 = ["pymc3>=3.9", "numpy<1.22", "xarray<2023.10.0"]
theano = ["pymc3>=3.9", "numpy<1.22", "xarray<2023.10.0"]
pymc = ["pymc>=5.9.2"]
jax = ["jax"]
docs = [
"sphinx",
"sphinx-material",
"sphinx_copybutton",
"breathe",
"myst-nb",
"matplotlib",
"scipy",
"emcee",
"pymc>=5",
"tqdm",
"numpyro",
]
build-backend = "setuptools.build_meta"
tutorials = ["matplotlib", "scipy", "emcee", "pymc>=5", "tqdm", "numpyro"]

[project.urls]
"Homepage" = "https://celerite2.readthedocs.io"
"Source" = "https://github.com/exoplanet-dev/celerite2"
"Bug Tracker" = "https://github.com/exoplanet-dev/celerite2/issues"

[build-system]
requires = ["scikit-build-core", "numpy", "pybind11"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
sdist.exclude = []
sdist.include = ["python/celerite2/celerite2_version.py"]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm]
write_to = "python/celerite2/celerite2_version.py"

[tool.cibuildwheel]
skip = "pp* *-win32 *-musllinux_* *-manylinux_i686"

[tool.black]
line-length = 79
Expand Down
Loading

0 comments on commit 657d0d7

Please sign in to comment.