What
The dependency check at the top of src/framedex/index_videos.py runs at module import time and calls sys.exit(1) on a missing dependency:
try:
import requests
import whisperx
import yaml
except ImportError as e:
print(f"Missing dependency: {e}", file=sys.stderr)
print("Run: uv pip install -e .", file=sys.stderr)
sys.exit(1)
Because this sits at module top level, it fires the instant anything does import framedex.index_videos — including from framedex.index_videos import some_function.
Why it's a problem
- A module shouldn't terminate the process. A failed import should raise
ImportError and let the caller decide. Here the module unilaterally kills the whole program — that's the application's call, not a library file's.
- The module can't be imported without the full heavy stack. Reusing or testing a single function from
index_videos.py requires whisperx (→ torch, multi-GB) to be installed, even for code paths that never touch it.
- It already forced a workaround. The pure helpers were extracted into
framedex/parsing.py specifically so they could be unit-tested without tripping this sys.exit. The root wart still lives in index_videos.py.
- Now that people are forking and building on framedex, anyone with a partial install or library use case hits an abrupt process exit instead of a clean, catchable error.
Proposed fix
Move the dependency check off module top level. Either:
- Lazy import — import
whisperx etc. inside the functions that use them. Importing the module becomes cheap and safe.
- Or check inside
main() — exiting the process from the CLI entry point is legitimate, because there you are the process.
CLI behavior is unchanged: running fdx with deps missing still prints the same clear error. It just stops being hostile to plain imports.
Severity
Real, not urgent — the CLI works fine today. Worth a clean fix in its own PR. Happy to take this if no one's on it.
What
The dependency check at the top of
src/framedex/index_videos.pyruns at module import time and callssys.exit(1)on a missing dependency:Because this sits at module top level, it fires the instant anything does
import framedex.index_videos— includingfrom framedex.index_videos import some_function.Why it's a problem
ImportErrorand let the caller decide. Here the module unilaterally kills the whole program — that's the application's call, not a library file's.index_videos.pyrequireswhisperx(→ torch, multi-GB) to be installed, even for code paths that never touch it.framedex/parsing.pyspecifically so they could be unit-tested without tripping thissys.exit. The root wart still lives inindex_videos.py.Proposed fix
Move the dependency check off module top level. Either:
whisperxetc. inside the functions that use them. Importing the module becomes cheap and safe.main()— exiting the process from the CLI entry point is legitimate, because there you are the process.CLI behavior is unchanged: running
fdxwith deps missing still prints the same clear error. It just stops being hostile to plain imports.Severity
Real, not urgent — the CLI works fine today. Worth a clean fix in its own PR. Happy to take this if no one's on it.