Restructure the 37 root-level Python modules into a proper package:
clipwright/{core,api,pipeline,layouts,media,integrations,tools}
- Rewrite every local import (module-level and deferred) to absolute
clipwright.<group>.<mod> form; no legacy root shims or re-exports.
- Add clipwright/core/paths.py and route fonts/assets/cookies through it.
- Entry points: uvicorn clipwright.api.app:app; jobs run as
python -m clipwright.pipeline.main; probe as -m ...quality_probe.
- child_env() appends REPO_ROOT to PYTHONPATH so the -m workers work.
- transcribe_backends: sys.modules key now clipwright.media.scene_detection.
- Tooling: root pyproject.toml (pytest pythonpath=[.], ruff), shared
requirements-test.txt, CI installs it, Docker PYTHONPATH=/app.
- Tests: all imports/fakes/source-scans repointed; new tests/test_package_layout.py
enforces no root modules, docstring-only __init__, and no legacy imports.
- Docs/comments updated for the new layout.
Backend: 744 passed, 19 skipped. Frontend lint+build green.
32 lines
955 B
Python
32 lines
955 B
Python
import os
|
|
try:
|
|
from clipwright.media.hooks import create_hook_image
|
|
except ImportError:
|
|
print("⚠️ PIL not found locally. Run inside Docker.")
|
|
exit(1)
|
|
|
|
def verify():
|
|
print("🧪 Verifying Hook Customization...")
|
|
test_text = "Custom Position\n& Size Test"
|
|
|
|
# Test 1: Small + Top
|
|
print(" Testing Small + Top...")
|
|
p1, w1, h1 = create_hook_image(test_text, 800, "hook_small.png", font_scale=0.8)
|
|
print(f" ✅ Small: {w1}x{h1}")
|
|
|
|
# Test 2: Large + Center
|
|
print(" Testing Large...")
|
|
p2, w2, h2 = create_hook_image(test_text, 800, "hook_large.png", font_scale=1.3)
|
|
print(f" ✅ Large: {w2}x{h2}")
|
|
|
|
if w2 > w1 and h2 > h1:
|
|
print(" ✅ Scaling logic works (Large > Small)")
|
|
else:
|
|
print(" ❌ Scaling logic failed")
|
|
|
|
# Cleanup
|
|
if os.path.exists(p1): os.remove(p1)
|
|
if os.path.exists(p2): os.remove(p2)
|
|
|
|
if __name__ == "__main__":
|
|
verify()
|