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
14 changes: 10 additions & 4 deletions openpiv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
def test():
import pytest

pytest.main()
from importlib.metadata import version


__version__ = version("OpenPIV")
Comment on lines +1 to +4
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

__version__ = version("OpenPIV") runs at import time and will raise importlib.metadata.PackageNotFoundError when OpenPIV is imported from a source checkout (or other contexts where distribution metadata isn’t installed). That would break import openpiv as well as tutorials/tests that import openpiv indirectly. Consider wrapping the metadata lookup in a try/except and providing a reasonable fallback (e.g., a hardcoded dev version or reading from a local version constant) so the package remains importable without installed metadata.

Suggested change
from importlib.metadata import version
__version__ = version("OpenPIV")
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("OpenPIV")
except PackageNotFoundError:
# Fallback when distribution metadata is not available (e.g., source checkout)
__version__ = "0.25.3"

Copilot uses AI. Check for mistakes.


def test():
import pytest

pytest.main()
2 changes: 1 addition & 1 deletion openpiv/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import matplotlib.pyplot as plt

from openpiv import pyprocess, tools, validation, filters
from importlib_resources import files
from importlib.resources import files

import matplotlib.animation as animation

Expand Down
2 changes: 1 addition & 1 deletion openpiv/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import pathlib
from dataclasses import dataclass
from importlib_resources import files
from importlib.resources import files
from typing import Optional, Tuple, Union
import numpy as np

Expand Down
7 changes: 7 additions & 0 deletions openpiv/test/test_package_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from importlib.metadata import version

import openpiv


def test_package_version_matches_metadata():
assert openpiv.__version__ == version("OpenPIV")
2 changes: 1 addition & 1 deletion openpiv/test/test_piv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for the piv module"""
import numpy as np
import pytest
from importlib_resources import files
from importlib.resources import files
from openpiv import piv, tools
from openpiv.pyprocess import extended_search_area_piv
import matplotlib
Expand Down
2 changes: 1 addition & 1 deletion openpiv/test/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from skimage import img_as_ubyte
from scipy.ndimage import shift as shift_img
# import pkg_resources as pkg
from importlib_resources import files
from importlib.resources import files
from openpiv.pyprocess import extended_search_area_piv as piv
from openpiv.pyprocess import fft_correlate_images, \
correlation_to_displacement
Expand Down
2 changes: 1 addition & 1 deletion openpiv/test/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Testing validation functions """
from typing import Tuple
import numpy as np
from importlib_resources import files
from importlib.resources import files
import matplotlib.pyplot as plt

from openpiv.pyprocess import extended_search_area_piv as piv
Expand Down
2 changes: 1 addition & 1 deletion openpiv/test/test_windef.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pathlib
import numpy as np
import warnings
from importlib_resources import files
from importlib.resources import files
from openpiv import windef
from openpiv.test import test_process
from openpiv.tools import display_vector_field, display_vector_field_from_arrays, save
Expand Down
2 changes: 1 addition & 1 deletion openpiv/test/test_windef_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tempfile
import pathlib
import types
from importlib_resources import files
from importlib.resources import files

from openpiv import windef
from openpiv.settings import PIVSettings
Expand Down
2 changes: 1 addition & 1 deletion openpiv/test/test_windef_detailed.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
import numpy as np
import pathlib
from importlib_resources import files
from importlib.resources import files
import matplotlib.pyplot as plt
import tempfile
import shutil
Expand Down
2 changes: 1 addition & 1 deletion openpiv/tutorials/masking_tutorial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pathlib
from importlib_resources import files
from importlib.resources import files
import numpy as np
import matplotlib.pyplot as plt
from openpiv import tools, scaling, pyprocess, validation, filters,preprocess
Expand Down
2 changes: 1 addition & 1 deletion openpiv/tutorials/tutorial1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from importlib_resources import files
from importlib.resources import files
import numpy as np
from openpiv import tools, pyprocess, scaling, validation, filters

Expand Down
2 changes: 1 addition & 1 deletion openpiv/tutorials/tutorial2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
""" Tutorial of using window deformation multi-pass """
from importlib_resources import files
from importlib.resources import files
from openpiv import tools, pyprocess, validation, filters


Expand Down
2 changes: 1 addition & 1 deletion openpiv/tutorials/windef_tutorial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from importlib_resources import files
from importlib.resources import files
from openpiv import windef


Expand Down
20 changes: 2 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ scikit-image = ">=0.23.0"
scipy = ">=1.11.0"
natsort = ">=8.4.0"
tqdm = ">=4.66.0"
importlib_resources = ">=5.12.0"

[tool.poetry.dev-dependencies]
pytest = "^7.4.3"
Expand Down
1 change: 0 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ requirements:
- scipy
- natsort
- tqdm
- importlib_resources
- arm_pyart
Comment on lines 27 to 30
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

After removing importlib_resources, the codebase now relies on stdlib importlib.resources.files, which is not available on Python 3.7/3.8. This recipe still advertises python >=3.7 (in both build/run requirements), so conda builds or installs on those versions would fail at runtime. Please bump the recipe’s Python minimum to match the project’s supported versions (>=3.10 per pyproject), or alternatively keep a conditional importlib_resources dependency for older Pythons.

Copilot uses AI. Check for mistakes.

test:
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
'scikit-image>=0.23.0',
'scipy>=1.11.0',
'natsort>=8.4.0',
'tqdm>=4.66.0',
'importlib_resources>=5.12.0'
'tqdm>=4.66.0'
],
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

With importlib_resources removed from install_requires, installing via setup.py on older Python versions (e.g., 3.7/3.8) will now succeed but fail at import time because stdlib importlib.resources.files isn’t available there. setup.py currently doesn’t set python_requires, so pip won’t be prevented from installing on unsupported versions. Please add an appropriate python_requires constraint (e.g., >=3.10 to match pyproject) or reintroduce a conditional backport dependency for older Pythons.

Suggested change
],
],
python_requires=">=3.10",

Copilot uses AI. Check for mistakes.
extras_require={"tests": ["pytest"]},
classifiers=[
Expand Down