-
Notifications
You must be signed in to change notification settings - Fork 1
Subcommand Refactor + Model File Management #7
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
067ba58
TEST --- Refactor made, all tests fail
K-rolls 1289b6f
Update Documentation
K-rolls 0e29cc2
Create quack formatter for help
K-rolls 79c52a3
Extends to subcommand groups
K-rolls 40f098b
Updates testing
K-rolls 2a36f74
removes errant echo
K-rolls 6bce685
Adds model file commands
K-rolls df192c8
adds api testing
K-rolls 37e96f2
updates testing
K-rolls dd0a121
updates requirements
K-rolls 7ee1a0a
update whoopsie
K-rolls 2d37020
Update name of base.py -> user_auth.py
K-rolls f11de66
Update README.md
K-rolls ea14b45
fixes no connection error
K-rolls b65d19f
update documentation
K-rolls a13161c
Update name of test
K-rolls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ __pycache__ | |
| .env | ||
| duckington_cli.egg-info | ||
| .coverage | ||
| .vscode | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # See https://pre-commit.com for more information | ||
| # See https://pre-commit.com/hooks.html for more hooks | ||
| default_language_version: | ||
| python: python3.11 | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: check-added-large-files | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| args: | ||
| - --unsafe | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.7.4 | ||
| hooks: | ||
| - id: ruff | ||
| args: | ||
| - --fix | ||
| - id: ruff-format | ||
| - repo: https://github.com/igorshubovych/markdownlint-cli | ||
| rev: v0.41.0 | ||
| hooks: | ||
| - id: markdownlint | ||
| args: [ --disable=MD013, --disable=MD002,--disable=MD032,--disable=MD005,--disable=MD009 ] | ||
|
|
||
|
|
||
| ci: | ||
| autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks | ||
| autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Setup | ||
|
|
||
| Follow these steps to get started with `quack`. | ||
|
|
||
| ## TL;DR | ||
|
|
||
| 1. Set up a Python virtual environment using `venv` | ||
| 2. Install Pre-commit hooks | ||
| 3. Install `quack` as an editable module | ||
|
|
||
| ## Environment Setup | ||
|
|
||
| ### 1. Create Virtual Environment | ||
|
|
||
| ```bash | ||
| python3 -m venv .venv | ||
| ``` | ||
|
|
||
| ### 2. Activate Virtual Environment | ||
|
|
||
| - **Linux / macOS:** | ||
|
|
||
| ```bash | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| - **Windows:** | ||
|
|
||
| ```bash | ||
| . .venv\Scripts\activate | ||
| ``` | ||
|
|
||
| - **Git Bash:** | ||
|
|
||
| ```bash | ||
| source .venv/Scripts/activate | ||
| ``` | ||
|
|
||
| ### 3. Install Dependencies | ||
|
|
||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| ### 4. Activate Pre-commit Hooks | ||
|
|
||
| ```bash | ||
| pre-commit install | ||
| ``` | ||
|
|
||
| ### 5. Install CLI Application in Editable Mode | ||
|
|
||
| ```bash | ||
| pip install --editable . | ||
| ``` | ||
|
|
||
| ### 6. Deactivate the Virtual Environment | ||
|
|
||
| ```bash | ||
| deactivate | ||
| ``` |
Binary file not shown.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import os | ||
| from typing import Dict | ||
|
|
||
| from src.api.api_client import APIClient | ||
| from src.utils.helpers.handle_api_errors import handle_api_errors | ||
|
|
||
|
|
||
| class ModelFileAPI: | ||
| def __init__(self, client: APIClient): | ||
| self.client = client | ||
|
|
||
| @handle_api_errors | ||
| def upload_model_file( | ||
| self, model_name: str, model_id: str, file_path: str | ||
| ) -> Dict[str, str]: | ||
| with open(file_path, "rb") as file: | ||
| files = { | ||
| "file": (os.path.basename(file_path), file, "application/octet-stream") | ||
| } | ||
| params = {"model_name": model_name, "model_id": model_id} | ||
| return self.client.post("models", params=params, files=files) | ||
|
|
||
| @handle_api_errors | ||
| def get_model(self, model_id: str): | ||
| return self.client.get(f"models/{model_id}") | ||
|
|
||
| @handle_api_errors | ||
| def get_all_models(self): | ||
| return self.client.get("models") | ||
|
|
||
| @handle_api_errors | ||
| def read_model_file(self, model_id: str, file_name: str): | ||
| return self.client.get(f"models/{model_id}/{file_name}") | ||
|
|
||
| @handle_api_errors | ||
| def update_model_file( | ||
| self, model_name: str, model_id: str, file_path: str | ||
| ) -> Dict[str, str]: | ||
| with open(file_path, "rb") as file: | ||
| files = { | ||
| "file": (os.path.basename(file_path), file, "application/octet-stream") | ||
| } | ||
| params = {"model_name": model_name, "model_id": model_id} | ||
| return self.client.put("models", params=params, files=files) | ||
|
|
||
| @handle_api_errors | ||
| def delete_model_file(self, model_id: str, file_name: str): | ||
| return self.client.delete(f"models/{model_id}/{file_name}") | ||
|
|
||
| @handle_api_errors | ||
| def delete_model(self, model_id: str): | ||
| return self.client.delete(f"models/{model_id}") | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from src.commands import key | ||
| from src.commands import user_auth | ||
| from src.commands import machine | ||
| from src.commands import metrics | ||
| from src.commands import model_file | ||
|
|
||
| __all__ = [key, user_auth, machine, metrics, model_file] | ||
K-rolls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.