From 059c82e2fbe90eeeb72db5910d26909e2cc4cddb Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Fri, 18 Jul 2025 16:42:03 +0530 Subject: [PATCH 01/12] Unify Context Management Under a Single context Command --- clarifai/cli/README.md | 39 ++++++++++ clarifai/cli/base.py | 170 +++++++++++++---------------------------- 2 files changed, 91 insertions(+), 118 deletions(-) diff --git a/clarifai/cli/README.md b/clarifai/cli/README.md index e23865bd..5fa9c738 100644 --- a/clarifai/cli/README.md +++ b/clarifai/cli/README.md @@ -8,6 +8,45 @@ Clarifai offers a user-friendly interface for deploying your local model into pr * Easy implementation and testing in Python * No need for MLops expertise. +## Context Management + +Manage CLI contexts for authentication and environment configuration: + +### List all contexts +```bash +clarifai context list +``` + +### Show the active context +```bash +clarifai context show +``` + +### Set the active context +```bash +clarifai context use +``` + +### Create a new context +```bash +clarifai context create --user-id --base-url --pat +``` + +### Edit the config file +```bash +clarifai context edit +``` + +### Delete a context +```bash +clarifai context delete +``` + +### Print environment variables for the active context +```bash +clarifai context env +``` + ## Compute Orchestration Quick example for deploying a `visual-classifier` model diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index 893e0a99..cb400945 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -1,6 +1,5 @@ import json import os -import shutil import sys import click @@ -54,42 +53,34 @@ def shell_completion(shell): os.system(f"_CLARIFAI_COMPLETE={shell}_source clarifai") -@cli.group( - ['cfg'], - cls=AliasedGroup, - context_settings={'max_content_width': shutil.get_terminal_size().columns - 10}, -) -def config(): - """Manage CLI configuration""" +@cli.group(cls=AliasedGroup) +def context(): + """ + Manage multiple configuration profiles (contexts). + Authentication Precedence: + 1. Environment variables (e.g., `CLARIFAI_PAT`) are used first if set. + 2. The settings from the active context are used if no environment + variables are provided. + """ -@config.command(['e']) -@click.pass_context -def edit(ctx): - """Edit the configuration file""" - os.system(f'{os.environ.get("EDITOR", "vi")} {ctx.obj.filename}') +def pat_display(pat): + return pat[:5] + "****" -@config.command(['current']) -@click.option('-o', '--output-format', default='name', type=click.Choice(['name', 'json', 'yaml'])) -@click.pass_context -def current_context(ctx, output_format): - """Get the current context""" - if output_format == 'name': - print(ctx.obj.current_context) - elif output_format == 'json': - print(json.dumps(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) - else: - print(yaml.safe_dump(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) + +def input_or_default(prompt, default): + value = input(prompt) + return value if value else default -@config.command(['list', 'ls']) +@context.command('list', aliases=['ls']) @click.option( '-o', '--output-format', default='wide', type=click.Choice(['wide', 'name', 'json', 'yaml']) ) @click.pass_context -def get_contexts(ctx, output_format): - """Get all contexts""" +def list_contexts(ctx, output_format): + """List all available contexts.""" if output_format == 'wide': columns = { '': lambda c: '*' if c.name == ctx.obj.current_context else '', @@ -106,7 +97,6 @@ def get_contexts(ctx, output_format): additional_columns.add(key) for key in sorted(additional_columns): columns[key] = lambda c, k=key: getattr(c, k) if hasattr(c, k) else "" - formatter = TableFormatter( custom_columns=columns, ) @@ -123,88 +113,32 @@ def get_contexts(ctx, output_format): print(yaml.safe_dump(dicts)) -@config.command(['use']) -@click.argument('context-name', type=str) +@context.command('use') +@click.argument('name', type=str) @click.pass_context -def use_context(ctx, context_name): - """Set the current context""" - if context_name not in ctx.obj.contexts: +def use(ctx, name): + """Set the active context.""" + if name not in ctx.obj.contexts: raise click.UsageError('Context not found') - ctx.obj.current_context = context_name + ctx.obj.current_context = name ctx.obj.to_yaml() - print(f'Set {context_name} as the current context') - - -@config.command(['cat']) -@click.option('-o', '--output-format', default='yaml', type=click.Choice(['yaml', 'json'])) -@click.pass_obj -def dump(ctx_obj, output_format): - """Dump the configuration to stdout""" - if output_format == 'yaml': - yaml.safe_dump(ctx_obj.to_dict(), sys.stdout) - else: - json.dump(ctx_obj.to_dict(), sys.stdout, indent=2) - - -@config.command(['cat']) -@click.pass_obj -def env(ctx_obj): - """Print env vars. Use: eval "$(clarifai config env)" """ - ctx_obj.current.print_env_vars() + print(f'Set {name} as the current context') -@cli.command() -@click.argument('api_url', default=DEFAULT_BASE) -@click.option('--user_id', required=False, help='User ID') +@context.command('show') +@click.option('-o', '--output-format', default='name', type=click.Choice(['name', 'json', 'yaml'])) @click.pass_context -def login(ctx, api_url, user_id): - """Login command to set PAT and other configurations.""" - from clarifai.utils.cli import validate_context_auth - - name = input('context name (default: "default"): ') - user_id = user_id if user_id is not None else input('user id: ') - pat = input_or_default( - 'personal access token value (default: "ENVVAR" to get our of env var rather than config): ', - 'ENVVAR', - ) - - # Validate the Context Credentials - validate_context_auth(pat, user_id, api_url) - - context = Context( - name, - CLARIFAI_API_BASE=api_url, - CLARIFAI_USER_ID=user_id, - CLARIFAI_PAT=pat, - ) - - if context.name == '': - context.name = 'default' - - ctx.obj.contexts[context.name] = context - ctx.obj.current_context = context.name - - ctx.obj.to_yaml() - logger.info( - f"Login successful and Configuration saved successfully for context '{context.name}'" - ) - - -@cli.group(cls=AliasedGroup) -def context(): - """Manage contexts""" - - -def pat_display(pat): - return pat[:5] + "****" - - -def input_or_default(prompt, default): - value = input(prompt) - return value if value else default +def show(ctx, output_format): + """Show the active context's details.""" + if output_format == 'name': + print(ctx.obj.current_context) + elif output_format == 'json': + print(json.dumps(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) + else: + print(yaml.safe_dump(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) -@context.command() +@context.command('create') @click.argument('name') @click.option('--user-id', required=False, help='User ID') @click.option('--base-url', required=False, help='Base URL') @@ -217,7 +151,7 @@ def create( base_url=None, pat=None, ): - """Create a new context""" + """Create a new context.""" from clarifai.utils.cli import validate_context_auth if name in ctx.obj.contexts: @@ -234,22 +168,27 @@ def create( 'personal access token value (default: "ENVVAR" to get our of env var rather than config): ', 'ENVVAR', ) - - # Validate the Context Credentials validate_context_auth(pat, user_id, base_url) - context = Context(name, CLARIFAI_USER_ID=user_id, CLARIFAI_API_BASE=base_url, CLARIFAI_PAT=pat) ctx.obj.contexts[context.name] = context ctx.obj.to_yaml() logger.info(f"Context '{name}' created successfully") -# write a click command to delete a context -@context.command(['rm']) +@context.command('edit') +@click.argument('name', required=False) +@click.pass_context +def edit_context(ctx, name=None): + """Open the config file for a context.""" + # For now, just open the config file (not per-context) + os.system(f'{os.environ.get("EDITOR", "vi")} {ctx.obj.filename}') + + +@context.command('delete', aliases=['rm']) @click.argument('name') @click.pass_context def delete(ctx, name): - """Delete a context""" + """Delete a context.""" if name not in ctx.obj.contexts: print(f'{name} is not a valid context') sys.exit(1) @@ -258,16 +197,11 @@ def delete(ctx, name): print(f'{name} deleted') -@context.command() -@click.argument('name', type=str) +@context.command('env') @click.pass_context -def use(ctx, name): - """Set the current context""" - if name not in ctx.obj.contexts: - raise click.UsageError('Context not found') - ctx.obj.current_context = name - ctx.obj.to_yaml() - print(f'Set {name} as the current context') +def env(ctx): + """Print env vars for the active context.""" + ctx.obj.current.print_env_vars() @cli.command() From b9fca97eeb697c19dc238935ea08a2530c48e6ee Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Fri, 18 Jul 2025 16:48:32 +0530 Subject: [PATCH 02/12] login func --- clarifai/cli/base.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index cb400945..c5d8f8b3 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -65,6 +65,43 @@ def context(): """ +@cli.command() +@click.argument('api_url', default=DEFAULT_BASE) +@click.option('--user_id', required=False, help='User ID') +@click.pass_context +def login(ctx, api_url, user_id): + """Login command to set PAT and other configurations.""" + from clarifai.utils.cli import validate_context_auth + + name = input('context name (default: "default"): ') + user_id = user_id if user_id is not None else input('user id: ') + pat = input_or_default( + 'personal access token value (default: "ENVVAR" to get our of env var rather than config): ', + 'ENVVAR', + ) + + # Validate the Context Credentials + validate_context_auth(pat, user_id, api_url) + + context = Context( + name, + CLARIFAI_API_BASE=api_url, + CLARIFAI_USER_ID=user_id, + CLARIFAI_PAT=pat, + ) + + if context.name == '': + context.name = 'default' + + ctx.obj.contexts[context.name] = context + ctx.obj.current_context = context.name + + ctx.obj.to_yaml() + logger.info( + f"Login successful and Configuration saved successfully for context '{context.name}'" + ) + + def pat_display(pat): return pat[:5] + "****" From 1889338fed2366b11c9b04195897b8d1c88e2247 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Fri, 18 Jul 2025 17:00:33 +0530 Subject: [PATCH 03/12] improvemensts and fix tests --- clarifai/cli/base.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index c5d8f8b3..9be3439c 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -76,7 +76,7 @@ def login(ctx, api_url, user_id): name = input('context name (default: "default"): ') user_id = user_id if user_id is not None else input('user id: ') pat = input_or_default( - 'personal access token value (default: "ENVVAR" to get our of env var rather than config): ', + 'personal access token value (default: "ENVVAR" to get out of env var rather than config): ', 'ENVVAR', ) @@ -111,7 +111,7 @@ def input_or_default(prompt, default): return value if value else default -@context.command('list', aliases=['ls']) +@context.command(aliases=['ls']) @click.option( '-o', '--output-format', default='wide', type=click.Choice(['wide', 'name', 'json', 'yaml']) ) @@ -212,16 +212,17 @@ def create( logger.info(f"Context '{name}' created successfully") -@context.command('edit') -@click.argument('name', required=False) +@context.command(aliases=['e']) @click.pass_context -def edit_context(ctx, name=None): - """Open the config file for a context.""" +def edit( + ctx, +): + """Open the configuration file for editing.""" # For now, just open the config file (not per-context) os.system(f'{os.environ.get("EDITOR", "vi")} {ctx.obj.filename}') -@context.command('delete', aliases=['rm']) +@context.command(aliases=['rm']) @click.argument('name') @click.pass_context def delete(ctx, name): From 07a7ddb6208f4bd40b0324dbf3e88d1f3fb2a5a5 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Fri, 18 Jul 2025 17:17:56 +0530 Subject: [PATCH 04/12] better alias --- clarifai/cli/base.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index 9be3439c..3b100a41 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -58,10 +58,9 @@ def context(): """ Manage multiple configuration profiles (contexts). - Authentication Precedence: + Authentication Precedence:\n 1. Environment variables (e.g., `CLARIFAI_PAT`) are used first if set. - 2. The settings from the active context are used if no environment - variables are provided. + 2. The settings from the active context are used if no environment variables are provided.\n """ @@ -116,7 +115,7 @@ def input_or_default(prompt, default): '-o', '--output-format', default='wide', type=click.Choice(['wide', 'name', 'json', 'yaml']) ) @click.pass_context -def list_contexts(ctx, output_format): +def list(ctx, output_format): """List all available contexts.""" if output_format == 'wide': columns = { @@ -150,7 +149,7 @@ def list_contexts(ctx, output_format): print(yaml.safe_dump(dicts)) -@context.command('use') +@context.command() @click.argument('name', type=str) @click.pass_context def use(ctx, name): @@ -162,7 +161,7 @@ def use(ctx, name): print(f'Set {name} as the current context') -@context.command('show') +@context.command() @click.option('-o', '--output-format', default='name', type=click.Choice(['name', 'json', 'yaml'])) @click.pass_context def show(ctx, output_format): @@ -175,7 +174,7 @@ def show(ctx, output_format): print(yaml.safe_dump(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) -@context.command('create') +@context.command() @click.argument('name') @click.option('--user-id', required=False, help='User ID') @click.option('--base-url', required=False, help='Base URL') @@ -235,7 +234,7 @@ def delete(ctx, name): print(f'{name} deleted') -@context.command('env') +@context.command() @click.pass_context def env(ctx): """Print env vars for the active context.""" From e08d94549522e809ec7bd53c6d7e423c475bd691 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Fri, 18 Jul 2025 20:42:50 +0530 Subject: [PATCH 05/12] active to current --- clarifai/cli/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index 3b100a41..4f6fd176 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -153,7 +153,7 @@ def list(ctx, output_format): @click.argument('name', type=str) @click.pass_context def use(ctx, name): - """Set the active context.""" + """Set the current context.""" if name not in ctx.obj.contexts: raise click.UsageError('Context not found') ctx.obj.current_context = name @@ -165,7 +165,7 @@ def use(ctx, name): @click.option('-o', '--output-format', default='name', type=click.Choice(['name', 'json', 'yaml'])) @click.pass_context def show(ctx, output_format): - """Show the active context's details.""" + """Show the current context's details.""" if output_format == 'name': print(ctx.obj.current_context) elif output_format == 'json': From d8894f237557505e2e6db06d69582fb78a34ca80 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Tue, 22 Jul 2025 17:00:55 +0530 Subject: [PATCH 06/12] Unify config --- clarifai/cli/base.py | 46 ++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index 4f6fd176..b98dc486 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -12,7 +12,6 @@ from clarifai.utils.logging import logger -# @click.group(cls=CustomMultiGroup) @click.group(cls=AliasedGroup) @click.version_option(version=__version__) @click.option('--config', default=DEFAULT_CONFIG) @@ -54,7 +53,7 @@ def shell_completion(shell): @cli.group(cls=AliasedGroup) -def context(): +def config(): """ Manage multiple configuration profiles (contexts). @@ -110,12 +109,13 @@ def input_or_default(prompt, default): return value if value else default -@context.command(aliases=['ls']) +# Context management commands under config group +@config.command(aliases=['get-contexts', 'list-contexts']) @click.option( '-o', '--output-format', default='wide', type=click.Choice(['wide', 'name', 'json', 'yaml']) ) @click.pass_context -def list(ctx, output_format): +def get_contexts(ctx, output_format): """List all available contexts.""" if output_format == 'wide': columns = { @@ -149,10 +149,10 @@ def list(ctx, output_format): print(yaml.safe_dump(dicts)) -@context.command() +@config.command(aliases=['use-context']) @click.argument('name', type=str) @click.pass_context -def use(ctx, name): +def use_context(ctx, name): """Set the current context.""" if name not in ctx.obj.contexts: raise click.UsageError('Context not found') @@ -161,10 +161,10 @@ def use(ctx, name): print(f'Set {name} as the current context') -@context.command() +@config.command(aliases=['current-context']) @click.option('-o', '--output-format', default='name', type=click.Choice(['name', 'json', 'yaml'])) @click.pass_context -def show(ctx, output_format): +def current_context(ctx, output_format): """Show the current context's details.""" if output_format == 'name': print(ctx.obj.current_context) @@ -174,13 +174,13 @@ def show(ctx, output_format): print(yaml.safe_dump(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) -@context.command() +@config.command(aliases=['create-context']) @click.argument('name') @click.option('--user-id', required=False, help='User ID') @click.option('--base-url', required=False, help='Base URL') @click.option('--pat', required=False, help='Personal access token') @click.pass_context -def create( +def create_context( ctx, name, user_id=None, @@ -211,7 +211,7 @@ def create( logger.info(f"Context '{name}' created successfully") -@context.command(aliases=['e']) +@config.command(aliases=['e']) @click.pass_context def edit( ctx, @@ -221,10 +221,10 @@ def edit( os.system(f'{os.environ.get("EDITOR", "vi")} {ctx.obj.filename}') -@context.command(aliases=['rm']) +@config.command(aliases=['delete-context']) @click.argument('name') @click.pass_context -def delete(ctx, name): +def delete_context(ctx, name): """Delete a context.""" if name not in ctx.obj.contexts: print(f'{name} is not a valid context') @@ -234,13 +234,31 @@ def delete(ctx, name): print(f'{name} deleted') -@context.command() +@config.command(aliases=['get-env']) @click.pass_context def env(ctx): """Print env vars for the active context.""" ctx.obj.current.print_env_vars() +@config.command(aliases=['show']) +@click.option('-o', '--output-format', default='yaml', type=click.Choice(['json', 'yaml'])) +@click.pass_context +def view(ctx, output_format): + """Display the current configuration.""" + config_dict = { + 'current-context': ctx.obj.current_context, + 'contexts': { + name: context.to_serializable_dict() for name, context in ctx.obj.contexts.items() + }, + } + + if output_format == 'json': + print(json.dumps(config_dict, indent=2)) + else: + print(yaml.safe_dump(config_dict, default_flow_style=False)) + + @cli.command() @click.argument('script', type=str) @click.option('--context', type=str, help='Context to use') From 2baeb6962afd4cde4005992048b09325df11af13 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Tue, 22 Jul 2025 17:03:44 +0530 Subject: [PATCH 07/12] Update readme --- clarifai/cli/README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/clarifai/cli/README.md b/clarifai/cli/README.md index 5fa9c738..a08ed9d5 100644 --- a/clarifai/cli/README.md +++ b/clarifai/cli/README.md @@ -11,35 +11,35 @@ Clarifai offers a user-friendly interface for deploying your local model into pr ## Context Management Manage CLI contexts for authentication and environment configuration: - -### List all contexts +# List all contexts ```bash -clarifai context list +clarifai config get-contexts ``` -### Show the active context +# Switch context ```bash -clarifai context show +clarifai config use-context production ``` - -### Set the active context +# Show current context ```bash -clarifai context use +clarifai config get-current-context ``` -### Create a new context +# Create new context ```bash -clarifai context create --user-id --base-url --pat +clarifai config create-context staging --user-id myuser --base-url https://staging.clarifai.com ``` - -### Edit the config file +# View entire configuration ```bash -clarifai context edit +clarifai config view ``` - -### Delete a context +# Delete a context +```bash +clarifai config delete-context old-context +``` +# Edit configuration file ```bash -clarifai context delete +clarifai config edit ``` ### Print environment variables for the active context From 4d86b28a4b6fa4b5e5de209e0cc16a02a11fda50 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Tue, 22 Jul 2025 17:27:07 +0530 Subject: [PATCH 08/12] fix test --- .../fixtures/single_branch_with_custom_cropper_model.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/workflow/fixtures/single_branch_with_custom_cropper_model.yml b/tests/workflow/fixtures/single_branch_with_custom_cropper_model.yml index ef90ca9f..6b92003b 100644 --- a/tests/workflow/fixtures/single_branch_with_custom_cropper_model.yml +++ b/tests/workflow/fixtures/single_branch_with_custom_cropper_model.yml @@ -14,6 +14,6 @@ workflow: description: Custom crop model output_info: params: - margin: 1.33 + margin: 1.3 node_inputs: - node_id: detector From 2ac2d37cc2105c4c9bb5be48fe0226b2b1612dee Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Tue, 22 Jul 2025 19:15:14 +0530 Subject: [PATCH 09/12] update readme --- clarifai/cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clarifai/cli/README.md b/clarifai/cli/README.md index a08ed9d5..b3af29c4 100644 --- a/clarifai/cli/README.md +++ b/clarifai/cli/README.md @@ -22,7 +22,7 @@ clarifai config use-context production ``` # Show current context ```bash -clarifai config get-current-context +clarifai config current-context ``` # Create new context From 12100c40bdd229f5dcfccd118eafdb51765234fa Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Wed, 23 Jul 2025 12:58:16 +0530 Subject: [PATCH 10/12] update readme --- clarifai/cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clarifai/cli/README.md b/clarifai/cli/README.md index b3af29c4..d7f54ed7 100644 --- a/clarifai/cli/README.md +++ b/clarifai/cli/README.md @@ -27,7 +27,7 @@ clarifai config current-context # Create new context ```bash -clarifai config create-context staging --user-id myuser --base-url https://staging.clarifai.com +clarifai config create-context staging --user-id myuser --pat 678*** ``` # View entire configuration ```bash From b177cbefea8533de0e57babde825c9873374c918 Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Wed, 23 Jul 2025 13:05:08 +0530 Subject: [PATCH 11/12] update readme --- clarifai/cli/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clarifai/cli/README.md b/clarifai/cli/README.md index d7f54ed7..e549bfba 100644 --- a/clarifai/cli/README.md +++ b/clarifai/cli/README.md @@ -11,33 +11,33 @@ Clarifai offers a user-friendly interface for deploying your local model into pr ## Context Management Manage CLI contexts for authentication and environment configuration: -# List all contexts +### List all contexts ```bash clarifai config get-contexts ``` -# Switch context +### Switch context ```bash clarifai config use-context production ``` -# Show current context +### Show current context ```bash clarifai config current-context ``` -# Create new context +### Create new context ```bash clarifai config create-context staging --user-id myuser --pat 678*** ``` -# View entire configuration +### View entire configuration ```bash clarifai config view ``` -# Delete a context +### Delete a context ```bash clarifai config delete-context old-context ``` -# Edit configuration file +### Edit configuration file ```bash clarifai config edit ``` From 67e59916310ab65af7af1d818c2ded2e7b15bfff Mon Sep 17 00:00:00 2001 From: Luv Bansal Date: Wed, 23 Jul 2025 14:21:03 +0530 Subject: [PATCH 12/12] add set-context alias --- clarifai/cli/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clarifai/cli/base.py b/clarifai/cli/base.py index b98dc486..322c682c 100644 --- a/clarifai/cli/base.py +++ b/clarifai/cli/base.py @@ -174,7 +174,7 @@ def current_context(ctx, output_format): print(yaml.safe_dump(ctx.obj.contexts[ctx.obj.current_context].to_serializable_dict())) -@config.command(aliases=['create-context']) +@config.command(aliases=['create-context', 'set-context']) @click.argument('name') @click.option('--user-id', required=False, help='User ID') @click.option('--base-url', required=False, help='Base URL')