diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f278032..4650d7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,8 @@ By participating, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md > **Linux** is the recommended environment for development and performance benchmarking. ### Prerequisites -- Python 3.10 - 3.14 + +- Python 3.10 - 3.14 (64-bit only) - CMake ≥ 3.26, < 4.0 (`cmake --version`) - A C++17-compatible compiler (e.g., `g++-11+`, `clang++`, Apple Clang on macOS) diff --git a/README_CN.md b/README_CN.md index d53768d..4ad14c6 100644 --- a/README_CN.md +++ b/README_CN.md @@ -59,7 +59,7 @@ Zvec 提供多语言官方 SDK: -- **[Python](https://pypi.org/project/zvec/)**:`pip install zvec`(需 Python 3.10–3.14) +- **[Python](https://pypi.org/project/zvec/)**:`pip install zvec`(需 64 位 Python 3.10–3.14) - **[Node.js](https://www.npmjs.com/package/@zvec/zvec)**:`npm install @zvec/zvec` - **[Go](https://github.com/zvec-ai/zvec-go)**:高性能的 Go 绑定。 - **[Rust](https://github.com/zvec-ai/zvec-rust)**:高性能的 Rust 绑定。 diff --git a/pyproject.toml b/pyproject.toml index 4f7add5..dbbe26c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ maintainers = [ { name = "Zvec Core Team", email = "zvec@alibaba-inc.com" }, ] -requires-python = ">=3.9" +requires-python = ">=3.9" # NOTE: Only 64-bit Python interpreters are supported. classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", diff --git a/python/zvec/__init__.py b/python/zvec/__init__.py index cfda0a4..d75a391 100644 --- a/python/zvec/__init__.py +++ b/python/zvec/__init__.py @@ -20,6 +20,15 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: from importlib.metadata import PackageNotFoundError +# zvec ships a native C++ extension that is only built and tested for 64-bit +# CPython. A 32-bit interpreter would fail to load the extension with an +# obscure error, so fail fast here with an actionable message. +if sys.maxsize <= 2**32: + raise ImportError( + "zvec requires a 64-bit Python interpreter; " + "the current interpreter is 32-bit and is not supported." + ) + # Register the wheel-bundled jieba dict dir so `import zvec` alone makes # the jieba FTS tokenizer usable. Users can still override via