Skip to content
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
89 changes: 0 additions & 89 deletions .github/workflows/build.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

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

jobs:

pre-commit:
name: Pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure --color=always

test:
name: Run tests for ${{ matrix.python }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15-intel, macos-14]
python: [cp310, cp311, cp312, cp313, cp314] # no fftw wheel for cp314t

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Build wheel
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_BEFORE_TEST_MACOS: |
# Workaround: pyfftw wheels for Python 3.11/3.12 are incompatible with macOS 15 Intel
# Rebuild from source for these specific versions on macos-15-intel only
if [[ ${{ matrix.os }} == "macos-15-intel" && ${{ matrix.python }} =~ ^cp31[12]$ ]]; then
echo "Rebuilding pyfftw from source for Python ${{ matrix.python }} on macOS 15 Intel (wheel incompatibility)"
brew install fftw libomp
pip uninstall -y pyfftw
pip install --no-binary pyfftw pyfftw
python -c "import pyfftw; print('✓ pyfftw works')"
fi
CIBW_TEST_COMMAND: |
pip uninstall --yes mpi4py
python -c "import pyoperators; print('✓ pyoperators works')"
pytest {project}/tests --cov=pyoperators
pip install mpi4py openmpi
mpirun -np 2 --allow-run-as-root pytest {project}/tests/test_mpi_comms.py
26 changes: 0 additions & 26 deletions .github/workflows/pre-commit.yml

This file was deleted.

96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release to PyPI

on:
release:
types: [published]

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

jobs:

build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check tag of last commit
run: |
echo "Current tag:"
git describe --tags --exact-match HEAD

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Build sdist
run: pipx run build --sdist

- name: Update sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheel for ${{ matrix.python }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15-intel, macos-14]
python: [cp310, cp311, cp312, cp313, cp314] # no fftw wheel for cp314t

steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Build wheel
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_BEFORE_TEST_MACOS: |
# Workaround: pyfftw wheels for Python 3.11/3.12 are incompatible with macOS 15 Intel
# Rebuild from source for these specific versions on macos-15-intel only
if [[ ${{ matrix.os }} == "macos-15-intel" && ${{ matrix.python }} =~ ^cp31[12]$ ]]; then
echo "Rebuilding pyfftw from source for Python ${{ matrix.python }} on macOS 15 Intel (wheel incompatibility)"
brew install fftw libomp
pip uninstall -y pyfftw
pip install --no-binary pyfftw pyfftw
python -c "import pyfftw; print('✓ pyfftw works')"
fi
CIBW_TEST_COMMAND: |
pip install mpi4py openmpi
python -c "import pyoperators; print('✓ pyoperators works')"
mpirun -np 2 --allow-run-as-root pytest {project}/tests/test_mpi_comms.py

- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.python }}-${{ matrix.os }}
path: ./wheelhouse/*.whl

publish:
name: "Publish"
needs: [build_sdist, build_wheels]
permissions:
id-token: write
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: '*'
path: dist
merge-multiple: true

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea/
*.pyc
*.so
.coverage
Expand All @@ -7,7 +8,7 @@ dist
_site
htmlcov
src/pyoperators/utils/cythonutils.c
src/pyoperators/utils/ufuncs.c
__pycache__
*.egg-info
.venv*/
venv*/
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: "v3.3.1"
rev: "v3.21.2"
hooks:
- id: pyupgrade
args: ["--py38-plus"]
args: ["--py310-plus"]

- repo: https://github.com/hadialqattan/pycln
rev: "v2.1.3"
rev: "v2.6.0"
hooks:
- id: pycln
args:
- --all

- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
rev: '7.0.0'
hooks:
- id: isort
args:
- --profile=black

- repo: https://github.com/psf/black
rev: '23.1.0'
rev: '25.11.0'
hooks:
- id: black
args:
- --skip-string-normalization

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v6.0.0'
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -37,7 +37,7 @@ repos:
- id: debug-statements

- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
rev: '7.3.0'
hooks:
- id: flake8
name: flake 8 (src)
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,33 @@ IdentityOperator()

## Requirements

- python 3.8
- Python >= 3.10
- NumPy >= 2.0
- SciPy >= 1.10

Optional requirements:

- PyWavelets: wavelet transforms
- pyfftw: Fast Fourier transforms
- mpi4py: For MPI communication

## Development

To build from source, you'll need:

- Meson >= 1.1.0
- Ninja
- Cython >= 0.29.30
- A C compiler

Build the project:

```bash
pip install -e . --no-build-isolation
```

Or build a wheel:

```bash
python -m build
```
Loading