Repository navigation
For discussion only: Extracting _VisorClient from CLI for use in user-facing Python client - #214
Closed
LKasianAnsys wants to merge 10 commits into
Closed
LKasianAnsys wants to merge 10 commits into
LKasianAnsys wants to merge 10 commits into
Conversation
Collaborator
Author
|
Closing as this was shared as a POC for discussion only. For when #163 is picked up. |
LKasianAnsys
commented
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Addresses #163
Context
We currently have VisorSafClient defined in the SAF repository, which exposes VISOR endpoints to SAF users. It would be ideal to have a Python client defined in the VISOR repo instead (e.g. see comment).
In the VISOR repo we have a CLI tool which wraps most of the VISOR service endpoints. However, the needs of the VISOR CLI tool are different from what we would want to expose to SAF users in a client that would replace the existing VisorSafClient (e.g. the client in the CLI tool prints the response outputs to stdout rather than returning them; also, it defines its own defaults that are passed as required args in the requests).
More generally, it matters because the VisorSafClient is used in production by SAF users, but the CLI tool was designed primarily as a developer tool. Decoupling those two use cases makes sure that changes in the CLI tool don't break VISOR usage in production.
Summary
This is a proof of concept of a refactor we could make to extract Python client logic from the Visor CLI into a private
_VisorClientclass, which can be used for each of the two separate cases: the CLI client, and the SAF client. In this branch, the CLI is updated to use the new_VisorClient(in aVisorCliClient). TheVisorSafClientcould be added as a second user of that private shared class (e.g. here).