v1.0.0 - Refactored CLI, PyPI-ready, ClawHub install spec#3
Conversation
Major changes: - Restructured identify_faces.py, enroll_face.py, face_db.py into proper package modules - New unified CLI: sam-faces identify|enroll|list|unknowns - Updated pyproject.toml: v1.0.0, proper entry point, dev dependencies - Added metadata.openclaw.install spec for ClawHub (pip install) - Updated README.md with PyPI badge, quick start, auto-behavior docs - Updated SKILL.md with ClawHub frontmatter and pip installer spec Closes #52535
| created_at TEXT NOT NULL | ||
| ); | ||
|
|
||
| CREATE TABLE IF NOT EXISTS encodings ( |
There was a problem hiding this comment.
Nice refactor overall, but this schema change needs an explicit migration path for existing users. CREATE TABLE IF NOT EXISTS will not add crop_path to an already-existing encodings table, so installs with a pre-1.0.0 database will keep the old schema. Then add_encoding() starts inserting into crop_path and enroll() updates it, which will fail at runtime with no such column: crop_path. For a v1.0.0 release, I’d strongly recommend adding a lightweight migration in init_db() (for example: inspect PRAGMA table_info(encodings) and ALTER TABLE encodings ADD COLUMN crop_path TEXT when missing). — Codex Review 🤖
| sub = parser.add_subparsers(dest="command", help="Command to run") | ||
|
|
||
| # identify | ||
| p_identify = sub.add_parser("identify", aliases=["--photo"], help="Identify faces in a photo") |
There was a problem hiding this comment.
I like the move to subcommands, but this alias probably won’t give you the backward compatibility the PR description implies. In argparse, aliases that start with -/-- are treated as option-like tokens, so sam-faces --photo image.jpg is rejected instead of being routed here. If you want to preserve the old UX, I’d handle --photo as a top-level optional argument (or add a small compatibility shim before subparser dispatch) rather than as a subcommand alias. — Codex Review 🤖
| { | ||
| "emoji": "👤", | ||
| "requires": { "bins": ["sam-faces"] }, | ||
| "requires": { "bins": ["python3"] }, |
There was a problem hiding this comment.
The new install stanza is a good step for ClawHub, but I’d keep sam-faces in requires.bins as well. Right now the skill declares itself satisfied when python3 exists, even though every runtime example depends on the sam-faces executable specifically. Using requires: { bins: ["sam-faces"] } makes capability detection line up with the actual command the skill asks OpenClaw to run. — Codex Review 🤖
jasonacox-sam
left a comment
There was a problem hiding this comment.
Strong direction overall — the package split is much cleaner, the unified CLI is a better shape for PyPI, and the ClawHub install metadata is headed the right way. I left three comments on the places I think matter most before calling this v1.0.0-ready:
- Release blocker: the new
crop_pathcolumn needs a real migration for existing databases, or current users will hit runtime SQL errors when enrolling. - CLI compatibility:
aliases=["--photo"]does not preserve the oldsam-faces --photo ...form underargparse, so the current backward-compat story is weaker than the PR description suggests. - Skill metadata:
requires.binsshould track the actual runtime command (sam-faces), not justpython3, so OpenClaw/ClawHub can detect whether the skill is really installed.
If those are tightened up, I think the overall refactor is a solid step toward a clean 1.0.0 release. — Codex Review 🤖
a0b58fb to
dea5700
Compare
|
All code review comments addressed and tests added: Fixes:
Tests (18 passing):
CI:
Ready for review! 🌟 |
dea5700 to
2028f95
Compare
|
Also dropped Python 3.9 support — it is EOL as of Oct 2025 per the Python dev guide. Minimum version is now 3.10. |
2028f95 to
3377925
Compare
|
Updated Python version support: 3.10-3.13 (dropped EOL 3.9, added current stable 3.13). |
|
🔄 Re-review requested: I'm spawning a GPT 5.4 (Codex) subagent to re-review the updated code with all fixes applied. Will post findings shortly. Previous review items — status:
|
| run: pytest tests/ -v --tb=short | ||
|
|
||
| - name: Check formatting (black) | ||
| run: black --check src/ tests/ |
There was a problem hiding this comment.
Nice catch adding CI, but this path is off for the current repo layout: the package lives under sam_faces/, not src/. Once the test step is green, black --check src/ tests/ will fail with a false negative because src/ does not exist. I'd switch this to black --check sam_faces tests (or just black --check .) so the formatter gate actually covers the packaged code.
— Codex Re-Review 🤖
|
|
||
| from .database import init_db, get_all_encodings, add_person, add_encoding | ||
| from .database import find_person_by_name, list_people, add_unknown | ||
| from .identify import identify, DEFAULT_THRESHOLD |
There was a problem hiding this comment.
One release-risk here: importing sam_faces eagerly imports .identify, which imports face_recognition at module import time. In the GitHub Actions 3.12 run, that blew up during test collection because face_recognition_models still reaches for pkg_resources (ModuleNotFoundError: No module named 'pkg_resources'). That means even lightweight operations like sam-faces list or from sam_faces import list_people can fail before they touch recognition logic.
I'd strongly consider making these heavy imports lazy (e.g. import identify/enroll inside the CLI subcommands, or expose wrappers from __init__ without importing face_recognition up front). That would decouple the database/listing paths from the native recognition stack and make the package much more resilient on Python 3.12/3.13.
— Codex Re-Review 🤖
jasonacox-sam
left a comment
There was a problem hiding this comment.
Re-review summary:
Verified fixes:
- ✅ Pre-v1.0.0 DB migration for
encodings.crop_pathnow works - ✅ Legacy
sam-faces --photo <path>path now works again - ✅
SKILL.mdnow advertisesrequires.bins: ["sam-faces"]
What still needs attention before a 1.0.0 release:
- CI is not actually green yet. The current workflow has a formatter path bug (
src/does not exist) that will fail once tests pass. - Import-time coupling is too eager. Importing
sam_facesimmediately importsface_recognition, which made the Python 3.12 GitHub Actions run die during test collection whenface_recognition_modelstried to importpkg_resources. That makes even non-recognition commands more fragile than they need to be.
Test/CI notes:
- Local
pytestpasses on my machine against the current PR head. - The earlier failing CI runs were useful: they showed the current package still has a real portability problem around import-time dependency loading on Python 3.12.
- Test coverage is materially better now (CLI, DB, migration, identify helpers), which is a good step forward.
Overall: the three previously reported issues look fixed on the current head, but I would not call CI/release readiness done until the workflow path bug and the eager import/runtime fragility are addressed.
— Codex Re-Review 🤖
3377925 to
1c18dbf
Compare
|
📸 Visualize command restored! draws bounding boxes + labels on detected faces. Unknown faces highlighted in red. Good catch, Dad — this is essential for the "who is this?" workflow. |
e2ac25f to
e4e206d
Compare
| detected_at TEXT, resolved INTEGER DEFAULT 0, | ||
| resolved_as TEXT) | ||
| """ | ||
|
|
There was a problem hiding this comment.
General for all files: I think the doc header is helpful for anyone looking at the code. In this one, having the schema at the top is useful for quick understanding as well.
c7943ab to
cd8ac1d
Compare
|
All review comments addressed in this push: Codex review items:
Jason's comment:
Also:
Ready for final review! 🌟 |
d51e799 to
071ebc0
Compare
Major changes: - Restructured identify_faces.py, enroll_face.py, face_db.py into proper package modules - New unified CLI: sam-faces identify|enroll|list|unknowns - Updated pyproject.toml: v1.0.0, proper entry point, dev dependencies - Added metadata.openclaw.install spec for ClawHub (pip install) - Updated README.md with PyPI badge, quick start, auto-behavior docs - Updated SKILL.md with ClawHub frontmatter and pip installer spec Fixes from code review: - Database migration: init_db() adds crop_path column for pre-v1.0.0 databases - CLI backward compatibility: --photo flag routes to identify subcommand - SKILL.md requires.bins restored to [sam-faces] Tests: - test_database.py: 7 tests (person CRUD, encodings, migration) - test_identify.py: 4 tests (no faces, position, file not found, llm_context) - test_cli.py: 6 tests (help, identify, enroll, legacy flag, list, unknowns) CI: - GitHub Actions workflow for testing across Python 3.9-3.12 - Build verification on every PR Closes openclaw/openclaw#52535
071ebc0 to
00d0251
Compare
This PR refactors sam-faces into a proper Python package with a unified CLI, making it ready for PyPI and ClawHub.
Changes
Breaking Changes
Testing
Closes openclaw/openclaw#52535
cc @jasonacox