Skip to content

Commit

Permalink
Adding support for Python 3.10 and updating test infrastructure (#63)
Browse files Browse the repository at this point in the history
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 Jan 11, 2022
1 parent f39e848 commit de61a55
Show file tree
Hide file tree
Showing 21 changed files with 260 additions and 223 deletions.
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

13 changes: 10 additions & 3 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: C++

on:
push:
branches: [main]
branches:
- main
tags:
- "*"
paths-ignore:
- "docs/**"
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
138 changes: 49 additions & 89 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,74 @@
name: Python
on:
push:
branches: [main]
branches:
- main
tags:
- "*"
paths-ignore:
- "docs/**"
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9"]
extras: ["core", "jax", "pymc3"]
include:
- python-version: "3.10"
extras: "core"

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
submodules: true

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: ilammy/msvc-dev-cmd@v1
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -e ".[test]"
env:
DISTUTILS_USE_SDK: 1
MSSdk: 1
- name: Run the unit tests
run: python -m pytest --cov celerite2 python/test
- name: Coveralls
if: startsWith(matrix.os, 'ubuntu')
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: Unit Tests

theano:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
auto-update-conda: true
- name: Install dependencies
shell: bash -l {0}
run: |
conda install -q numpy scipy theano mkl-service
python -m pip install -U pip
python -m pip install --use-feature=2020-resolver -e ".[test,theano]"
- name: Get theano compiledir
id: compiledir
shell: bash -l {0}
run: |
python -c "import theano; print('::set-output name=compiledir::' + theano.config.compiledir.split('/')[-1])"
- name: "Cache ~/.theano"
uses: actions/cache@v2
with:
path: ~/.theano
key: theano-${{ steps.compiledir.outputs.compiledir }}-${{ hashFiles('python/test/theano/*.py') }}
restore-keys: |
theano-${{ steps.compiledir.outputs.compiledir }}-
theano-
- name: Run the unit tests
shell: bash -l {0}
run: python -m pytest --cov celerite2 python/test/theano
- name: Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: Unit Tests
python -m pip install -U coveralls coverage[toml] tox tox-gh-actions pybind11
jax:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
auto-update-conda: true
- name: Install dependencies
shell: bash -l {0}
- name: Run tests
run: python -m tox
env:
EXTRAS: ${{ matrix.extras }}

- name: Combine and upload coverage
run: |
python -m pip install -U pip
python -m pip install --use-feature=2020-resolver -e ".[test,jax]"
- name: Run the unit tests
shell: bash -l {0}
run: python -m pytest --cov celerite2 python/test/jax
- name: Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: Unit Tests
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: py${{ matrix.python-version }}-${{ matrix.extras }}

coverage:
needs: [build, theano, jax]
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@v20201129
- name: Setup Python
uses: actions/setup-python@v2
with:
parallel-finished: true
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 }}
5 changes: 5 additions & 0 deletions .github/workflows/tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
notebooks:
name: "Build the notebooks for the docs"
Expand All @@ -27,6 +31,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install "numpy<1.22"
python -m pip install ".[tutorials]"
- name: Get theano compiledir
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ jobs:
with:
submodules: true
fetch-depth: 0
- uses: ilammy/msvc-dev-cmd@v1
- uses: joerick/cibuildwheel@v1.9.0
- uses: pypa/cibuildwheel@v2.3.1
env:
CIBW_BUILD: "cp3?-*"
CIBW_SKIP: "cp35-* *-win32 *-manylinux_i686"
CIBW_SKIP: "pp* *-win32 *-manylinux_i686 *-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
DISTUTILS_USE_SDK: 1
MSSdk: 1
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ dist
.envrc
.coverage
*.ipynb
.coverage*
.eggs
.tox
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
26 changes: 24 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=40.6.0", "wheel", "setuptools_scm", "numpy>=1.13.0", "pybind11>=2.4"]
requires = ["setuptools>=40.6.0", "wheel", "setuptools_scm", "oldest-supported-numpy", "pybind11>=2.4"]
build-backend = "setuptools.build_meta"

[tool.black]
Expand Down Expand Up @@ -28,5 +28,27 @@ use_parentheses = true
known_third_party = ["numpy"]

[tool.pytest.ini_options]
norecursedirs = "python/test/*"
addopts = "-v"

[tool.coverage.run]
parallel = true
branch = true
source = ["celerite2"]
omit = [
"*_test.py",
"*__init__*",
"*/celerite2/celerite2_version.py",
]

[tool.coverage.paths]
source = ["python", "*/site-packages"]

[tool.coverage.report]
show_missing = true
exclude_lines = [
"raise NotImplementedError",
"except ImportError",
"pragma: no cover",
"def R_op",
"if verbose"
]
Loading

0 comments on commit de61a55

Please sign in to comment.