Conversation
Replace deprecated pkg_resources with importlib.metadata for package detection and version checking in dependencies.py.
* Fix EngineModesManager test failures - Handle get_current_engine() returning None in constructor - Move manager creation from class scope to setUp for test isolation - Add conftest.py to initialize dragonfly text engine for pytest
…dictation-toolbox#957) FormattingHook.run() treated the event as a dictionary, but HooksRunner passes a RuleActivationEvent object. Access event.rule_class_name and event.active attributes instead.
| _apply_format(pronunciation) | ||
| def run(self, event): | ||
| if event.active: | ||
| _apply_format(event.rule_class_name) |
There was a problem hiding this comment.
Format hook uses class name instead of pronunciation
High Severity
_apply_format(event.rule_class_name) passes the Python class name (e.g., "CPP", "CSharp", "SQL", "Matlab") to _apply_format, but settings.SETTINGS["formats"] is keyed by pronunciation strings (e.g., "C plus plus", "C sharp", "sequel", "matlab"). For any rule where the class name differs from the pronunciation, the lookup silently fails and text formatting is cleared instead of being applied.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63541e38b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dep = dep.split(">=", 1)[0] | ||
| try: | ||
| pkg_resources.require("{}".format(dep)) | ||
| except VersionConflict: | ||
| pass | ||
| except DistributionNotFound: | ||
| missing_list.append('{0}'.format(dep)) | ||
| version(dep) |
There was a problem hiding this comment.
Normalize requirement names before calling metadata lookup
dep_missing() now passes raw requirement strings to importlib.metadata.version(), but only strips ">=" first. Entries like pillow==9.5.0 in requirements.txt and dragonfly2[kaldi] in requirements-mac-linux.txt are not valid distribution names for version(), so they are always treated as missing even when installed. In classic installs this causes persistent false missing-dependency warnings (and the 10-second sleep) on every startup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| missing_list.append('{0}'.format(dep)) | ||
| version(dep) | ||
| except PackageNotFoundError: | ||
| missing_list.append(dep) |
There was a problem hiding this comment.
Version specifier not stripped from package name lookup
High Severity
The dep_missing() function only splits on >= (dep.split(">=", 1)[0]) but requirements.txt also contains == pinned packages like pillow==9.5.0 and pyvda==0.0.8. The old pkg_resources.require() understood version specifiers natively, but importlib.metadata.version() expects a bare package name. Passing "pillow==9.5.0" to version() always raises PackageNotFoundError, causing these installed packages to be falsely reported as missing on every startup (with a 10-second sleep).


This updates the old dictation-toolbox#881 work on top of current upstream/master.
What remains from the original PR:
window switch <windows>window switch showWhat was dropped as redundant with upstream/master:
Verification:
py_compilepassed for the touched filespylint -Epassed for the touched filestests/testrunner.pywas not runnable here because the available local Python is 3.14 and upstreamdragonfly2still relies oninspect.getargspecNote
Medium Risk
Medium risk because it introduces a new background timer/window-enumeration path for navigation commands and changes dependency/version detection logic, which may behave differently across platforms/environments.
Overview
Adds voice commands for keyword-driven window switching (e.g.,
window switch <windows>andwindow switch show) backed by a newwindow_mgmt_rule_support.pythat maintains a liveDictListof open windows via a Dragonfly timer and handles ambiguous/no-match cases.Reworks dependency detection in
dependencies.pyto useimportlib.metadata/packaging.versioninstead ofpkg_resources, updates formatting activation handling to clear formats on deactivation, and makesEngineModesManagertolerate missingget_current_engine()(defaulting totext) with corresponding test harness initialization (tests/conftest.py, test setup).Written by Cursor Bugbot for commit df3c3fd. This will update automatically on new commits. Configure here.