Skip to content

fix: improve torch install guidance for uvx/pipx#23

Merged
fmueller merged 2 commits intomainfrom
codex/improve-error-message-for-uvx-and-pipx
Feb 3, 2026
Merged

fix: improve torch install guidance for uvx/pipx#23
fmueller merged 2 commits intomainfrom
codex/improve-error-message-for-uvx-and-pipx

Conversation

@fmueller
Copy link
Owner

Motivation

  • Make the missing-PyTorch error more helpful by including installation hints for users who installed Scribae via uvx or pipx in addition to the existing uv/pip guidance.
  • Ensure the test coverage asserts the new guidance so future regressions are caught.
  • Avoid mypy import errors when torch is absent by loading it dynamically.

Description

  • Updated the error raised in MTTranslator._require_torch in src/scribae/translate/mt.py to include uvx and pipx install instructions alongside the existing uv sync/pip hints.
  • Switched to importlib.import_module("torch") and catch ModuleNotFoundError to keep type checking happy while still raising a helpful RuntimeError when PyTorch is not installed.
  • Updated tests/unit/translate_pipeline_test.py to assert the presence of the new uvx and pipx hints in the missing-PyTorch error.

Testing

  • Ran uv run ruff check and all lint checks passed.
  • Ran uv run mypy and static type checks passed with no issues.
  • Ran uv run pytest and the full test suite passed (160 passed).

Codex Task

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@fmueller fmueller merged commit 83be63a into main Feb 3, 2026
3 checks passed
@fmueller fmueller deleted the codex/improve-error-message-for-uvx-and-pipx branch February 3, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant