Skip to content

[PR-739] [PR-740] Unify Context Management Under a Single config Command #709

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 12 commits into from
Jul 23, 2025

Conversation

luv-bansal
Copy link
Contributor

@luv-bansal luv-bansal commented Jul 18, 2025

Pull Request Overview

This PR unifies context management under a single context command by reorganizing CLI commands for better user experience. It consolidates context-related functionality that was previously scattered across different command groups into a cohesive interface.

  • Replaced the config command group with a unified context command group
  • Moved the login command from top-level to remain at top-level while organizing context subcommands
  • Added comprehensive documentation for context management commands

@luv-bansal luv-bansal requested a review from Copilot July 18, 2025 11:12
Copilot

This comment was marked as outdated.

@luv-bansal luv-bansal requested a review from Copilot July 18, 2025 11:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR unifies context management under a single context command by reorganizing CLI commands for better user experience. It consolidates context-related functionality that was previously scattered across different command groups into a cohesive interface.

  • Replaced the config command group with a unified context command group
  • Moved the login command from top-level to remain at top-level while organizing context subcommands
  • Added comprehensive documentation for context management commands

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
clarifai/cli/base.py Restructures CLI commands by removing config group and organizing context subcommands with improved naming and documentation
clarifai/cli/README.md Adds comprehensive documentation section for context management commands with usage examples
Comments suppressed due to low confidence (1)

clarifai/cli/base.py:105

  • The pat_display function is defined but not used in this diff. Consider adding tests to verify it correctly masks personal access tokens.
def pat_display(pat):

@luv-bansal luv-bansal changed the title Unify Context Management Under a Single context Command [PR-739] [PR-740] Unify Context Management Under a Single context Command Jul 18, 2025
Copy link
Contributor

@srikanthbachala20 srikanthbachala20 left a comment

Choose a reason for hiding this comment

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

LGTM

@luv-bansal luv-bansal changed the title [PR-739] [PR-740] Unify Context Management Under a Single context Command [PR-739] [PR-740] Unify Context Management Under a Single config Command Jul 22, 2025
```
# Show current context
```bash
clarifai config get-current-context
Copy link
Contributor

@phatvo9 phatvo9 Jul 22, 2025

Choose a reason for hiding this comment

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

I wonder if we can shorten it e.g clarifai config current ? And may be other clis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh update the readme, we are using clarifai config current-context. Currently we are using cli commands consistent with kubectl context CLI

@luv-bansal luv-bansal enabled auto-merge (squash) July 23, 2025 07:35
```bash
clarifai context create <name> --user-id <user_id> --base-url <base_url> --pat <token>
clarifai config create-context staging --user-id myuser --pat 678***
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be set-context according to kubectl commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, I'm not sure because Matt also used create-context in the initial setup instead of set-context. we could add alias for set-context

@luv-bansal luv-bansal disabled auto-merge July 23, 2025 08:51
@luv-bansal luv-bansal enabled auto-merge (squash) July 23, 2025 08:51
Copy link

Code Coverage

Package Line Rate Health
clarifai 43%
clarifai.cli 42%
clarifai.cli.templates 28%
clarifai.client 69%
clarifai.client.auth 67%
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% (7358 / 11883)

Minimum allowed line rate is 50%

@luv-bansal luv-bansal merged commit 24b1670 into master Jul 23, 2025
16 of 17 checks passed
@luv-bansal luv-bansal deleted the unify-context branch July 23, 2025 09:16
srikanthbachala20 pushed a commit that referenced this pull request Jul 23, 2025
…and (#709)

* Unify Context Management Under a Single context Command

* login func

* improvemensts and fix tests

* better alias

* active to current

* Unify config

* Update readme

* fix test

* update readme

* update readme

* update readme

* add set-context alias
srikanthbachala20 added a commit that referenced this pull request Jul 23, 2025
* Initial plan

* Implement CLI config context fallback in BaseClient

Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com>

* Remove tests/test_base_client_cli_config.py file as requested

Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com>

* Remove tests/test_misc_cli_config.py as requested

Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com>

* [PR-725]: Using Config Context in Baseclient class

* Improve error message formatting and clarity in authentication

Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com>

* Add github folder download support and toolkit option in model init (#699)

* added github folder download support

* modified folder structure validation

* supported toolkit options for ollama

* fixed param name and toolkit bugs

* removed print in misc.py

* updated with log and raise

* Update clarifai/utils/misc.py

Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com>

---------

Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com>

* Improve client script formatting (black linter formatting) and added logger once runner start (#705)

* VERSION-11.5.5

* Black linter to fix stylistic issues and ensure it follows to common Python standards

* better representation

* fix formatting

* fix formatting

* fix formatting

* [PR-727]: Improve Local-Runner CLI Logging (#706)

* [PR-727]: Improve Local-Runner CLI Logging

* [PR-727]: Improve Local-Runner CLI Logging

* [PR-727]: Improve Local-Runner CLI Logging

* [PR-727]: Improve Local-Runner CLI Logging

* PR-323 Unit tests for toolkits. (#639)

* added initial vllm unit tests

* modified permissions for maintainer_tests.yml

* modified yaml file

* removed codecoverage for maintainer tests

* modified env vars for tests

* added labels to tests

* removed inputs in workflow disptach

* added pytest.ini

* removed unused functions

* added --enforce-eager option

* removed redundant URL logging

* Added Playground URL to Local-Runner Logs (#708)

* [PR-733] Improve URL Download error handling (#710)

* Improve error handling

* Improve error handling

* Improve error handling

* Added local-runner requirements validation step (#712)

* added local-runner requirements validation step

* added post check for ollama toolkit

* fixed tests

* [EAGLE-6460]:  Add func to return both stub and channel. (#713)

* Add func to return both stub and channel.

* tidy

* [PR-739] [PR-740] Unify Context Management Under a Single config Command (#709)

* Unify Context Management Under a Single context Command

* login func

* improvemensts and fix tests

* better alias

* active to current

* Unify config

* Update readme

* fix test

* update readme

* update readme

* update readme

* add set-context alias

* Initial plan

* [PR-725]: Using Config Context in Baseclient class

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: srikanthbachala20 <170492893+srikanthbachala20@users.noreply.github.com>
Co-authored-by: Srikanth Bachala <srikanth.bachala@clarifai.com>
Co-authored-by: luv-bansal <70321430+luv-bansal@users.noreply.github.com>
Co-authored-by: mogith-pn <143642606+mogith-pn@users.noreply.github.com>
Co-authored-by: Patrick Lundquist <1460278+patricklundquist@users.noreply.github.com>
@luv-bansal luv-bansal mentioned this pull request Jul 23, 2025
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.

4 participants