Skip to content

feat(as-trim): guarded imports so QUILL-AS can drop unneeded modules - #1099

Merged
accesswatch merged 1 commit into
mainfrom
feature/as-trim
Jul 17, 2026
Merged

feat(as-trim): guarded imports so QUILL-AS can drop unneeded modules#1099
accesswatch merged 1 commit into
mainfrom
feature/as-trim

Conversation

@accesswatch

Copy link
Copy Markdown
Contributor

What

Phase 1 of the Audio Studio optimization (see docs/superpowers/specs/2026-07-17-audio-studio-optimization-design.md). Adds guarded imports in quill/ 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-level TranscriptionProviderContribution import (falls back to None when Quillins absent).
  • core/speech/cloud_transcribers.py: canonical TRANSCRIPTION_PROVIDER_KINDS constant (lives in the host module present in both QUILL and the standalone).
  • core/quillins/model.py: re-exports TRANSCRIPTION_PROVIDER_KINDS for back-compat with Quillin validation.
  • core/speech/service.py: guarded bw_speech imports in detect_has_gpu / detect_total_ram_gb (fallback False / 0.0).
  • Tests updated to import the canonical constant and importorskip the Quillin test.

Verification

  • ruff check clean on changed files; mypy quill/core quill/io clean (565 files).
  • pytest tests/unit/core/ -q: 6118 passed, 22 skipped (guards are no-ops with modules present).
  • QUILL-AS standalone suite (separate repo, vendored from this): 888 passed, 2 skipped with these guards + the trimmed closure.

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

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>
@accesswatch
accesswatch requested a review from kellylford as a code owner July 17, 2026 16:05
Copilot AI review requested due to automatic review settings July 17, 2026 16:05
@accesswatch
accesswatch merged commit 63da74f into main Jul 17, 2026
16 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_KINDS to quill.core.speech.cloud_transcribers as the canonical host-owned definition, and re-exported it from quill.core.quillins.model for 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"
@accesswatch
accesswatch deleted the feature/as-trim branch July 20, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants