kachedb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. kachedb-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +40 -0
  2. kachedb-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +28 -0
  3. kachedb-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  4. kachedb-0.1.0/.github/workflows/ci.yml +60 -0
  5. kachedb-0.1.0/.github/workflows/publish.yml +53 -0
  6. kachedb-0.1.0/.gitignore +34 -0
  7. kachedb-0.1.0/CHANGELOG.md +140 -0
  8. kachedb-0.1.0/CODE_OF_CONDUCT.md +58 -0
  9. kachedb-0.1.0/CONTRIBUTING.md +56 -0
  10. kachedb-0.1.0/LICENSE-APACHE +176 -0
  11. kachedb-0.1.0/LICENSE-MIT +21 -0
  12. kachedb-0.1.0/Makefile +50 -0
  13. kachedb-0.1.0/PKG-INFO +309 -0
  14. kachedb-0.1.0/README.md +259 -0
  15. kachedb-0.1.0/SECURITY.md +24 -0
  16. kachedb-0.1.0/docs/guides/sglang_integration_guide.md +116 -0
  17. kachedb-0.1.0/docs/guides/vllm_integration_guide.md +153 -0
  18. kachedb-0.1.0/pyproject.toml +94 -0
  19. kachedb-0.1.0/src/kachedb/__init__.py +86 -0
  20. kachedb-0.1.0/src/kachedb/_version.py +1 -0
  21. kachedb-0.1.0/src/kachedb/async_client.py +588 -0
  22. kachedb-0.1.0/src/kachedb/client.py +652 -0
  23. kachedb-0.1.0/src/kachedb/connection.py +191 -0
  24. kachedb-0.1.0/src/kachedb/descriptor.py +208 -0
  25. kachedb-0.1.0/src/kachedb/dma.py +141 -0
  26. kachedb-0.1.0/src/kachedb/exceptions.py +25 -0
  27. kachedb-0.1.0/src/kachedb/integrations/__init__.py +17 -0
  28. kachedb-0.1.0/src/kachedb/integrations/langchain.py +149 -0
  29. kachedb-0.1.0/src/kachedb/integrations/llamaindex.py +89 -0
  30. kachedb-0.1.0/src/kachedb/pipeline.py +371 -0
  31. kachedb-0.1.0/src/kachedb/pool.py +294 -0
  32. kachedb-0.1.0/src/kachedb/py.typed +0 -0
  33. kachedb-0.1.0/src/kachedb/quantizer.py +73 -0
  34. kachedb-0.1.0/src/kachedb/resp.py +252 -0
  35. kachedb-0.1.0/src/kachedb/semantic/__init__.py +27 -0
  36. kachedb-0.1.0/src/kachedb/semantic/cache.py +266 -0
  37. kachedb-0.1.0/src/kachedb/semantic/embedders.py +261 -0
  38. kachedb-0.1.0/src/kachedb/sglang/__init__.py +14 -0
  39. kachedb-0.1.0/src/kachedb/sglang/connector.py +187 -0
  40. kachedb-0.1.0/src/kachedb/sglang/radix_adapter.py +138 -0
  41. kachedb-0.1.0/src/kachedb/tensor.py +206 -0
  42. kachedb-0.1.0/src/kachedb/vllm/__init__.py +13 -0
  43. kachedb-0.1.0/src/kachedb/vllm/connector.py +204 -0
  44. kachedb-0.1.0/src/kachedb/vllm/dma.py +11 -0
  45. kachedb-0.1.0/src/kachedb/vllm/prefix_cache.py +111 -0
  46. kachedb-0.1.0/tests/__init__.py +1 -0
  47. kachedb-0.1.0/tests/conftest.py +123 -0
  48. kachedb-0.1.0/tests/test_async_client.py +31 -0
  49. kachedb-0.1.0/tests/test_batch_vectors.py +120 -0
  50. kachedb-0.1.0/tests/test_client.py +193 -0
  51. kachedb-0.1.0/tests/test_integration.py +120 -0
  52. kachedb-0.1.0/tests/test_integrations.py +144 -0
  53. kachedb-0.1.0/tests/test_phase3.py +157 -0
  54. kachedb-0.1.0/tests/test_pipeline.py +142 -0
  55. kachedb-0.1.0/tests/test_pool.py +37 -0
  56. kachedb-0.1.0/tests/test_resp.py +155 -0
  57. kachedb-0.1.0/tests/test_semantic_cache.py +152 -0
  58. kachedb-0.1.0/tests/test_semantic_standalone.py +134 -0
  59. kachedb-0.1.0/tests/test_sglang_connector.py +262 -0
  60. kachedb-0.1.0/tests/test_tensor.py +148 -0
  61. kachedb-0.1.0/tests/test_vllm_connector.py +149 -0
@@ -0,0 +1,40 @@
1
+ name: "🐛 Bug Report"
2
+ description: "File a bug report for kachedb-py"
3
+ labels: ["bug"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: "Thanks for taking the time to report a bug in `kachedb-py`!"
8
+ - type: textarea
9
+ id: description
10
+ attributes:
11
+ label: "Describe the bug"
12
+ description: "A clear and concise description of what the bug is."
13
+ validations:
14
+ required: true
15
+ - type: textarea
16
+ id: reproduction
17
+ attributes:
18
+ label: "Steps to Reproduce"
19
+ description: "Minimal code snippet or steps to reproduce the issue."
20
+ placeholder: |
21
+ from kachedb import KacheClient
22
+ client = KacheClient()
23
+ ...
24
+ validations:
25
+ required: true
26
+ - type: textarea
27
+ id: expected
28
+ attributes:
29
+ label: "Expected Behavior"
30
+ description: "What you expected to happen."
31
+ validations:
32
+ required: true
33
+ - type: input
34
+ id: environment
35
+ attributes:
36
+ label: "Environment"
37
+ description: "Python version, OS, torch/vllm versions."
38
+ placeholder: "Python 3.11, Ubuntu 24.04, torch 2.4.0, vLLM 0.6.0"
39
+ validations:
40
+ required: false
@@ -0,0 +1,28 @@
1
+ name: "🚀 Feature Request / Proposal"
2
+ description: "Suggest a new feature or improvement for kachedb-py"
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: "Have an idea for `kachedb-py`? We'd love to hear it!"
8
+ - type: textarea
9
+ id: problem
10
+ attributes:
11
+ label: "Problem or Use Case"
12
+ description: "Is your feature request related to a problem or a specific LLM framework?"
13
+ validations:
14
+ required: true
15
+ - type: textarea
16
+ id: proposal
17
+ attributes:
18
+ label: "Proposed Solution"
19
+ description: "A clear and concise description of what you want to happen."
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ id: alternatives
24
+ attributes:
25
+ label: "Alternative Solutions"
26
+ description: "Any alternative solutions or features you've considered."
27
+ validations:
28
+ required: false
@@ -0,0 +1,24 @@
1
+ ## 📋 Description
2
+
3
+ Provide a brief summary of the changes introduced by this Pull Request.
4
+
5
+ - What problem does this solve?
6
+ - What is the new behavior?
7
+
8
+ ---
9
+
10
+ ## 🧪 Testing Checklist
11
+
12
+ - [ ] All unit tests pass: `pytest tests/ -v --ignore=tests/test_integration.py`
13
+ - [ ] Integration tests pass (if applicable): `pytest tests/test_integration.py -v`
14
+ - [ ] Linter checks pass: `ruff check src/ tests/`
15
+ - [ ] Code formatting verified: `ruff format --check src/ tests/`
16
+ - [ ] Type check passes: `mypy src/kachedb/`
17
+ - [ ] Documentation / `README.md` updated (if applicable)
18
+ - [ ] `CHANGELOG.md` updated
19
+
20
+ ---
21
+
22
+ ## 🔗 Related Issues / PRs
23
+
24
+ Closes # (issue number)
@@ -0,0 +1,60 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ env:
14
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
15
+
16
+ jobs:
17
+ lint:
18
+ name: Lint
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.12"
27
+
28
+ - name: Install dependencies
29
+ run: pip install -e ".[dev,torch]"
30
+
31
+ - name: Ruff check
32
+ run: ruff check src/ tests/
33
+
34
+ - name: Ruff format check
35
+ run: ruff format --check src/ tests/
36
+
37
+ - name: Mypy type check
38
+ run: mypy src/kachedb/
39
+
40
+ test:
41
+ name: Test (Python ${{ matrix.python-version }})
42
+ runs-on: ubuntu-latest
43
+ strategy:
44
+ fail-fast: false
45
+ matrix:
46
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
47
+
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Set up Python ${{ matrix.python-version }}
52
+ uses: actions/setup-python@v5
53
+ with:
54
+ python-version: ${{ matrix.python-version }}
55
+
56
+ - name: Install package with dev dependencies
57
+ run: pip install -e ".[dev,torch]"
58
+
59
+ - name: Run unit tests
60
+ run: pytest tests/ -v --ignore=tests/test_integration.py -m "not integration" -x
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write # Required for Trusted Publisher (OIDC)
9
+
10
+ env:
11
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
12
+
13
+ jobs:
14
+ build:
15
+ name: Build Distribution
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Install build tools
26
+ run: pip install build
27
+
28
+ - name: Build sdist and wheel
29
+ run: python -m build
30
+
31
+ - name: Upload distribution artifacts
32
+ uses: actions/upload-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+
37
+ publish:
38
+ name: Publish to PyPI
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment:
42
+ name: pypi
43
+ url: https://pypi.org/project/kachedb/
44
+
45
+ steps:
46
+ - name: Download distribution artifacts
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ - name: Publish to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,34 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ *.egg
8
+ dist/
9
+ build/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv
14
+ .venv/
15
+ venv/
16
+ env/
17
+
18
+ # IDE
19
+ .idea/
20
+ .vscode/
21
+ *.swp
22
+ *.swo
23
+
24
+ # Testing
25
+ .pytest_cache/
26
+ .mypy_cache/
27
+ .ruff_cache/
28
+ htmlcov/
29
+ .coverage
30
+ coverage.xml
31
+
32
+ # OS
33
+ .DS_Store
34
+ Thumbs.db
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `kachedb` Python SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] — 2026-09-09
9
+
10
+ ### Added
11
+ - **Redis Admin & Keyspace Introspection Primitives (`KacheClient`, `AsyncKacheClient`, `Pipeline`, `AsyncPipeline`):**
12
+ - Added `dbsize()`: returns the total number of keys stored in the database.
13
+ - Added `type(key)`: returns the data type of the key (`"string"`, `"vector"`, or `"none"`).
14
+ - Added `flushdb()` and `flushall()`: clears in-memory keyspace and returns `True`.
15
+ - **Server Parity & Compatibility:**
16
+ - 100% feature parity with KacheDB Server `v0.1.0` production release.
17
+ - Aligned documentation links with the official docs site at `https://vubon.github.io/kachedb/`.
18
+
19
+ ---
20
+
21
+ ## [0.1.0b3] — 2026-09-06
22
+
23
+ ### Added
24
+ - **Phase 3 SQ8 Vector Quantization (`kachedb.vector` & `kachedb.semantic`):**
25
+ - Added support for 8-bit Scalar Quantization (SQ8) compressing vector embeddings with 75% memory footprint reduction.
26
+ - Client APIs and semantic caching pipelines seamlessly handle quantized vector queries.
27
+ - **HNSW Vector Indexing Commands:**
28
+ - Added `vindex_create` support for Hierarchical Navigable Small World (`hnsw`) index type with configurable `m` and `ef_construction` parameters.
29
+ - **TLS 1.3 Transport Security & Mutual TLS (`kachedb.ConnectionPool`):**
30
+ - Added native TLS 1.3 encryption across synchronous and asynchronous connection pools (`ssl=True`).
31
+ - Added support for CA certificates (`ssl_ca_certs`), client certificate chains (`ssl_certfile`, `ssl_keyfile`), and hostname verification (`ssl_check_hostname`).
32
+ - **AOF & Administrative Commands:**
33
+ - Added `bgrewriteaof()` command triggering online AOF journal compaction.
34
+
35
+ ---
36
+
37
+ ## [0.1.0b2] — 2026-09-03
38
+
39
+ ### Added
40
+ - **Batch Vector Operations (`KacheClient` & `AsyncKacheClient`):**
41
+ - Added `vadd_batch(index, items)` for bulk ingestion of vector embeddings and payloads in a single network round-trip.
42
+ - Added `vsearch_batch(index, query_vectors, top_k, threshold)` for multi-query simultaneous vector nearest-neighbor search.
43
+ - **AI Ecosystem Integrations (`kachedb.integrations`):**
44
+ - **LangChain:** `KacheDBCache` (exact-match prompt caching) and `KacheDBSemanticCache` (SIMD vector similarity matching).
45
+ - **LlamaIndex:** `KacheDBKVStore` (key-value storage) and `KacheDBIndexStore` (index metadata storage).
46
+ - **Type Checking & Embedder Robustness:**
47
+ - Dynamic type-safe fallback imports across `fastembed`, `sentence-transformers`, `openai`, and `vllm`.
48
+
49
+ ---
50
+
51
+ ## [0.1.0b1] — 2026-08-30
52
+
53
+ ### Added
54
+ - **Complete Redis TTL Lifecycle (`kachedb.KacheClient` & `kachedb.AsyncKacheClient`):**
55
+ - Added `expire`, `pexpire`, `expireat`, `pexpireat`, `ttl`, `pttl`, and `persist`.
56
+ - **Extended Redis Command Primitives:**
57
+ - Added atomic operations: `mset`, `incr`, `decr`, `incrby`, `decrby`, `append`, `strlen`, and `info`.
58
+ - **Async Vector & Semantic Operations (`AsyncKacheClient`):**
59
+ - Added asynchronous vector search and index operations: `vadd`, `vsearch`, `vdel`, and `vstats`.
60
+ - **Asynchronous Semantic Cache (`kachedb.semantic.AsyncSemanticCache`):**
61
+ - Added high-level async intent matching and LLM response caching engine.
62
+ - **Full Pipeline Support (`Pipeline` & `AsyncPipeline`):**
63
+ - Added support for all extended Redis primitives and TTL lifecycle commands in batch pipelines.
64
+
65
+ ---
66
+
67
+ ## [0.1.0a5] — 2026-08-28
68
+
69
+ ### Added
70
+ - **In-Memory Semantic Cache Engine (`kachedb.semantic`):**
71
+ - Added `SemanticCache` class for intent-based LLM query caching matching by cosine similarity ($< 50\ \mu\text{s}$ cache resolution) with automatic TTL eviction and threshold tuning.
72
+ - Added `SearchResult` data class encapsulating matched key, similarity score, and cached response payload.
73
+ - **Pluggable Embedding Providers (`kachedb.semantic.embedders`):**
74
+ - `TransformersEmbedder`: Native HuggingFace `AutoModel` with mean pooling over token embeddings.
75
+ - `FastEmbedAdapter`: Lightweight ONNX Runtime embedding generator via `fastembed`.
76
+ - `SentenceTransformersAdapter`: HuggingFace `SentenceTransformer` adapter.
77
+ - `OpenAIAdapter`: Remote embedding integration with OpenAI (`text-embedding-3-small`).
78
+ - `CallableAdapter`: Wrapper for any custom user embedding function (`Callable[[str], list[float]]`).
79
+ - `MockEmbedder`: Deterministic, zero-dependency token and semantic-cluster pseudo-embedder for local tests and simulations.
80
+ - **Native Vector Client Operations (`kachedb.KacheClient`):**
81
+ - `client.vadd(index, item_id, vector, payload, ex)`: Store vector embedding with optional metadata and TTL.
82
+ - `client.vsearch(index, query_vector, top_k, threshold)`: Nearest-neighbor search returning `[(item_id, similarity, payload), ...]`.
83
+ - `client.vdel(index, item_id)`: Remove vector from named index.
84
+ - `client.vstats(index)`: Retrieve index dimension, active vector count, and RAM footprint.
85
+ - **Test Suite & Type Checking:** Added `tests/test_semantic_cache.py` and `tests/test_semantic_standalone.py` with full type annotations, mypy compliance, and ruff formatting (102/102 tests passing).
86
+
87
+ ---
88
+
89
+ ## [0.1.0a4] — 2026-08-26
90
+
91
+ ### Added
92
+ - **SGLang (RadixAttention) KV-Cache Connector (`kachedb.sglang`):**
93
+ - Added `KacheDBSGLangConnector` for microsecond-tier tree node offloading and prefix restoration via POSIX Shared Memory (`/dev/shm`).
94
+ - Added `KacheDBRadixAdapter` with chained Blake2b hashing for variable-length token slices ($H_k = \text{Blake2b}(H_{\text{parent}} \,\|\, \text{len} \,\|\, \text{tokens})$).
95
+ - Added `RadixNodeDescriptor` for tracking tree node IDs, layer offsets, parent hashes, and metadata.
96
+ - **Universal Multi-Precision DMA (`kachedb.dma` & `TensorCodec`):**
97
+ - Added `TensorCodec` in `kachedb.descriptor` with dynamic registry mapping for `torch.bfloat16` (BF16), `torch.float16` (FP16), `torch.float32` (FP32), and `torch.int8` (INT8).
98
+ - Refactored `KacheDBMemoryManager` into top-level `kachedb.dma`, universally shared across `kachedb.vllm` and `kachedb.sglang` with 100% backward compatibility.
99
+ - **Production Integration Guides:**
100
+ - Added `docs/guides/vllm_integration_guide.md` with multi-GPU CLI flags, programmatic loops, and production `docker-compose.yml`.
101
+ - Added `docs/guides/sglang_integration_guide.md` with RadixAttention tree-branching and multi-precision configurations.
102
+ - **Unit Test Suite:** Added `tests/test_sglang_connector.py` covering variable-length hashing, single/multi-node offloads, branching tree resolution, and multi-precision FP16/BF16/FP32/INT8 bit-exact roundtrips (85/85 tests passing).
103
+ - **Packaging:** Added `sglang = ["torch>=2.0", "sglang>=0.3.0"]` extra to `pyproject.toml`.
104
+
105
+ ---
106
+
107
+ ## [0.1.0a3] — 2026-08-25
108
+
109
+ ### Added
110
+ - **vLLM Distributed KV-Transfer Connector (`kachedb.vllm`):**
111
+ - Added `KacheDBConnector` subclassing vLLM's `KVConnectorBase` for zero-copy PagedAttention block offloading and restoration.
112
+ - Added `KacheDBPrefixCache` for 64-bit deterministic chained token chunk hashing ($H_k = \text{hash}(H_{k-1} + \text{tokens})$).
113
+ - Added `KacheDBMemoryManager` for microsecond-tier PagedAttention block swapping via POSIX Shared Memory (`/dev/shm`).
114
+ - **Unit Test Suite:** Added `tests/test_vllm_connector.py` covering block hash determinism, hash chaining, longest prefix search, and multi-layer PagedAttention tensor restoration (76/76 tests passing).
115
+ - **Packaging Dependencies:** Added `vllm = ["torch>=2.0", "vllm>=0.6.0"]` and `all = [...]` optional extras in `pyproject.toml`.
116
+ - **Documentation:** Added vLLM CLI launch guide (`vllm serve ... --kv-transfer-config`) and programmatic connector usage in `README.md`.
117
+
118
+ ---
119
+
120
+ ## [0.1.0a2] — 2026-08-25
121
+
122
+ ### Added
123
+ - **TensorBlockDescriptor Serialization:**
124
+ - Added `.to_bytes()` method to serialize 64-byte C-ABI descriptor headers to binary buffers.
125
+ - **LLM Precision Support:**
126
+ - Expanded `TensorDType` enum to cover `FP32`, `FP16`, `BF16` (bfloat16), `FP8E4M3`, `FP8E5M2`, `INT8`, and `INT4` precisions.
127
+
128
+ ---
129
+
130
+ ## [0.1.0a1] — 2026-08-23
131
+
132
+ ### Added
133
+ - **Initial Alpha Release of `kachedb` Python SDK:**
134
+ - Synchronous `KacheClient` supporting `PING`, `GET`, `SET` (with `EX`/`PX` TTL), `MGET`, `DEL`, and `EXISTS`.
135
+ - Asynchronous `AsyncKacheClient` with non-blocking `asyncio` networking.
136
+ - Thread-safe `ConnectionPool` and `AsyncConnectionPool` with automatic health checks.
137
+ - `Pipeline` and `AsyncPipeline` for batching multiple commands in a single TCP round-trip.
138
+ - Zero-allocation RESP2/RESP3 streaming protocol reader (`RespReader` and `AsyncRespReader`).
139
+ - Zero-copy tensor memory mapping utilities (`attach_shm`, `read_tensor`, `read_torch_tensor`) via Linux `/dev/shm`.
140
+ - Full PEP 561 type safety annotations with `py.typed` marker.
@@ -0,0 +1,58 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all community spaces, and also applies when
49
+ an individual is officially representing the community in public spaces.
50
+
51
+ ## Attribution
52
+
53
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
54
+ version 2.1, available at
55
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
56
+
57
+ [homepage]: https://www.contributor-covenant.org
58
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
@@ -0,0 +1,56 @@
1
+ # Contributing to KacheDB Python SDK
2
+
3
+ Thank you for your interest in contributing to `kachedb-py`! We welcome contributions from the community.
4
+
5
+ ---
6
+
7
+ ## 🛠️ Development Setup
8
+
9
+ ### 1. Clone & Environment
10
+ ```bash
11
+ git clone https://github.com/vubon/kachedb-py.git
12
+ cd kachedb-py
13
+
14
+ # Create a virtual environment
15
+ python3 -m venv .venv
16
+ source .venv/bin/activate
17
+
18
+ # Install in editable mode with dev dependencies
19
+ pip install -e ".[dev,torch,vllm]"
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 🧪 Testing & Code Quality
25
+
26
+ Before submitting a Pull Request, make sure all tests, linter checks, and type checks pass:
27
+
28
+ ### 1. Run Unit Tests
29
+ ```bash
30
+ pytest tests/ -v --ignore=tests/test_integration.py
31
+ ```
32
+
33
+ ### 2. Run Integration Tests (Requires running KacheDB server on 127.0.0.1:6379)
34
+ ```bash
35
+ pytest tests/test_integration.py -v
36
+ ```
37
+
38
+ ### 3. Linting & Formatting
39
+ ```bash
40
+ ruff check src/ tests/
41
+ ruff format --check src/ tests/
42
+ ```
43
+
44
+ ### 4. Type Checking
45
+ ```bash
46
+ mypy src/kachedb/
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 📦 Pull Request Guidelines
52
+
53
+ 1. **Create a branch:** Use descriptive branch names (e.g. `feat/paged-attention-stream`, `fix/async-pool-timeout`).
54
+ 2. **Write tests:** Every new feature or bug fix must include corresponding tests in `tests/`.
55
+ 3. **Update CHANGELOG.md:** Add your change under the `[Unreleased]` or current alpha release section.
56
+ 4. **Follow Semantic Versioning:** Breaking changes require explicit RFC discussion in GitHub Issues.
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS