mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-27 06:28:50 +00:00
feat: use XDG directory standards
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
This commit is contained in:
parent
9736f096f6
commit
407c3e3bad
50 changed files with 5611 additions and 508 deletions
|
@ -7,12 +7,35 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
LLAMA_STACK_CONFIG_DIR = Path(os.getenv("LLAMA_STACK_CONFIG_DIR", os.path.expanduser("~/.llama/")))
|
||||
from .xdg_utils import (
|
||||
get_llama_stack_config_dir,
|
||||
get_llama_stack_data_dir,
|
||||
get_llama_stack_state_dir,
|
||||
)
|
||||
|
||||
# Base directory for all llama-stack configuration
|
||||
# This now uses XDG-compliant paths with backwards compatibility
|
||||
LLAMA_STACK_CONFIG_DIR = get_llama_stack_config_dir()
|
||||
|
||||
# Distribution configurations - stored in config directory
|
||||
DISTRIBS_BASE_DIR = LLAMA_STACK_CONFIG_DIR / "distributions"
|
||||
|
||||
DEFAULT_CHECKPOINT_DIR = LLAMA_STACK_CONFIG_DIR / "checkpoints"
|
||||
# Model checkpoints - stored in data directory (persistent data)
|
||||
DEFAULT_CHECKPOINT_DIR = get_llama_stack_data_dir() / "checkpoints"
|
||||
|
||||
RUNTIME_BASE_DIR = LLAMA_STACK_CONFIG_DIR / "runtime"
|
||||
# Runtime data - stored in state directory
|
||||
RUNTIME_BASE_DIR = get_llama_stack_state_dir() / "runtime"
|
||||
|
||||
# External providers - stored in config directory
|
||||
EXTERNAL_PROVIDERS_DIR = LLAMA_STACK_CONFIG_DIR / "providers.d"
|
||||
|
||||
# Legacy compatibility: if the legacy environment variable is set, use it for all paths
|
||||
# This ensures that existing installations continue to work
|
||||
legacy_config_dir = os.getenv("LLAMA_STACK_CONFIG_DIR")
|
||||
if legacy_config_dir:
|
||||
legacy_base = Path(legacy_config_dir)
|
||||
LLAMA_STACK_CONFIG_DIR = legacy_base
|
||||
DISTRIBS_BASE_DIR = legacy_base / "distributions"
|
||||
DEFAULT_CHECKPOINT_DIR = legacy_base / "checkpoints"
|
||||
RUNTIME_BASE_DIR = legacy_base / "runtime"
|
||||
EXTERNAL_PROVIDERS_DIR = legacy_base / "providers.d"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue