mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
test(api): pre-commit check to ensure API does not import llama_stack
since llama_stack_api is meant to be _just_ the API definitions of LLS, we should have a check in pre-commit that prohibits anyone from accidentally importing `from llama_stack` or adding `llama_stack` as a dependency into `llama_stack_api`s pyproject. Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
eb545034ab
commit
a213134f1a
1 changed files with 21 additions and 0 deletions
|
|
@ -200,6 +200,27 @@ repos:
|
||||||
echo;
|
echo;
|
||||||
exit 1;
|
exit 1;
|
||||||
} || true
|
} || true
|
||||||
|
- id: check-api-independence
|
||||||
|
name: Ensure llama_stack_api does not import llama_stack
|
||||||
|
entry: bash
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
require_serial: true
|
||||||
|
always_run: true
|
||||||
|
files: ^src/llama_stack_api/.*$
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
API_DIR="src/llama_stack_api"
|
||||||
|
grep -rn --include="*.py" -E '^[^#]*(import llama_stack\b|from llama_stack\b)' "$API_DIR" 2>/dev/null && {
|
||||||
|
echo "llama_stack_api must not import llama_stack";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
[ -f "$API_DIR/pyproject.toml" ] && grep -n 'llama_stack[^_]' "$API_DIR/pyproject.toml" && {
|
||||||
|
echo "llama_stack_api must not depend on llama_stack in pyproject.toml";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
|
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue