mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-02 04:28:46 +00:00
Add version command with comprehensive unit tests and build integration
- Implement llama version command with table and JSON output formats - Add build-time git information capture via scripts/generate_build_info.py - Include comprehensive unit test suite (test_version.py, test_version_simple.py, test_version_integration.py) - Add build system integration with custom setup.py command - Update .gitignore to exclude generated build info file Features: - Display Llama Stack and client versions - Show Python version and build information (git commit, date, branch, tag) - Optional component/provider listing organized by API - Support for both table and JSON output formats - Build-time capture of git metadata for version tracking Testing: - 8 unit tests covering all functionality - Integration tests for CLI execution - Simple dependency-free validation tests - Documentation for test suite and build process Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
This commit is contained in:
parent
dbdc811d16
commit
1da7714bab
11 changed files with 1431 additions and 1 deletions
53
setup.py
Executable file
53
setup.py
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# 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.
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
|
||||
class BuildWithBuildInfo(build_py):
|
||||
"""Custom build command that generates build info before building"""
|
||||
|
||||
def run(self):
|
||||
# Generate build info before building
|
||||
self.generate_build_info()
|
||||
# Run the standard build
|
||||
super().run()
|
||||
|
||||
def generate_build_info(self):
|
||||
"""Generate build_info.py with current git information"""
|
||||
script_path = Path(__file__).parent / "scripts" / "generate_build_info.py"
|
||||
|
||||
try:
|
||||
# Run the build info generation script
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(script_path)],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
print("Build info generation completed successfully")
|
||||
if result.stdout:
|
||||
print(result.stdout)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Warning: Failed to generate build info: {e}")
|
||||
if e.stderr:
|
||||
print(f"Error output: {e.stderr}")
|
||||
# Don't fail the build, just continue with default values
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup(
|
||||
cmdclass={
|
||||
"build_py": BuildWithBuildInfo,
|
||||
},
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue