Repository navigation
Conversation
017a91a to
fc9bb71
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes error handling in feast.image_utils when optional image dependencies are missing and enables unit tests to run in minimal environments without integration dependencies.
- Adds
_check_image_dependencies()calls tovalidate_image_formatandget_image_metadatato raise clearImportErrorwhen image dependencies are missing - Adds unit tests to verify optional dependency handling
- Updates test infrastructure to support running unit tests without optional integration/auth dependencies
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/python/feast/image_utils.py | Added dependency checks to image validation and metadata extraction functions |
| sdk/python/tests/unit/test_image_utils_optional_deps.py | New unit tests verifying ImportError behavior when image dependencies are unavailable |
| sdk/python/tests/conftest.py | Wrapped integration and auth test imports in try-except blocks to allow conftest loading without optional dependencies; fixed Windows platform detection |
| sdk/python/pytest.ini | Removed deprecated pytest configuration for pytest 8 compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
35db3ae to
d8fd430
Compare
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com> Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com> Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
…s.py Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
bdd4b82 to
2b2a4f2
Compare
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
|
Good day @franciscojavierarceo |
|
Good day @franciscojavierarceo |
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
|
Hello, |
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
5c29c83 to
5cb5c2e
Compare
|
Hello, |
Resolve the conflicts in sdk/python/pytest.ini, sdk/python/tests/conftest.py and sdk/python/tests/utils/cli_repo_creator.py by taking master's version. Master already makes the integration test dependencies optional during collection (feast-dev#5779) and keeps IS_TEST=True through pytest-env, so the earlier changes to these files are no longer needed. Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>
The extra assertion messages and Path wrapping in default_store are not related to the image utils fix, so keep this PR to its purpose. Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>
…are missing test_image_utils.py imported PIL before its importorskip checks, and test_rag_retriever.py imported torch directly, so collecting the unit tests without the image extras failed with ModuleNotFoundError and pytest exited with an error. Use pytest.importorskip for both so these modules are skipped instead. Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>
|
I merged current master and narrowed this PR. Master already handles the integration test dependencies (#5779), so I dropped my conftest.py, pytest.ini and test utility changes. It now only makes the image utils raise a clear ImportError when the image extras are missing, and skips the image and RAG unit tests when PIL or torch is not installed. Unit tests pass locally. Could a maintainer review this when there is time, and add the ok-to-test label so CI can run? Thanks. |
What this PR does / why we need it:
Without the image extras,
feast.image_utils.validate_image_format()returnedFalsefor any input, andget_image_metadata()raisedValueError: Failed to extract image metadata: name 'Image' is not defined. Neither told the user that a dependency was missing.ImageFeatureExtractoralready checks this and raises a clearImportError.This PR:
_check_image_dependencies()invalidate_image_format()andget_image_metadata(), so both raise the sameImportErrorwhen the image dependencies are not installed (sdk/python/feast/image_utils.py)sdk/python/tests/unit/test_image_utils_optional_deps.py, which covers both functionspytest.importorskipfor PIL insdk/python/tests/unit/test_image_utils.pyand for torch insdk/python/tests/unit/test_rag_retriever.py. Both modules imported these at the top, so collecting the unit tests without the image extras failed withModuleNotFoundError. They are now skipped instead.Master already makes the integration test dependencies optional during collection (#5779), so this PR no longer changes
conftest.py,pytest.inior the test utilities.Which issue(s) this PR fixes:
No linked issue.
Checks
git commit -s)Testing Strategy
Commands run:
make test-python-unit: 4741 passed, 60 skippedpytest sdk/python/tests/unit/test_image_utils_optional_deps.py: fails on master, passes here, both with all dependencies and without the image extraspytest --collect-only sdk/python/tests/unitwithout torch, torchvision, timm, Pillow and scikit-learn: master collects 4773 with 2 errors, this branch collects 4775 with no errorspytest --collect-only sdk/python/tests/unitwith all dependencies: master 4799, this branch 4801 (the 2 new tests)validate_image_format(b"x")andget_image_metadata(b"x")both raiseImportError: Image processing dependencies are not installed...ruff check,ruff format --checkandmypy feast/image_utils.py: cleanMisc
Without torch installed, three unit tests still fail at run time, on master and on this branch:
test_online_retrieval.py::test_get_online_featuresand twoto_tensortests intest_online_response.py. They are not related to image utils, so I left them out of this PR.