Skip to content

Added local-runner requirements validation step #712

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 3 commits into from
Jul 22, 2025

Conversation

mogith-pn
Copy link
Contributor

PR link - https://clarifai.atlassian.net/browse/PR-742

This pull request introduces enhancements to the clarifai/cli/model.py and clarifai/utils/cli.py files, focusing on improving dependency checks, model customization, and error handling for the Ollama toolkit. The most significant changes include the addition of utility functions for verifying prerequisites, relocating the customize_ollama_model function, and enhancing validation logic for toolkit-specific operations.

Enhancements for dependency and toolkit checks:

  • Added check_ollama_installed function to verify if the Ollama CLI is installed. This function is now used in the init command to prevent execution when Ollama is missing. (clarifai/utils/cli.py, clarifai/cli/model.py) [1] [2]
  • Introduced check_requirements_installed function to ensure all dependencies specified in requirements.txt are installed. This check is integrated into the local_runner command to improve dependency validation. (clarifai/utils/cli.py, clarifai/cli/model.py) [1] [2]

Refactoring and relocation:

  • Moved the customize_ollama_model function from clarifai/cli/model.py to clarifai/utils/cli.py for better modularity and reusability. (clarifai/utils/cli.py, clarifai/cli/model.py) [1] [2]

Code cleanup:

  • Updated imports in clarifai/cli/model.py to use multi-line format for improved readability and maintainability. (clarifai/cli/model.py)

@mogith-pn mogith-pn requested review from Copilot, luv-bansal and srikanthbachala20 and removed request for Copilot July 21, 2025 20:02
Copy link
Contributor

@luv-bansal luv-bansal left a comment

Choose a reason for hiding this comment

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

Just few comments

return True

# Report missing packages
logger.error(f"❌ {len(missing)} out of {len(requirements)} dependencies are missing:")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the logger message more descriptive for better clarity? like ❌ {len(missing)} of {len(requirements)} required packages are missing in the current environment

@mogith-pn mogith-pn requested review from luv-bansal and phatvo9 July 22, 2025 11:57
Copy link
Contributor

@luv-bansal luv-bansal left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 42%
clarifai.cli.templates 28%
clarifai.client 69%
clarifai.client.auth 66%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 72%
clarifai.runners 11%
clarifai.runners.models 59%
clarifai.runners.pipeline_steps 45%
clarifai.runners.pipelines 85%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 60%
clarifai.utils 53%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 62% (7361 / 11890)

Minimum allowed line rate is 50%

@mogith-pn mogith-pn merged commit 5b0d6e2 into master Jul 22, 2025
12 checks passed
@mogith-pn mogith-pn deleted the PR-742-validate-requirements branch July 22, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants