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
34 changes: 17 additions & 17 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ OpenPIV is a Python library for Particle Image Velocimetry (PIV) analysis of flu

### Bootstrap and Install Dependencies
- **Primary method (recommended)**: Use Poetry for development:
- Install Poetry: `pip install poetry`
- Install dependencies: `poetry install` -- takes ~10 seconds. NEVER CANCEL.
- All development commands should use `poetry run <command>`
- Install uv: see https://docs.astral.sh/uv/getting-started/installation/
- Install dependencies: `uv sync` (or `uv pip install -e .`) -- fast.
- Use `uv run <command>` or an activated virtual environment

### Alternative Installation Methods
- **From PyPI**: `pip install openpiv` -- takes ~33 seconds. NEVER CANCEL.
- **From conda-forge**: `conda install -c conda-forge openpiv` -- takes ~46 seconds. NEVER CANCEL.
- **Build from source**: `python setup.py build_ext --inplace` -- takes <1 second (no Cython extensions in current setup)

### Build and Test the Repository
- **Run tests**: `poetry run pytest openpiv -v` -- takes ~10 seconds, 216 tests pass. NEVER CANCEL. Set timeout to 30+ minutes for safety.
- **Test import**: `poetry run python -c "import openpiv; print('OpenPIV imported successfully')"`
- **Test core functionality**: `poetry run python -c "import openpiv.piv as piv; import numpy as np; frame_a = np.random.rand(64, 64); frame_b = np.random.rand(64, 64); result = piv.simple_piv(frame_a, frame_b, plot=False); print('PIV analysis completed, returned:', len(result), 'outputs')"`
- **Run tests**: `uv run pytest openpiv -v` -- tests should pass quickly. Set appropriate timeout for CI.
- **Test import**: `uv run python -c "import openpiv; print('OpenPIV imported successfully')"`
- **Test core functionality**: `uv run python -c "import openpiv.piv as piv; import numpy as np; frame_a = np.random.rand(64, 64); frame_b = np.random.rand(64, 64); result = piv.simple_piv(frame_a, frame_b, plot=False); print('PIV analysis completed, returned:', len(result), 'outputs')"`

### Run Example Workflows
- **Tutorial 1**: `poetry run python openpiv/tutorials/tutorial1.py` -- demonstrates complete PIV analysis workflow
- **Tutorial 1**: `uv run python openpiv/tutorials/tutorial1.py` -- demonstrates complete PIV analysis workflow
- **Test data location**: `openpiv/data/test1/` contains sample image pairs (`exp1_001_a.bmp`, `exp1_001_b.bmp`)

## Validation

### ALWAYS run these validation steps after making changes:
1. **Import test**: Verify basic import works: `poetry run python -c "import openpiv"`
1. **Import test**: Verify basic import works: `uv run python -c "import openpiv"`
2. **Core functionality test**: Run simple PIV analysis to ensure algorithms work
3. **Full test suite**: `poetry run pytest openpiv -v` -- NEVER CANCEL, takes ~10 seconds but allow 30+ minutes timeout
4. **Tutorial execution**: Run `poetry run python openpiv/tutorials/tutorial1.py` to test complete workflow
3. **Full test suite**: `uv run pytest openpiv -v`
4. **Tutorial execution**: Run `uv run python openpiv/tutorials/tutorial1.py` to test complete workflow

### Critical User Scenarios to Test
After making changes, ALWAYS test these scenarios:
Expand All @@ -43,7 +43,7 @@ After making changes, ALWAYS test these scenarios:

### CI/CD Validation
- The repository has GitHub Actions workflows in `.github/workflows/`:
- `testing.yml`: Runs tests on Python 3.10, 3.11, 3.12, 3.13, 3.14 with Poetry
- `testing.yml`: Runs tests on Python 3.11, 3.12, 3.13, 3.14 with Poetry
- `build.yml`: Builds and publishes to PyPI on releases triggered by version tags
- No linting tools are configured (no black, flake8, etc.)

Expand Down Expand Up @@ -101,27 +101,27 @@ s.num_iterations = 3
- **Dependencies**: Managed via Poetry (`pyproject.toml`); fallback setuptools config in `setup.py`
- **Package name**: `"OpenPIV"` (capital letters on PyPI, lowercase `openpiv` as import)
- **Version**: `0.25.4` (defined in both `pyproject.toml` and `setup.py`; runtime via `importlib.metadata`)
- **Python support**: 3.10, 3.11, 3.12, 3.13, 3.14
- **Python support**: 3.11, 3.12, 3.13, 3.14
- **Key dependencies**: numpy ≥2.0, scipy ≥1.11, scikit-image ≥0.23, matplotlib ≥3.8, imageio ≥2.35, natsort, tqdm

### Development Notes
- **No Cython extensions**: Although the package description still mentions "Cython modules" (legacy), all Cython (`.pyx`) files have been removed and converted to pure Python. `python setup.py build_ext --inplace` takes <1 second with nothing to compile.
- Uses stdlib `importlib.resources.files()` (NOT the third-party `importlib_resources`) to locate bundled data
- Test configurations in `openpiv/test/conftest.py` disable matplotlib GUI (uses `Agg` backend, patches `plt.show`)
- Sample data bundled at `openpiv/data/test1/`; accessed via `files('openpiv.data').joinpath('test1/...')`
- `pyproject.toml` still uses the deprecated `[tool.poetry.dev-dependencies]` section; this generates a warning but is harmless
- Project uses `uv` and PEP 621 `pyproject.toml` (`hatchling` build backend).
- Documentation built with Sphinx (source in `openpiv/docs/`)
- External examples repository: [OpenPIV-Python-Examples](https://github.com/OpenPIV/openpiv-python-examples)

### Common Command Reference
```bash
# Development setup
poetry install # ~10 seconds
poetry run pytest openpiv -v # ~10 seconds, 216 tests pass
uv sync # install dependencies
uv run pytest openpiv -v

# Testing functionality
poetry run python openpiv/tutorials/tutorial1.py # Complete PIV workflow
poetry run python -c "import openpiv.piv as piv; ..." # API test
uv run python openpiv/tutorials/tutorial1.py
uv run python -c "import openpiv.piv as piv; ..." # API test

# Alternative installs
pip install openpiv # ~33 seconds
Expand Down
35 changes: 28 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# Dependabot configuration
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
groups:
python-dependencies:
patterns:
- "*"
open-pull-requests-limit: 5

- package-ecosystem: "cargo"
directory: "/crates/openpiv_rust"
schedule:
interval: "weekly"
groups:
rust-dependencies:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved

steps:
- uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist -i python3.10 python3.11 python3.12 python3.13 --manifest-path crates/openpiv_rust/Cargo.toml
args: --release --out dist -i python3.11 python3.12 python3.13 python3.14 --manifest-path crates/openpiv_rust/Cargo.toml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Rust extra lacks platform wheels

When a user on Windows or macOS installs the optional Rust extra with Python 3.11, 3.13, or 3.14, the Windows and macOS Maturin jobs still build only for Python 3.12. Because the extension does not enable PyO3’s stable ABI, those jobs produce cp312-only wheels, leaving users on Python 3.11, 3.13, or 3.14 without an installable Rust extra on those platforms.

Build and publish compatible Rust wheels for each supported Python version on Windows and macOS, or configure and verify stable-ABI wheels.

Prompt for AI agents
In `.github/workflows/wheels.yml` at line 44:

**Rust extra lacks platform wheels**

When a user on Windows or macOS installs the optional Rust extra with Python 3.11, 3.13, or 3.14, the Windows and macOS Maturin jobs still build only for Python 3.12. Because the extension does not enable PyO3’s stable ABI, those jobs produce `cp312`-only wheels, leaving users on Python 3.11, 3.13, or 3.14 without an installable Rust extra on those platforms.

Build and publish compatible Rust wheels for each supported Python version on Windows and macOS, or configure and verify stable-ABI wheels.

sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
- name: Upload wheels
Expand Down
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Downloads the code from PyPI and runs the setup for you with installation and Cy
Use Poetry
================

poetry add openpiv
uv add openpiv


Bleeding edge development version
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Use PyPI: <https://pypi.python.org/pypi/OpenPIV>:

pip install openpiv

### Or [Poetry](https://python-poetry.org/)
### Or with [uv](https://docs.astral.sh/uv/)

poetry add openpiv
uv add openpiv

### Note on Conda/Anaconda

Expand Down
2 changes: 1 addition & 1 deletion openpiv/docs/src/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ You do not need a Rust compiler installed. Simply install OpenPIV in editable mo

.. code-block:: bash

poetry install
uv sync
# or: pip install -e .

All core functionality, single-pass, and multi-pass deformation will use the optimized
Expand Down
4 changes: 2 additions & 2 deletions openpiv/windef.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def process_image_pair(args, settings, save_path):
v, s=settings.smoothn_p
)
if not isinstance(u, np.ma.MaskedArray):
raise TypeError("not a masked array anymore")
raise ValueError("not a masked array anymore")

if image_mask is not None:
# grid_mask = preprocess.prepare_mask_on_grid(x, y, mask_coords)
Expand Down Expand Up @@ -652,7 +652,7 @@ def multipass_img_deform(
"""

if not isinstance(u_old, np.ma.MaskedArray):
raise TypeError("Expected masked array")
raise ValueError("Expected masked array")

# calculate the y and y coordinates of the interrogation window centres.
# Hence, the
Expand Down
Loading
Loading