Files
skills-market/plugins/halcon/scripts/check_env.py
T
goldyard2025 3fe919e37c refactor(halcon): single-skill plugin layout → invoke as /halcon (not /halcon:halcon)
Move SKILL.md + references/ scripts/ evals/ from skills/halcon/ up to the
plugin root. Per Claude Code plugins-reference, a plugin with SKILL.md at its
root and no skills/ subdir is auto-loaded as a single-skill plugin (v2.1.142+),
so the invocation name = frontmatter name = halcon → clean /halcon.
Bump plugin.json 2.0.0 → 2.0.1 so existing installs receive the update.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 23:14:39 +08:00

46 lines
1.5 KiB
Python
Executable File

"""Smoke-test the HALCON environment on this machine.
Verifies: the Python binding loads, the native runtime links, the license is
valid (a real operator runs), and HDevEngine imports.
Run (from the project dir, via uv):
/mnt/c/Users/NAURA/.local/bin/uv.exe run python .claude/skills/halcon/scripts/check_env.py
"""
import sys
def main() -> int:
try:
import halcon as ha
except Exception as e: # binding not installed / wrong interpreter
print("FAIL: could not import 'halcon'. Are you running the project venv "
"via uv? Error:", e)
return 1
try:
print("HALCON library version:", ha.get_system("version"))
img = ha.gen_image_const("byte", 64, 48) # exercises the license
w = ha.get_image_size(img)
print("gen_image_const OK, size (w,h):", w)
region = ha.threshold(img, 0, 128)
area, _, _ = ha.area_center(region)
print("threshold + area_center OK, area:", area)
except Exception as e:
print("FAIL: an operator call failed. This is usually a LICENSE problem "
"(missing/expired monthly .dat in <install>\\license\\). Error:", e)
return 2
try:
from halcon.hdevengine import HDevEngine # noqa: F401
print("HDevEngine import OK")
except Exception as e:
print("WARN: HDevEngine import failed:", e)
return 3
print("HALCON environment OK")
return 0
if __name__ == "__main__":
sys.exit(main())