-
Notifications
You must be signed in to change notification settings - Fork 10
Feature: Allow to use prime-cli in python as package #16
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 enables the prime‑cli package to be used directly in Python by exposing API functions and adding a version callback, along with updating the README for Python usage.
- Added a new version_callback function in main.py for version display.
- Updated init.py to dynamically retrieve the package version and expose API functions.
- Provided a Python usage example in examples/list-pods.py and updated the README accordingly.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/prime_cli/main.py | Introduces version_callback to handle version output in CLI. |
src/prime_cli/init.py | Updates module initialization with dynamic versioning and API setup. |
examples/list-pods.py | Adds a simple example to demonstrate Python usage of the package. |
README.md | Modifies usage and development instructions to include Python usage. |
There was a problem hiding this 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 enables prime-cli to be used as a package in Python by exposing key functionality through module-level functions and establishing API client instances on import.
- Introduces dynamic version retrieval via importlib.metadata
- Adds function wrappers for API key configuration, pod management, and GPU availability
- Updates documentation and example usage in both the README and examples directory
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/prime_cli/init.py | Initializes package-level API clients and provides utility methods |
examples/list-pods.py | Adds an example script demonstrating basic usage |
README.md | Updates documentation and usage instructions for Python integration |
Comments suppressed due to low confidence (1)
src/prime_cli/init.py:20
- The set_api_key function updates the configuration but does not refresh the APIClient, which is instantiated before the API key is set. Verify that APIClient properly picks up the updated credentials or consider re-instantiating it after changing the API key.
def set_api_key(api_key: str) -> None:
|
||
def create_pod(pod_config: PodConfig) -> Pod: | ||
"""Create a new pod""" | ||
return pods_client.create(pod_config.__dict__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using pod_config.dict directly might bypass validations or transformations provided by PodConfig. Consider using an explicit serialization method to ensure data integrity.
Copilot uses AI. Check for mistakes.
No description provided.