Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix: fix_build (#6)

kkkwjxee5cfd018194
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 4bc8a551a..9c1f18e3a 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -12,6 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
+ python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
@@ -21,12 +22,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
- python-version: '3.11'
+ python-version: ${{ matrix.python-version }}
- name: Set up Go
uses: actions/setup-go@v6
with:
- go-version: '1.21'
+ go-version: '1.25'
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -58,10 +59,22 @@ jobs:
- name: Build package
run: uv run python -m build
+ - name: Repair wheels (Linux)
+ if: runner.os == 'Linux'
+ run: |
+ uv pip install auditwheel
+ # Repair wheels and output to a temporary directory
+ uv run auditwheel repair dist/*.whl -w dist_fixed
+ # Remove original non-compliant wheels
+ rm dist/*.whl
+ # Move repaired wheels back to dist
+ mv dist_fixed/*.whl dist/
+ rmdir dist_fixed
+
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
- name: python-package-distributions-${{ matrix.os }}
+ name: python-package-distributions-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/
publish-to-pypi:
diff --git a/MANIFEST.in b/MANIFEST.in
index 6cffec3c8..deea70263 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,6 +4,7 @@ graft third_party/spdlog-1.14.1
graft third_party/croaring
graft third_party/rapidjson
recursive-include third_party/agfs/agfs-server *.go go.mod go.sum Makefile
+recursive-include third_party/agfs/agfs-sdk/go *.go go.mod
include third_party/agfs/bin/agfs-server
include LICENSE
include README.md
diff --git a/openviking/utils/config/open_viking_config.py b/openviking/utils/config/open_viking_config.py
index bd442e9b9..5b0aea451 100644
--- a/openviking/utils/config/open_viking_config.py
+++ b/openviking/utils/config/open_viking_config.py
@@ -100,7 +100,7 @@ class OpenVikingConfig(BaseModel):
)
log_level: str = Field(
- default="INFO", description="Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL"
+ default="WARNING", description="Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL"
)
log_format: str = Field(
diff --git a/pyproject.toml b/pyproject.toml
index f376e78df..e5e7f39aa 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,13 +9,13 @@ build-backend = "setuptools.build_meta"
[project]
name = "openviking"
-version = "0.1.2"
+version = "0.1.5"
description = "An Agent-native context database: Data in, Context out"
readme = "README.md"
authors = [
{name = "ByteDance", email = "[email protected]"}
]
-license = "Apache-2.0"
+license = { text = "Apache-2.0" }
requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
diff --git a/setup.py b/setup.py
index 2d6b927a2..bfd4e365c 100644
--- a/setup.py
+++ b/setup.py
@@ -21,70 +21,77 @@ class CMakeBuildExtension(build_ext):
for ext in self.extensions:
self.build_extension(ext)
+ def _copy_binary(self, src, dst):
+ """Helper to copy binary and set permissions."""
+ print(f"Copying AGFS binary from {src} to {dst}")
+ dst.parent.mkdir(parents=True, exist_ok=True)
+ shutil.copy2(str(src), str(dst))
+ if sys.platform != "win32":
+ os.chmod(str(dst), 0o755)
+
def build_agfs(self):
"""Build AGFS server, fallback to prebuilt binary if build fails."""
- agfs_server_dir = Path("third_party/agfs/agfs-server").resolve()
+ # Paths
binary_name = "agfs-server.exe" if sys.platform == "win32" else "agfs-server"
+ agfs_server_dir = Path("third_party/agfs/agfs-server").resolve()
agfs_prebuilt_binary = Path(f"third_party/agfs/bin/{binary_name}").resolve()
+
+ # Target in source tree (for development/install)
agfs_bin_dir = Path("openviking/bin").resolve()
agfs_target_binary = agfs_bin_dir / binary_name
- agfs_bin_dir.mkdir(parents=True, exist_ok=True)
-
+ # 1. Try to build from source
build_success = False
- if agfs_server_dir.exists():
- go_executable = shutil.which("go")
- if go_executable:
- print("Building AGFS server from source...")
- import subprocess
- try:
- if sys.platform == "win32":
- # Now that we fixed the code compatibility, we can use go build directly on Windows
- build_cmd = ["go", "build", "-o", f"build/{binary_name}", "cmd/server/main.go"]
- else:
- build_cmd = ["make", "build"]
-
- subprocess.run(
- build_cmd,
- cwd=str(agfs_server_dir),
- check=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE
- )
-
- agfs_built_binary = agfs_server_dir / "build" / binary_name
- if agfs_built_binary.exists():
- shutil.copy2(str(agfs_built_binary), str(agfs_target_binary))
- if sys.platform != "win32":
- os.chmod(str(agfs_target_binary), 0o755)
- print(f"[OK] AGFS server built successfully from source")
- build_success = True
- except subprocess.CalledProcessError as e:
- print(f"Warning: Failed to build AGFS from source: {e}")
- if e.stdout:
- print(f"Build stdout:\n{e.stdout.decode('utf-8', errors='replace')}")
- if e.stderr:
- print(f"Build stderr:\n{e.stderr.decode('utf-8', errors='replace')}")
- except Exception as e:
- print(f"Warning: Failed to build AGFS from source: {e}")
- else:
- print("Warning: Go compiler not found, will use prebuilt binary")
+ if agfs_server_dir.exists() and shutil.which("go"):
+ print("Building AGFS server from source...")
+ import subprocess
+ try:
+ build_args = ["go", "build", "-o", f"build/{binary_name}", "cmd/server/main.go"] if sys.platform == "win32" else ["make", "build"]
+
+ subprocess.run(
+ build_args,
+ cwd=str(agfs_server_dir),
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
+ agfs_built_binary = agfs_server_dir / "build" / binary_name
+ if agfs_built_binary.exists():
+ self._copy_binary(agfs_built_binary, agfs_target_binary)
+ print(f"[OK] AGFS server built successfully from source")
+ build_success = True
+ except (subprocess.CalledProcessError, Exception) as e:
+ print(f"Warning: Failed to build AGFS from source: {e}")
+ if isinstance(e, subprocess.CalledProcessError):
+ if e.stdout: print(f"Build stdout:\n{e.stdout.decode('utf-8', errors='replace')}")
+ if e.stderr: print(f"Build stderr:\n{e.stderr.decode('utf-8', errors='replace')}")
+ else:
+ if not agfs_server_dir.exists():
+ print("Warning: AGFS source directory not found")
+ else:
+ print("Warning: Go compiler not found, will use prebuilt binary")
+
+ # 2. Fallback to prebuilt binary if build failed
if not build_success:
if agfs_prebuilt_binary.exists():
print(f"Using prebuilt AGFS binary from {agfs_prebuilt_binary}")
- shutil.copy2(str(agfs_prebuilt_binary), str(agfs_target_binary))
- if sys.platform != "win32":
- os.chmod(str(agfs_target_binary), 0o755)
+ self._copy_binary(agfs_prebuilt_binary, agfs_target_binary)
print(f"[OK] AGFS server copied from prebuilt binary")
else:
- print("Error: No AGFS binary available (build failed and no prebuilt binary found)")
raise FileNotFoundError(
f"AGFS binary not available. Please either:\n"
f" 1. Install Go and build from source, or\n"
f" 2. Ensure prebuilt binary exists at third_party/agfs/bin/{binary_name}"
)
+ # 3. Ensure AGFS binary is copied to the build directory (where wheel is packaged from)
+ if self.build_lib:
+ agfs_bin_dir_build = Path(self.build_lib) / "openviking/bin"
+ dst = agfs_bin_dir_build / binary_name
+ if agfs_target_binary.exists():
+ self._copy_binary(agfs_target_binary, dst)
+
def build_extension(self, ext):
"""Build a single C++ extension module using CMake."""
ext_fullpath = Path(self.get_ext_fullpath(ext.name))