Skip to content

chore: bump opencv-python to >=4.10.0 and add cv2 tests#274

Merged
rikunosuke merged 6 commits into
mainfrom
feature/bump-opencv-python
May 19, 2026
Merged

chore: bump opencv-python to >=4.10.0 and add cv2 tests#274
rikunosuke merged 6 commits into
mainfrom
feature/bump-opencv-python

Conversation

@rikunosuke
Copy link
Copy Markdown
Contributor

@rikunosuke rikunosuke commented May 16, 2026

Summary

numpy 2.x 対応(#273)に向けた事前準備の PR。

  • opencv-python 下限を >=4.0.0>=4.10.0 に引き上げ(4.10 系から numpy 2 対応)
  • cv2 を使っている全箇所にテストを追加し、CI(pytest)で動作確認できるよう整備
  • CI ワークフローを lint / test に分割し、pytest を Python 3.9〜3.12 のマトリクスで実行
  • 未使用の aiohttp 依存を削除

Python 3.13 / 3.14 対応と numpy 2.x 両対応マトリクスは、Pillow bump および numpy 制約緩和の後続 PR(#273 のコメント参照)で対応する。

変更点

ファイル 変更内容
pyproject.toml opencv-python>=4.10.0,<5.0.0 / dev = ["pytest>=7.0.0"] / aiohttp 削除
requirements.txt opencv-python>=4.10.0,<5.0.0 / aiohttp 削除
.github/workflows/test.yml lint と test ジョブを分離、Python 3.9〜3.12 マトリクスで pytest 実行
tests/conftest.py(新規) 合成 mp4 を生成する synthetic_video フィクスチャ
tests/test_mask_image_util.py(新規) mask_to_polygon / mask_to_segmentation(9 件)
tests/test_utils.py(新規) is_video_supported_codec(2 件)
tests/test_converters_video.py(新規) VideoCapture ctx / _export_image_files_for_video_file(8 件)
tests/test_lerobot_v3_video.py(新規) _extract_video_segment(3 件)

Test plan

  • pip install -e ".[dev]" で依存解決(opencv-python 4.11.0 が導入されることを確認)
  • python -m pytest tests/ で全 28 件 PASS を確認
  • CI で Python 3.9 / 3.10 / 3.11 / 3.12 すべて PASS を確認

Refs

🤖 Generated with Claude Code

rikunosuke and others added 2 commits May 17, 2026 02:36
#273 関連。numpy 2.x への移行に向けた事前準備として、opencv-python
の下限を引き上げ、numpy 2 対応ビルドを取り込めるようにする。
あわせて cv2 を使用している箇所のテストを追加し、今回のバージョン
アップおよび後続の numpy 移行のセーフティネットとする。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

converters.py の opencv 関連のロジックのテスト

rikunosuke and others added 4 commits May 18, 2026 16:00
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
numpy>=1.26 requires python>=3.9, so 3.8 cannot install the SDK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pillow<11.0.0 has no wheels for python 3.13+, and source build fails on
3.14. Re-add once Pillow constraint is bumped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aiohttp is not imported anywhere in the codebase.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment on lines +44 to +45
python-version: ["3.9", "3.10", "3.11", "3.12"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

3.13/3.14 は Pillow のバージョンが低すぎてインストールできずにエラーとなるため、このPRには含めない

Comment thread pyproject.toml
"xmltodict==0.12.0",
"Pillow>=10.0.0,<11.0.0",
"opencv-python>=4.0.0,<5.0.0",
"aiohttp>=3.8.5"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

aiohttp は使わなくなっていたので削除しています。
aiohttp の非同期処理は colab で使う際にエラーがでるため、過去に使わなくなったと思われます。

@rikunosuke rikunosuke self-assigned this May 19, 2026
@rikunosuke rikunosuke linked an issue May 19, 2026 that may be closed by this pull request
9 tasks
@rikunosuke rikunosuke requested a review from yo-tak May 19, 2026 02:00
Copy link
Copy Markdown

@yo-tak yo-tak left a comment

Choose a reason for hiding this comment

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

LGTM!!

今回の修正とは別スコープですが、uvへ移行する気持ちとかあります?
バージョン変更って破壊的変更が入るなら、ついでに移行しても良いかなというくらいです。

@rikunosuke rikunosuke merged commit a4c8aa0 into main May 19, 2026
5 checks passed
@rikunosuke
Copy link
Copy Markdown
Contributor Author

@yo-tak
ありがとうございます!確かにそうですね。別PRで対応してみようと思います!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

numpy を 2.x 系へアップグレードする

2 participants