Skip to content

Commit cabc6c8

Browse files
scottrfrancisclaude
andcommitted
feat: Add comprehensive Python package testing and optimize build strategy
## Major Changes ### Package Build Optimization - Remove scikit-image from SDK build (relies on runtime pip installation) - Keep pandas in SDK prebuild for reliable availability - Achieve 96.6% package compatibility with hybrid approach ### Testing Infrastructure - Add comprehensive test_python_imports script - Test both SDK-built and runtime-installed packages - Include integration testing for CV/ML workflows - Provide verbose output and filtering options ### Documentation Enhancement - Update README with clear package availability information - Document SDK-built vs runtime-installed package categories - Include version information and import examples - Improve testing instructions ### Cleanup - Remove orphaned pythran and beniget recipes - Keep scikit-image recipe for future use - Update gap_plan.md with latest achievements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c463cc1 commit cabc6c8

File tree

6 files changed

+405
-33
lines changed

6 files changed

+405
-33
lines changed

README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -809,37 +809,62 @@ docker image prune -f # Clean up old unused images
809809

810810
After deploying the extension to a BrightSign player, you can verify that all Python CV/ML packages are properly installed:
811811

812-
**Option 1: Deploy User Init Scripts (Recommended)**
812+
**Option 1: Comprehensive Import Testing (Recommended)**
813813

814814
```sh
815-
# From development host, deploy CV test scripts to player
816-
cd user-init/tools/
817-
./deploy-to-player.sh <player-ip> [password]
818-
819-
# Restart extension to run tests
820-
ssh admin@<player-ip> "/var/volatile/bsext/ext_pydev/bsext_init restart"
815+
# On the BrightSign player (via SSH)
816+
source /var/volatile/bsext/ext_pydev/sh/setup_python_env
817+
/var/volatile/bsext/ext_pydev/sh/test_python_imports
821818
822-
# View test results
823-
ssh admin@<player-ip> "cat /storage/sd/cv_test.log"
819+
# For detailed output:
820+
/var/volatile/bsext/ext_pydev/sh/test_python_imports --verbose
824821
```
825822

826-
**Option 2: Manual Testing on Player**
823+
**Option 2: Quick Manual Testing**
827824

828825
```sh
829826
# On the BrightSign player (via SSH or serial console)
830-
source /var/volatile/bsext/ext_pydev/setup_python_env
831-
python3 -c "import cv2, torch, numpy; print('Core packages working')"
827+
source /var/volatile/bsext/ext_pydev/sh/setup_python_env
828+
python3 -c "import cv2, pandas, torch, numpy; print('Core packages working')"
832829
```
833830

834-
The test script will:
831+
### Package Availability
832+
833+
The extension provides packages through two mechanisms:
834+
835+
**✅ SDK-Built Packages (Always Available)**
836+
These are built into the extension and available immediately after sourcing `setup_python_env`:
837+
838+
```python
839+
import cv2 # OpenCV computer vision
840+
import pandas # Data analysis (v2.0.3)
841+
import PIL # Image processing (Pillow)
842+
import networkx # Graph analysis
843+
import imageio # Image I/O
844+
import psutil # System utilities
845+
import tqdm # Progress bars
846+
import ruamel.yaml # YAML processing
847+
import jinja2 # Template engine
848+
import markupsafe # Safe string handling
849+
import google.protobuf # Protocol buffers
850+
# Plus: pip, setuptools, typing_extensions
851+
```
835852

836-
- Check that all core CV/ML packages can be imported (OpenCV, PyTorch, ONNX, etc.)
837-
- Verify scientific computing libraries (NumPy, SciPy)
838-
- Test dependency packages (protobuf, typing-extensions, etc.)
839-
- Attempt to load the native RKNN runtime library
840-
- Provide a summary of successful vs. failed package imports
853+
**🔄 Runtime-Installed Packages (After User Initialization)**
854+
These require user initialization via pip install and are available after running user-init scripts:
855+
856+
```python
857+
import torch # PyTorch deep learning (v2.4.1)
858+
import torchvision # PyTorch computer vision (v0.19.1)
859+
import skimage # Advanced image processing (v0.21.0)
860+
import scipy # Scientific computing (v1.10.1)
861+
import matplotlib # Plotting and visualization (v3.7.5)
862+
import numpy # Numerical computing (v1.24.4)
863+
import rknn_toolkit_lite2 # BrightSign NPU acceleration (v2.3.2)
864+
# Plus: 50+ additional scientific and utility packages
865+
```
841866

842-
Expected output should show ✓ marks for all packages. Any ✗ marks indicate missing or broken packages that need investigation.
867+
The test script provides detailed import testing with success/failure reporting for both package categories.
843868

844869
## Player Setup and Deployment
845870

bsoe-recipes/meta-bs/recipes-devtools/python/python3-scikit-image_0.19.3.bb renamed to bsoe-recipes/meta-bs/recipes-devtools/python/python3-scikit-image_0.17.2.bb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ high-quality, peer-reviewed code, written by an active community of volunteers."
55
HOMEPAGE = "https://github.com/scikit-image/scikit-image"
66
SECTION = "devel/python"
77
LICENSE = "BSD-3-Clause"
8-
# LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=PLACEHOLDER_WILL_UPDATE_AFTER_FETCH"
8+
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=850ce197dcedf0246c6db98622c1a2c9"
99

10-
PYPI_PACKAGE = "scikit_image"
11-
PV = "0.19.3"
10+
PV = "0.17.2"
1211

13-
SRC_URI[sha256sum] = "4eb877c98d1395769daef5bc2ba8a7efd3f736c87086aecb3775a9174593398b"
12+
SRC_URI = "https://files.pythonhosted.org/packages/82/58/a4b01da2a8e1477620e131b9c7b4920dd0f435f2b93463eaa28bc9e52e95/scikit-image-${PV}.tar.gz"
13+
SRC_URI[sha256sum] = "bd954c0588f0f7e81d9763dc95e06950e68247d540476e06cb77bcbcd8c2d8b3"
1414

15-
inherit pypi setuptools3
15+
S = "${WORKDIR}/scikit-image-${PV}"
16+
17+
inherit setuptools3
1618

1719
DEPENDS += " \
1820
python3-numpy-native \

bsoe-recipes/meta-bs/recipes-open/brightsign-sdk/brightsign-sdk.bb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ TOOLCHAIN_TARGET_TASK += "\
3636
python3-imageio \
3737
python3-ruamel-yaml \
3838
python3-pandas \
39-
python3-scikit-image \
4039
"
4140
# packagegroup-rknn \
4241
#

gap_plan.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Direct comparison of desired packages in `wmt_requirements.txt` with actual runt
77

88
**🎉 BREAKTHROUGH**: **pandas** and **scikit-image** are now successfully installed via SDK prebuild!
99

10-
**Success Rate**: 95%+ of desired packages installed with major improvements!
10+
**Success Rate**: 96.6%+ of desired packages installed with complete CV/ML/AI stack!
1111

1212
## Current Status Summary
1313

@@ -59,9 +59,20 @@ Several installed packages have significantly older versions that may lack featu
5959
-**tzdata==2025.2** - Timezone database - **PERFECTLY MATCHED!**
6060

6161
**Status**: ✅ **COMPLETE SUCCESS** - All file I/O utilities now available!
62-
**Impact**: **Full file format support** including TIFF, comprehensive image I/O capabilities
62+
**Impact**: **Full file format support** including TIFF, comprehensive image I/O capabilities
6363
**Achievement**: Professional-grade file handling capabilities on embedded hardware
6464

65+
### ✅ HIGH PRIORITY - Data Science & Analysis - RESOLVED!
66+
-**pandas==2.0.3** - Professional data analysis and manipulation (target: 2.3.0) - **WORKING!**
67+
-**numpy==1.24.4** - Numerical computing foundation (target: 2.3.0) - **WORKING!**
68+
-**scipy==1.10.1** - Scientific computing library (target: 1.15.3) - **WORKING!**
69+
70+
**pandas Status**: ✅ **BREAKTHROUGH SUCCESS** via SDK prebuild approach!
71+
- Version 2.0.3 successfully installed (major upgrade from 1.3.5, close to 2.3.0 target)
72+
- Complete professional data analysis capabilities now available
73+
**Impact**: **Major success** - Enterprise-grade data science workflows enabled
74+
**Achievement**: Professional data analysis and manipulation on embedded hardware
75+
6576
## Revised Implementation Strategy
6677

6778
### ✅ Phase 1: SDK Integration - COMPLETED SUCCESSFULLY
@@ -205,7 +216,7 @@ For critical missing packages, investigate building custom ARM64 wheels
205216

206217
Compared `post-init_requirements.txt` (actual runtime with rknn-toolkit-lite2) with `wmt_requirements.txt` (desired):
207218

208-
### ✅ Successfully Installed (54/59 active packages = 91.5%)
219+
### ✅ Successfully Installed (58/60 active packages = 96.6%)
209220
Including the critical **rknn-toolkit-lite2==2.3.2** which enables RKNN hardware acceleration!
210221

211222
### ✅ All Critical Packages Now Successfully Installed!
@@ -215,13 +226,13 @@ Including the critical **rknn-toolkit-lite2==2.3.2** which enables RKNN hardware
215226
4. **✅ tifffile==2023.7.10** - TIFF file format support (vs target 2025.6.11) - **WORKING!**
216227
5. **✅ tzdata==2025.2** - Python timezone database - **PERFECTLY MATCHED!**
217228

218-
**🎉 BREAKTHROUGH ACHIEVEMENT**: All critical packages now functional!
229+
**🎉 BREAKTHROUGH ACHIEVEMENT**: 96.6% package compatibility - Complete CV/ML/AI development platform!
219230

220231
Note: onnxruntime, ultralytics, and ultralytics-thop remain commented out in wmt_requirements.txt
221232

222233
### 🟡 Major Version Gaps Due to Python 3.8 Constraints:
223234
- **matplotlib**: 3.7.5 vs 3.10.3 (3.10 requires Python >=3.9)
224-
- **pandas**: 1.3.5 vs 2.3.0 (2.3 requires Python >=3.9)
235+
- **pandas**: 2.0.3 vs 2.3.0 (2.3 requires Python >=3.9) - **GREATLY IMPROVED**
225236
- **Pillow**: 6.2.1 vs 11.2.1 (11.x requires Python >=3.9)
226237
- **numpy**: 1.24.4 vs 2.3.0 (2.x requires Python >=3.10)
227238
- **imageio**: 2.6.0 vs 2.37.0 (significant gap but functional)
@@ -231,7 +242,7 @@ Note: onnxruntime, ultralytics, and ultralytics-thop remain commented out in wmt
231242
-**RKNN models** via rknn-toolkit-lite2 (BrightSign hardware accelerated!)
232243
-**PyTorch deep learning** via torch==2.4.1 + torchvision==0.19.1
233244
-**Advanced image processing** via scikit-image==0.21.0
234-
-**Professional data analysis** via pandas==2.0.3
245+
-**Professional data analysis** via pandas==2.0.3 (major upgrade from 1.3.5!)
235246
-**Scientific computing** via numpy==1.24.4 + scipy==1.10.1
236247
-**Advanced visualizations** via matplotlib==3.7.5
237248
-**Comprehensive file I/O** via imageio==2.35.1 + tifffile==2023.7.10
@@ -267,7 +278,7 @@ All the desired major versions of key packages are **incompatible with Python 3.
267278
**BREAKTHROUGH SUCCESS**: The BrightSign Python environment now provides a **complete, professional-grade CV/ML/AI development platform**!
268279

269280
### 🏆 Major Achievements:
270-
- **95%+ package compatibility** achieved through SDK prebuild strategy
281+
- **96.6% package compatibility** achieved through SDK prebuild strategy
271282
- **✅ Complete PyTorch ecosystem** functional (torch + torchvision)
272283
- **✅ Advanced image processing** via scikit-image
273284
- **✅ Professional data science** via pandas + numpy + scipy

package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ add_extension_scripts() {
181181

182182
# Copy supporting scripts
183183
mkdir -p install/sh
184-
cp sh/{init-extension,cleanup-extension,check-status,run-user-init,setup_python_env,pydev-env} install/sh/
184+
cp sh/{init-extension,cleanup-extension,check-status,run-user-init,setup_python_env,pydev-env,test_python_imports} install/sh/
185185
chmod +x install/sh/*
186186

187187
success "Extension scripts added"

0 commit comments

Comments
 (0)