Skip to content

John/make-torch-import-optional#423

Merged
johnwalz97 merged 2 commits intomainfrom
john/make-torch-import-optional
Sep 10, 2025
Merged

John/make-torch-import-optional#423
johnwalz97 merged 2 commits intomainfrom
john/make-torch-import-optional

Conversation

@johnwalz97
Copy link
Contributor

@johnwalz97 johnwalz97 commented Sep 10, 2025

Pull Request Description

What and why?

Hotfix to make the torch import optional.

How to test

What needs special review?

Dependencies, breaking changes, and deployment notes

Release notes

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

@github-actions
Copy link
Contributor

PR Summary

This PR improves the way the torch library is imported within the client module. Instead of directly importing torch, the code now wraps the import in a try/except block. If torch fails to import (for instance, if it's not installed), the module gracefully sets torch to None, preventing potential runtime errors. This change aims to improve the overall robustness and flexibility of the client, especially in environments where torch might be unavailable. Note that version bumps in metadata files are considered non-functional changes and are not detailed here.

Test Suggestions

  • Test the client module in an environment where torch is installed to verify normal functionality.
  • Simulate an environment without torch (or force an ImportError) and ensure that the client handles the absence of torch gracefully by setting it to None.
  • Check that downstream functions that depend on torch either operate correctly or fail with clear error messages when torch is unavailable.

@johnwalz97 johnwalz97 merged commit b07b3bf into main Sep 10, 2025
16 of 18 checks passed
@johnwalz97 johnwalz97 deleted the john/make-torch-import-optional branch September 10, 2025 18:19
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