Skip to content

Suggest using uv pip install to get missing module #1532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jun 16, 2025

Summary by Sourcery

Update missing dependency error messages for Huggingface and ModelScope integrations and refactor exception handling to use a dynamic message method.

Enhancements:

  • Add “uv” to the list of supported pip installation tools in dependency instructions
  • Revise example commands to use “uv pip install ”
  • Replace hardcoded missing-module messages with a call to self.get_missing_message() for consistency

Copy link
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

Copy link
Contributor

sourcery-ai bot commented Jun 16, 2025

Reviewer's Guide

The PR updates both the Huggingface and ModelScope integrations by enhancing the missing-module installation guidance to include “uv pip install” and refactoring error raising to use a centralized get_missing_message() method instead of static strings.

Sequence Diagram: Error Handling for Missing CLI Tools

sequenceDiagram
    actor User
    participant Handler as ModuleHandler
    participant Self as self (ModuleHandler instance)

    User->>Handler: push(args)
    Handler->>Handler: Check if CLI tool is available
    alt CLI tool not available
        Handler->>Self: get_missing_message()
        Self-->>Handler: error_message (with "uv pip install")
        Handler-->>User: raise NotImplementedError(error_message)
    else CLI tool available
        Handler->>Handler: Proceed with push operation
        Handler-->>User: Push successful / other result
    end
Loading

Class Diagram: Updates to Module Handlers

classDiagram
    class HuggingfaceHandler {
        +push(self, _, args)
        +get_missing_message(self) : string
    }

    class ModelscopeHandler {
        +push(self, _, args)
        +get_missing_message(self) : string
    }
Loading

File-Level Changes

Change Details Files
Enhanced install guidance to include uv pip install for missing modules
  • Added “uv” to the list of supported PyPI tools in guidance text
  • Replaced template example commands with “uv pip install ”
ramalama/huggingface.py
ramalama/modelscope.py
Unified missing-module error handling using get_missing_message()
  • Replaced direct references to static missing-module strings in push methods
  • Switched raise NotImplementedError(...) calls to use self.get_missing_message()
ramalama/huggingface.py
ramalama/modelscope.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @rhatdan - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `ramalama/huggingface.py:18` </location>
<code_context>
 missing_huggingface = """
 Optional: Huggingface models require the huggingface-cli module.
-These modules can be installed via PyPi tools like pip, pip3, pipx, or via
+This module can be installed via PyPi tools like uv, pip, pip3, pipx, or via
 distribution package managers like dnf or apt. Example:
-pip install huggingface_hub
+uv pip install huggingface_hub
 """

</code_context>

<issue_to_address>
Remove or clarify the 'uv' prefix around pip commands

The 'uv' prefix may confuse users unless it's intentional. Please use 'pip install huggingface_hub' or explain what 'uv' refers to if it's required.
</issue_to_address>

### Comment 2
<location> `ramalama/modelscope.py:15` </location>
<code_context>
 missing_huggingface = """
 Optional: Huggingface models require the huggingface-cli module.
-These modules can be installed via PyPi tools like pip, pip3, pipx, or via
+This module can be installed via PyPi tools like uv, pip, pip3, pipx, or via
 distribution package managers like dnf or apt. Example:
-pip install huggingface_hub
</code_context>

<issue_to_address>
Remove or clarify the 'uv' prefix around pip commands

The 'uv' prefix may confuse users if not explained. Use 'pip install modelscope' or clarify what 'uv' refers to if it's intentional.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +20
This module can be installed via PyPi tools like uv, pip, pip3, pipx, or via
distribution package managers like dnf or apt. Example:
pip install huggingface_hub
uv pip install huggingface_hub
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Remove or clarify the 'uv' prefix around pip commands

The 'uv' prefix may confuse users unless it's intentional. Please use 'pip install huggingface_hub' or explain what 'uv' refers to if it's required.

Comment on lines +15 to +17
This module can be installed via PyPi tools like uv, pip, pip3, pipx, or via
distribution package managers like dnf or apt. Example:
pip install modelscope
uv pip install modelscope
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Remove or clarify the 'uv' prefix around pip commands

The 'uv' prefix may confuse users if not explained. Use 'pip install modelscope' or clarify what 'uv' refers to if it's intentional.

@rhatdan
Copy link
Member Author

rhatdan commented Jun 16, 2025

@ericcurtin PTAL

@ericcurtin ericcurtin merged commit acc426b into containers:main Jun 16, 2025
15 checks passed
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