feat: optional dependency groups for backends#186
Open
sorlen008 wants to merge 1 commit intoabsadiki:mainfrom
Open
feat: optional dependency groups for backends#186sorlen008 wants to merge 1 commit intoabsadiki:mainfrom
sorlen008 wants to merge 1 commit intoabsadiki:mainfrom
Conversation
Move backend-specific dependencies from requirements.txt into [project.optional-dependencies] in pyproject.toml. Users can now install only what they need (e.g. pip install subsai[faster-whisper]) instead of pulling every backend and hitting dependency conflicts. Available extras: whisper, faster-whisper, stable-ts, whisperx, timestamped, whisper-cpp, transformers, api, webui, all Also improves configs.py: broadens except clauses from ImportError to Exception (catches RuntimeError from version mismatches), replaces noisy print(e) with logging.debug, and downgrades the "no models found" fatal error to a warning with install instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Thanks @sorlen008 for the PR! That said, the current approach will make the Docker image useless, since it relies on requirements.txt to install all backends by default. With this change, the image would no longer include the full feature set unless extras are explicitly handled during build. We probably need a way to support both:
|
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.
Summary
[project.optional-dependencies]inpyproject.toml, so users install only what they need instead of every backend at oncepysubs2,ffmpeg-python,ffsubsync,dl-translate,tqdm,numpyconfigs.py: broadenexcept ImportErrortoexcept Exception(catchesRuntimeErrorfrom version mismatches too), replace noisyprint(e)withlogging.debug, downgrade fatal "no models found" error to a helpful warning with install instructionsProblem
This is the #1 user pain point -- 12+ open issues about installation failures because ALL backends are installed even if you only need one. Dependency conflicts between
torch,whisperx,transformers,stable-ts, etc. make a clean install nearly impossible on many systems.Related issues: #132, #171, #169, #164, #116, #115, #101
Solution
PR #176 laid the groundwork by making backends optional at import time (try/except in
configs.py). This PR completes that work by making the pip dependencies optional too via extras.Install examples
Available extras
whisperfaster-whisperstable-tswhisperxtimestampedwhisper-cpptransformersapiwebuiallTest plan
pip install -e .(base only) -- verifyfrom subsai import SubsAIworks with no backends, shows warningpip install -e ".[faster-whisper]"-- verify faster-whisper model loadspip install -e ".[all]"-- verify all models load (same as old behavior)Backward compatibility
pip install subsai[all]reproduces the old behavior exactlyrequirements.txtis kept for reference butpyproject.tomlis now the source of truth for dependenciesconfigs.py(from PR allow working without all backends #176) ensures missing backends are gracefully excluded🤖 Generated with Claude Code