pyxvector
pyxvector is a thin, dependency-light Python HTTP client for Xvector — a vector database service that speaks Milvus REST v2 style APIs. It covers collections, partitions, indexes, aliases, entities (insert / upsert / delete / get / query), vector search, hybrid search, RBAC (users / roles / privileges) and bulk-import jobs.
Supported Python versions
pyxvector supports Python 3.9 – 3.13 (any Python >= 3.9):
| Python version | Supported |
|---|---|
| 3.9 | ✅ |
| 3.10 | ✅ |
| 3.11 | ✅ |
| 3.12 | ✅ |
| 3.13 | ✅ |
Dependencies
pyxvector only requires one runtime dependency:
| Package | Version constraint |
|---|---|
| httpx | >=0.27,<1 |
Install from PyPI:
pip install pyxvector
Quick start
from pyxvector import XvectorClient
client = XvectorClient(uri="http://127.0.0.1:19530", token="root:Xvector")
# 1. Create a collection with an Int64 primary key and a 4-dim float vector field
client.create_collection(
"demo",
schema={
"fields": [
{"name": "id", "dataType": "Int64", "isPrimaryKey": True},
{"name": "vector", "dataType": "FloatVector", "dim": 4},
]
},
)
# 2. Create an index and load the collection into memory
client.create_index("demo", "vector", index_type="FLAT", metric_type="L2")
client.load_collection("demo")
# 3. Insert rows
client.insert("demo", [{"id": 1, "vector": [0.1, 0.2, 0.3, 0.4]}])
# 4. Search immediately after write (refresh=True forces read-after-write consistency;
# otherwise writes become visible within ~10s)
hits = client.search(
"demo",
[[0.1, 0.2, 0.3, 0.4]],
anns_field="vector",
limit=3,
refresh=True,
)
print(hits)
# 5. Clean up
client.drop_collection("demo")
client.close()
XvectorClient is also a context manager:
from pyxvector import XvectorClient
with XvectorClient(uri="http://127.0.0.1:19530", token="root:Xvector") as client:
print(client.list_collections())
Multi-database
client.using_database("my_db") # subsequent calls target the "my_db" database
Error handling
All server-side errors are raised as XvectorApiError (a subclass of XvectorError), carrying the numeric code and message returned by the server:
from pyxvector import XvectorClient, XvectorApiError
client = XvectorClient(uri="http://127.0.0.1:19530", token="root:Xvector")
try:
client.describe_collection("not_exist")
except XvectorApiError as e:
print(e.code, e.message)
API overview
All methods map 1:1 to the Milvus REST v2 style endpoints (/v2/vectordb/...) exposed by Xvector.
| Area | Methods |
|---|---|
| Collection | create_collection, drop_collection, describe_collection, has_collection, list_collections, rename_collection, load_collection, release_collection, get_load_state, get_collection_stats |
| Partition | create_partition, drop_partition, has_partition, list_partitions, load_partitions, release_partitions, get_partition_stats |
| Index | create_index, describe_index, drop_index, list_indexes |
| Alias | create_alias, drop_alias, alter_alias, describe_alias, list_aliases |
| Entities | insert, upsert, delete, get, query |
| Search | search, hybrid_search, search_after_write |
| Database | create_database, drop_database, list_databases, describe_database |
| User | create_user, drop_user, list_users, describe_user, update_password, grant_role, revoke_role |
| Role | create_role, drop_role, list_roles, describe_role, grant_privilege, revoke_privilege |
| Import | create_import_job, get_import_progress, list_import_jobs |
| Helpers | wait_loaded, wait_import_complete, close |
More examples
Hybrid search with RRF rerank
client.hybrid_search(
"demo",
search=[
{"data": [[0.1, 0.2, 0.3, 0.4]], "annsField": "vector", "limit": 10},
],
rerank={"strategy": "rrf", "params": {"k": 60}},
limit=5,
)
Filtered query
rows = client.query("demo", filter="id >= 1", output_fields=["id"], limit=100, refresh=True)
Bulk import from files
job = client.create_import_job("demo", files=["/data/batch1.json"], format="json")
client.wait_import_complete(job["jobId"])
Wait until a collection is loaded
client.load_collection("demo")
client.wait_loaded("demo", timeout=30)
Project links
- Project home / Xvector server: https://github.com/lxl0928/Xvector
- pyxvector source: https://github.com/lxl0928/pyxvector
- Issue tracker: https://github.com/lxl0928/Xvector/issues
- PyPI: https://pypi.org/project/pyxvector/
GitHub statistics
Live stats for the Xvector repository:
Maintainers
- Li Xiaolong (Timilong) — timilong928@gmail.com — github.com/lxl0928
License
Metadata
Release files for pyxvector 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxvector-1.0.0.tar.gz | 10.1 kB | Without provenance | Details for pyxvector-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxvector-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyxvector-1.0.0-py3-none-any.whl |
Total release size: 18.7 kB
Release files / pyxvector-1.0.0.tar.gz
| Download URL | pyxvector-1.0.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376b80c922596b43b191505fcd08ae5b17c33ffa61501a0b7b4653fc3830ab0f
|
|
BLAKE2b-256 checksum How to use checksums |
26ec6fb7585f935a6eb19f7bce6c57126091ab31ad4d499a411e91dac8fdb332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / pyxvector-1.0.0-py3-none-any.whl
| Download URL | pyxvector-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d675ff95319a0d8dac8b5d4d0ca5fedfd2de223c2d29f5865bc37e4efb6837b
|
|
BLAKE2b-256 checksum How to use checksums |
85599ec7ec53b42a8abfa68f929b96118088c0305f0b09d60099d61da0af3ac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Security for pyxvector 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.