mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
chore(package): migrate to src/ layout (#3920)
Migrates package structure to src/ layout following Python packaging best practices. All code moved from `llama_stack/` to `src/llama_stack/`. Public API unchanged - imports remain `import llama_stack.*`. Updated build configs, pre-commit hooks, scripts, and GitHub workflows accordingly. All hooks pass, package builds cleanly. **Developer note**: Reinstall after pulling: `pip install -e .`
This commit is contained in:
parent
98a5047f9d
commit
471b1b248b
791 changed files with 2983 additions and 456 deletions
39
src/llama_stack/cli/table.py
Normal file
39
src/llama_stack/cli/table.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from collections.abc import Iterable
|
||||
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
|
||||
def print_table(rows, headers=None, separate_rows: bool = False, sort_by: Iterable[int] = tuple()):
|
||||
# Convert rows and handle None values
|
||||
rows = [[x or "" for x in row] for row in rows]
|
||||
|
||||
# Sort rows if sort_by is specified
|
||||
if sort_by:
|
||||
rows.sort(key=lambda x: tuple(x[i] for i in sort_by))
|
||||
|
||||
# Create Rich table
|
||||
table = Table(show_lines=separate_rows)
|
||||
|
||||
# Add headers if provided
|
||||
if headers:
|
||||
for header in headers:
|
||||
table.add_column(header, style="bold white")
|
||||
else:
|
||||
# Add unnamed columns based on first row
|
||||
for _ in range(len(rows[0]) if rows else 0):
|
||||
table.add_column()
|
||||
|
||||
# Add rows
|
||||
for row in rows:
|
||||
table.add_row(*row)
|
||||
|
||||
# Print table
|
||||
console = Console()
|
||||
console.print(table)
|
||||
Loading…
Add table
Add a link
Reference in a new issue