From ad0cf6de8134161da381a1020c073835ef8fce67 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 11:49:47 -0800 Subject: [PATCH 01/12] precommit --- .github/workflows/ci.yml | 52 -------------------------------- .github/workflows/pre-commit.yml | 25 +++++++++++++++ 2 files changed, 25 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b8f25b44..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI -on: - push: - branches: - - main - pull_request: - branches: - - main - - next - -jobs: - lint: - name: lint - runs-on: ubuntu-latest - - - steps: - - uses: actions/checkout@v4 - - - name: Install Rye - run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.35.0' - RYE_INSTALL_OPTION: '--yes' - - - name: Install dependencies - run: rye sync --all-features - - - name: Run lints - run: ./scripts/lint - test: - name: test - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Rye - run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.35.0' - RYE_INSTALL_OPTION: '--yes' - - - name: Bootstrap - run: ./scripts/bootstrap - - - name: Run tests - run: ./scripts/test diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..dd1a5c6c --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,25 @@ +name: Pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Set up Python + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + with: + python-version: '3.11' + cache: pip + cache-dependency-path: | + **/requirements*.txt + .pre-commit-config.yaml + + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 From 51f58729eb42759dd689ae37b0c3d8859f37af35 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 11:51:09 -0800 Subject: [PATCH 02/12] precommit --- src/llama_stack_client/lib/cli/inspect/__init__.py | 1 - src/llama_stack_client/lib/cli/inspect/version.py | 3 +-- src/llama_stack_client/lib/cli/llama_stack_client.py | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/llama_stack_client/lib/cli/inspect/__init__.py b/src/llama_stack_client/lib/cli/inspect/__init__.py index a463d52d..db651969 100644 --- a/src/llama_stack_client/lib/cli/inspect/__init__.py +++ b/src/llama_stack_client/lib/cli/inspect/__init__.py @@ -1,4 +1,3 @@ from .inspect import inspect __all__ = ["inspect"] - diff --git a/src/llama_stack_client/lib/cli/inspect/version.py b/src/llama_stack_client/lib/cli/inspect/version.py index de339a62..8915f217 100644 --- a/src/llama_stack_client/lib/cli/inspect/version.py +++ b/src/llama_stack_client/lib/cli/inspect/version.py @@ -1,6 +1,5 @@ import click from rich.console import Console -from rich.table import Table from ..common.utils import handle_client_errors @@ -13,4 +12,4 @@ def inspect_version(ctx): client = ctx.obj["client"] console = Console() version_response = client.inspect.version() - console.print(version_response) \ No newline at end of file + console.print(version_response) diff --git a/src/llama_stack_client/lib/cli/llama_stack_client.py b/src/llama_stack_client/lib/cli/llama_stack_client.py index 8bbb6a1f..5e49c15a 100644 --- a/src/llama_stack_client/lib/cli/llama_stack_client.py +++ b/src/llama_stack_client/lib/cli/llama_stack_client.py @@ -5,12 +5,12 @@ # the root directory of this source tree. import os +from importlib.metadata import version import click import yaml from llama_stack_client import LlamaStackClient -from importlib.metadata import version from .configure import configure from .constants import get_config_file_path @@ -18,13 +18,14 @@ from .eval import eval from .eval_tasks import eval_tasks from .inference import inference +from .inspect import inspect from .memory_banks import memory_banks from .models import models from .post_training import post_training from .providers import providers from .scoring_functions import scoring_functions from .shields import shields -from .inspect import inspect + @click.group() @click.version_option(version=version("llama-stack-client"), prog_name="llama-stack-client") From 1c72e47e853e93649bc6d35c7ef9984b3051a4ab Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:38:28 -0800 Subject: [PATCH 03/12] template --- .github/ISSUE_TEMPLATE/bug.yml | 77 ++++++++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 27 +++++++++++ 2 files changed, 104 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..1f7dabb9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,77 @@ +name: 🐛 Bug Report +description: Create a report to help us reproduce and fix the bug + +body: + - type: markdown + attributes: + value: > + #### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the + existing and past issues](https://github.com/meta-llama/llama-stack/issues). + + - type: textarea + id: system-info + attributes: + label: System Info + description: | + Please share your system info with us. You can use the following command to capture your environment information + python -m "torch.utils.collect_env" + + placeholder: | + PyTorch version, CUDA version, GPU type, #num of GPUs... + validations: + required: true + + - type: checkboxes + id: information-scripts-examples + attributes: + label: Information + description: 'The problem arises when using:' + options: + - label: "The official example scripts" + - label: "My own modified scripts" + + - type: textarea + id: bug-description + attributes: + label: 🐛 Describe the bug + description: | + Please provide a clear and concise description of what the bug is. + + Please also paste or describe the results you observe instead of the expected results. + placeholder: | + A clear and concise description of what the bug is. + + ```llama stack + # Command that you used for running the examples + ``` + Description of the results + validations: + required: true + + - type: textarea + attributes: + label: Error logs + description: | + If you observe an error, please paste the error message including the **full** traceback of the exception. It may be relevant to wrap error messages in ```` ```triple quotes blocks``` ````. + + placeholder: | + ``` + The error message you got, with the full traceback. + ``` + + validations: + required: true + + + - type: textarea + id: expected-behavior + validations: + required: true + attributes: + label: Expected behavior + description: "A clear and concise description of what you would expect to happen." + + - type: markdown + attributes: + value: > + Thanks for contributing 🎉! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..fb02dd13 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ +# What does this PR do? + +In short, provide a summary of what this PR does and why. Usually, the relevant context should be present in a linked issue. + +- [ ] Addresses issue (#issue) + + +## Test Plan + +Please describe: + - tests you ran to verify your changes with result summaries. + - provide instructions so it can be reproduced. + + +## Sources + +Please link relevant resources if necessary. + + +## Before submitting + +- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). +- [ ] Ran pre-commit to handle lint / formatting issues. +- [ ] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), + Pull Request section? +- [ ] Updated relevant documentation. +- [ ] Wrote necessary unit or integration tests. From 3f377da5e3dbd8e390d73e6f3252e147341bd80e Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:47:14 -0800 Subject: [PATCH 04/12] precommit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0f608888..ac8e0f33 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,9 +7,9 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 6306a48f7dae5861702d573c9c247e4e9498e867 hooks: - - id: trailing-whitespace - id: check-ast - id: check-merge-conflict + - id: trailing-whitespace - id: check-added-large-files args: ['--maxkb=1000'] - id: end-of-file-fixer From 00959c7292890b6f1f5c7d22cc4a3ffa2fa736c8 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:50:14 -0800 Subject: [PATCH 05/12] precommit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac8e0f33..6e9a0aa3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 6306a48f7dae5861702d573c9c247e4e9498e867 + rev: v5.0.0 hooks: - id: check-ast - id: check-merge-conflict From 1e4b10a6826d826e85bc82566a9feba8421be5a1 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:54:10 -0800 Subject: [PATCH 06/12] trailing space --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e9a0aa3..72bea87d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,6 @@ repos: hooks: - id: check-ast - id: check-merge-conflict - - id: trailing-whitespace - id: check-added-large-files args: ['--maxkb=1000'] - id: end-of-file-fixer From d304c08c7e94a12495ff6c95c5d4c71541f3a5cb Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:57:42 -0800 Subject: [PATCH 07/12] test --- .pre-commit-config.yaml | 1 + tests/test_client.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 72bea87d..1d61b6d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: + - id: trailing-whitespace - id: check-ast - id: check-merge-conflict - id: check-added-large-files diff --git a/tests/test_client.py b/tests/test_client.py index 921151ef..81c74a8f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1620,6 +1620,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" def test_get_platform(self) -> None: + # change this file # A previous implementation of asyncify could leave threads unterminated when # used with nest_asyncio. # From d42b43f91f9129362d285062d317a19028e784e5 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 12:58:38 -0800 Subject: [PATCH 08/12] test_client --- tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 81c74a8f..7d8cb3c8 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1620,7 +1620,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" def test_get_platform(self) -> None: - # change this file # A previous implementation of asyncify could leave threads unterminated when # used with nest_asyncio. # @@ -1634,6 +1633,7 @@ def test_get_platform(self) -> None: from llama_stack_client._utils import asyncify from llama_stack_client._base_client import get_platform + async def test_main() -> None: result = await asyncify(get_platform)() print(result) From b18416caebd1351629f1f9ccc2c31946117f6702 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 13:02:07 -0800 Subject: [PATCH 09/12] test_client --- tests/test_client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 7d8cb3c8..f3fec488 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1629,10 +1629,8 @@ def test_get_platform(self) -> None: import asyncio import nest_asyncio import threading - - from llama_stack_client._utils import asyncify from llama_stack_client._base_client import get_platform - + from llama_stack_client._utils import asyncify async def test_main() -> None: result = await asyncify(get_platform)() From 2b4d0e5c67980b9c9a22dea355a4d5cee8a8b029 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 13:02:23 -0800 Subject: [PATCH 10/12] test_client --- tests/test_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_client.py b/tests/test_client.py index f3fec488..3134d6be 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1629,6 +1629,7 @@ def test_get_platform(self) -> None: import asyncio import nest_asyncio import threading + from llama_stack_client._base_client import get_platform from llama_stack_client._utils import asyncify From 8c0083a847ce5771f104520af59ff1f8276a5371 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 13:03:41 -0800 Subject: [PATCH 11/12] test_client --- .github/workflows/pre-commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index dd1a5c6c..2410f90d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -16,10 +16,10 @@ jobs: - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: - python-version: '3.11' + python-version: '3.11.10' cache: pip cache-dependency-path: | **/requirements*.txt .pre-commit-config.yaml - - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1 + - uses: pre-commit/action@v5.0.0 From 61220202210c6eb7146a29df6e16fa2a1357e2b6 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 9 Jan 2025 13:05:56 -0800 Subject: [PATCH 12/12] ver --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 2410f90d..58853453 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -22,4 +22,4 @@ jobs: **/requirements*.txt .pre-commit-config.yaml - - uses: pre-commit/action@v5.0.0 + - uses: pre-commit/action@v3.0.1