feat(as-trim): guarded imports so QUILL-AS can drop unneeded modules - #1099
Merged
Conversation
QUILL-AS (standalone Audio Studio) trims its vendored closure to drop modules a standalone audio tool does not need (Quillins, braille, pandoc, pdf-ocr, node, git, python_sandbox, spellcheck, glow, bw_speech, math). The guarded imports here make those modules safely absent there while remaining fully present and functional in embedded QUILL. - core/speech/quillin_providers.py: guard the quillins.model import (the type ref is stringified under from __future__ import annotations, so it degrades to None with no behavior change when Quillins is absent). - core/speech/cloud_transcribers.py: TRANSCRIPTION_PROVIDER_KINDS now canonical here (the host module present in both repos); quillins/model.py re-exports it for back-compat with Quillin validation. - core/speech/service.py: guard the two bw_speech function-local imports (fallback: no GPU / 0 GB RAM) so the BITS Whisperer probe is optional. - tests: make three source-path tests resolve paths from the imported module __file__ so they survive the quill->quillas vendor rewrite and run unchanged in both QUILL and QUILL-AS. Embedded QUILL unchanged in behavior (guards are no-ops when modules are present; the constant is re-exported with the same value). tests/unit/core green: 6118 passed, 22 skipped. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces import guards and a canonical transcription-provider “kinds” constant to allow a standalone QUILL-AS build to omit certain optional modules (Quillins, bw_speech, etc.) while keeping embedded QUILL behavior unchanged when those modules are present.
Changes:
- Added guarded imports for optional modules (Quillins contributions and
bw_speech) to keep host modules importable in the trimmed standalone build. - Moved
TRANSCRIPTION_PROVIDER_KINDStoquill.core.speech.cloud_transcribersas the canonical host-owned definition, and re-exported it fromquill.core.quillins.modelfor compatibility. - Updated unit tests to use the canonical constant and to skip Quillin-specific tests when Quillins are not present.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/core/test_audio_studio_round3.py | Resolves keymap pack directory via the imported keymap module path (portable between QUILL and standalone vendoring). |
| tests/unit/core/speech/test_quillin_providers.py | Skips Quillin-provider wiring tests when Quillins are absent in the standalone build. |
| tests/unit/core/speech/test_cloud_transcribers.py | Imports TRANSCRIPTION_PROVIDER_KINDS from the new canonical host module location. |
| quill/core/speech/service.py | Guards bw_speech imports for GPU/RAM detection to support a smaller standalone dependency closure. |
| quill/core/speech/quillin_providers.py | Guards Quillin contribution dataclass import so host adapters import without Quillins installed. |
| quill/core/speech/cloud_transcribers.py | Defines canonical TRANSCRIPTION_PROVIDER_KINDS in a host module present in both QUILL and standalone. |
| quill/core/quillins/model.py | Re-exports TRANSCRIPTION_PROVIDER_KINDS to preserve existing Quillin validation imports. |
Comment on lines
+24
to
+27
| try: | ||
| from quill.core.quillins.model import TranscriptionProviderContribution | ||
| except ImportError: # Quillins absent (standalone Audio Studio): no Quillin-contributed providers. | ||
| TranscriptionProviderContribution = None # type: ignore[assignment,misc] |
Comment on lines
+112
to
+115
| try: | ||
| from quill.core.bw_speech import has_nvidia_gpu | ||
| except ImportError: # bw_speech absent (standalone Audio Studio): no CUDA probe. | ||
| return False |
Comment on lines
+193
to
+196
| try: | ||
| from quill.core.bw_speech import total_ram_gb | ||
| except ImportError: # bw_speech absent (standalone Audio Studio): unknown RAM. | ||
| return 0.0 |
Comment on lines
+83
to
+85
| import quill.core.keymap as _keymap_pkg | ||
|
|
||
| pack_dir = Path(_keymap_pkg.__file__).resolve().parent / "keymap" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 1 of the Audio Studio optimization (see
docs/superpowers/specs/2026-07-17-audio-studio-optimization-design.md). Adds guarded imports inquill/so the standalone QUILL-AS can ship a smaller dependency closure (no Quillins, braille, pandoc, glow, math, bw_speech, ...) without changing embedded QUILL behavior. The guards are pure no-ops when the modules are present (i.e. always, in QUILL).Changes
core/speech/quillin_providers.py: guarded top-levelTranscriptionProviderContributionimport (falls back toNonewhen Quillins absent).core/speech/cloud_transcribers.py: canonicalTRANSCRIPTION_PROVIDER_KINDSconstant (lives in the host module present in both QUILL and the standalone).core/quillins/model.py: re-exportsTRANSCRIPTION_PROVIDER_KINDSfor back-compat with Quillin validation.core/speech/service.py: guardedbw_speechimports indetect_has_gpu/detect_total_ram_gb(fallbackFalse/0.0).importorskipthe Quillin test.Verification
ruff checkclean on changed files;mypy quill/core quill/ioclean (565 files).pytest tests/unit/core/ -q: 6118 passed, 22 skipped (guards are no-ops with modules present).Merged via admin bypass per request; Accessibility CI is bypassed here, but the change is additive guards with no behavioral shift in QUILL.
🤖 Generated with Claude Code