add some env in ci

This commit is contained in:
yichuan520030910320
2025-07-28 16:11:44 -07:00
parent b124709bcd
commit 27d0d73f99
5 changed files with 16 additions and 5 deletions

View File

@@ -204,7 +204,7 @@ jobs:
# Create a virtual environment
uv venv
source .venv/bin/activate || source .venv/Scripts/activate
# Install the built wheels
if [[ "${{ matrix.os }}" == ubuntu-* ]]; then
uv pip install packages/leann-core/dist/*.whl
@@ -226,7 +226,7 @@ jobs:
run: |
# Activate virtual environment
source .venv/bin/activate || source .venv/Scripts/activate
# Run all tests
pytest tests/
@@ -234,7 +234,7 @@ jobs:
run: |
# Activate virtual environment
source .venv/bin/activate || source .venv/Scripts/activate
# Run distance function tests if available
if [ -f test/sanity_checks/test_distance_functions.py ]; then
echo "Running distance function sanity checks..."

2
.gitignore vendored
View File

@@ -86,3 +86,5 @@ packages/leann-backend-diskann/third_party/DiskANN/_deps/
*.passages.json
batchtest.py
tests/__pytest_cache__/
tests/__pycache__/

View File

@@ -10,12 +10,12 @@ if(APPLE)
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY "/opt/homebrew/opt/libomp/lib/libomp.dylib")
# Force use of system libc++ to avoid version mismatch
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
# Set minimum macOS version for better compatibility
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS version")
endif()

View File

@@ -8,6 +8,10 @@ if platform.system() == "Darwin":
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
os.environ["KMP_BLOCKTIME"] = "0"
# Additional fixes for PyTorch/sentence-transformers on macOS ARM64 only in CI
if os.environ.get("CI") == "true":
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "0"
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from .api import LeannBuilder, LeannChat, LeannSearcher
from .registry import BACKEND_REGISTRY, autodiscover_backends

View File

@@ -23,6 +23,11 @@ from .registry import BACKEND_REGISTRY
logger = logging.getLogger(__name__)
def get_registered_backends() -> list[str]:
"""Get list of registered backend names."""
return list(BACKEND_REGISTRY.keys())
def compute_embeddings(
chunks: list[str],
model_name: str,