Skip to content

Commit a0800c3

Browse files
committed
feat: initial cachekit v0.1.0-alpha oss release
Comprehensive Redis caching with: - Zero-config @cache decorator - L1 (in-memory) + L2 (Redis) dual-layer caching - Zero-knowledge encryption (@cache.secure) - Circuit breaker & adaptive timeouts - Rust acceleration (LZ4 + Blake3)
0 parents  commit a0800c3

File tree

271 files changed

+75976
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+75976
-0
lines changed

.cargo/config.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Miri configuration for undefined behavior detection
2+
# MUST be at workspace root - Cargo only reads .cargo/config.toml from workspace root, not package directories
3+
4+
# Environment variables for Miri execution
5+
[env]
6+
# Miri flags for comprehensive undefined behavior detection
7+
# -Zmiri-strict-provenance: Catches pointer provenance violations (use-after-free, invalid pointer arithmetic)
8+
# -Zmiri-symbolic-alignment-check: Detects alignment violations symbolically (not just concrete addresses)
9+
# These flags provide maximum UB detection without false positives
10+
MIRIFLAGS = "-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check"
11+
12+
# NOTE: Do not set [target.'cfg(miri)'].runner - cargo miri handles this automatically
13+
# and it conflicts with rust-cache action's internal config options

.dockerignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Python
7+
__pycache__
8+
*.pyc
9+
*.pyo
10+
*.pyd
11+
.Python
12+
*.egg-info/
13+
dist/
14+
build/
15+
.venv/
16+
venv/
17+
env/
18+
.env
19+
.env.*
20+
21+
# Testing
22+
.pytest_cache/
23+
.coverage
24+
htmlcov/
25+
.tox/
26+
pytest.ini
27+
coverage.xml
28+
29+
# Type checking
30+
.pyright_cache/
31+
.mypy_cache/
32+
33+
# Linting
34+
.ruff_cache/
35+
36+
# IDE
37+
.vscode/
38+
.idea/
39+
*.swp
40+
*.swo
41+
*~
42+
.DS_Store
43+
44+
# Rust and build artifacts
45+
target/
46+
rust/target/
47+
rust/fuzz/
48+
Cargo.lock
49+
50+
# Documentation (but keep README.md for build metadata)
51+
docs/
52+
53+
# CI/CD
54+
.github/
55+
.gitlab-ci.yml
56+
.circleci/
57+
58+
# Build outputs (temporary docker extraction directories)
59+
.dist-linux-build/
60+
dist-linux/
61+
dist-linux-test/
62+
63+
# Misc
64+
logs/
65+
reports/
66+
*.log
67+
tmp/
68+
temp/
69+
.cache/

.github/pull_request_template.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Description
2+
3+
Brief description of the changes in this PR.
4+
5+
## Motivation
6+
7+
Why are these changes needed? What problem do they solve?
8+
9+
## Type of Change
10+
11+
- [ ] Bug fix (non-breaking)
12+
- [ ] New feature (non-breaking)
13+
- [ ] Breaking change
14+
- [ ] Documentation update
15+
16+
---
17+
18+
## Documentation Validation Checklist
19+
20+
**For PRs that change public APIs or features:**
21+
22+
- [ ] If public API changed: Updated `docs/features/*.md` or created new feature doc
23+
- [ ] Manually tested ALL code examples by copy-paste to Python REPL
24+
- [ ] Clicked all links in documentation (internal and external)
25+
- [ ] If competitive claims changed: Ran `pytest tests/competitive/ -v` and updated `docs/validation/VALIDATION_LOG.md`
26+
- [ ] Code examples are copy-paste executable (tested in REPL)
27+
- [ ] Feature documentation includes: TL;DR, Quickstart, Deep Dive, Troubleshooting sections
28+
- [ ] Added/updated cross-links to related features in `docs/`
29+
30+
**For PRs that DON'T change public APIs:**
31+
- [ ] No documentation changes required
32+
33+
---
34+
35+
## Testing
36+
37+
- [ ] Unit tests added/updated
38+
- [ ] Integration tests added/updated
39+
- [ ] Tests pass: `make test-critical`
40+
- [ ] No test regressions
41+
42+
---
43+
44+
## Additional Notes
45+
46+
Any additional context or notes for reviewers?

.github/workflows/ci.yml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
checks: write
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
RUST_BACKTRACE: 1
17+
REDIS_DISABLE_HIREDIS: true
18+
DEFAULT_PYTHON_VERSION: "3.12"
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
# Fast version consistency check
26+
version-check:
27+
name: Version Sync
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 5
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Check Python ↔ Rust version consistency
34+
run: |
35+
PYTHON_VERSION=$(grep -E "^version = " pyproject.toml | head -1 | cut -d'"' -f2)
36+
RUST_VERSION=$(grep -E "^version = " rust/Cargo.toml | head -1 | cut -d'"' -f2)
37+
38+
echo "Python: $PYTHON_VERSION"
39+
echo "Rust: $RUST_VERSION"
40+
41+
if [ "$PYTHON_VERSION" != "$RUST_VERSION" ]; then
42+
echo "❌ Version mismatch!"
43+
exit 1
44+
fi
45+
echo "✅ Versions in sync: $PYTHON_VERSION"
46+
47+
# Fast format & lint checks (parallel)
48+
quick-check:
49+
name: Format & Lint
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 10
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v3
57+
with:
58+
enable-cache: true
59+
60+
- name: Set up Python
61+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
62+
63+
- name: Set up Rust
64+
uses: dtolnay/rust-toolchain@stable
65+
with:
66+
components: rustfmt, clippy
67+
68+
- name: Cache Rust dependencies
69+
uses: Swatinem/rust-cache@v2
70+
with:
71+
workspaces: rust
72+
73+
- name: Cache Python virtual environment
74+
uses: actions/cache@v4
75+
with:
76+
path: .venv
77+
key: venv-${{ runner.os }}-py${{ env.DEFAULT_PYTHON_VERSION }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
78+
restore-keys: |
79+
venv-${{ runner.os }}-py${{ env.DEFAULT_PYTHON_VERSION }}-
80+
81+
- name: Install dependencies (if not cached)
82+
run: |
83+
uv sync --group dev
84+
85+
- name: Check Python formatting
86+
run: |
87+
uv run ruff format --check .
88+
89+
- name: Lint Python
90+
if: success() || failure()
91+
run: |
92+
uv run ruff check .
93+
94+
- name: Scan Python dependencies for CVEs
95+
if: success() || failure()
96+
run: |
97+
uv run pip-audit --desc
98+
99+
- name: Type check Python
100+
if: success() || failure()
101+
run: |
102+
uv run basedpyright --level error
103+
104+
- name: Check Rust formatting
105+
if: success() || failure()
106+
run: |
107+
cd rust && cargo fmt --check
108+
109+
- name: Lint Rust
110+
if: success() || failure()
111+
run: |
112+
cd rust && cargo clippy -- -D warnings
113+
114+
# Critical test suite (parallel matrix)
115+
test-critical:
116+
name: Tests (Python ${{ matrix.python-version }})
117+
runs-on: ubuntu-latest
118+
timeout-minutes: 15
119+
strategy:
120+
fail-fast: false
121+
matrix:
122+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
123+
124+
services:
125+
redis:
126+
image: redis:7-alpine
127+
ports:
128+
- 6379:6379
129+
options: >-
130+
--health-cmd "redis-cli ping"
131+
--health-interval 10s
132+
--health-timeout 5s
133+
--health-retries 5
134+
135+
steps:
136+
- uses: actions/checkout@v4
137+
138+
- name: Install uv
139+
uses: astral-sh/setup-uv@v3
140+
with:
141+
enable-cache: true
142+
143+
- name: Set up Python
144+
run: uv python install ${{ matrix.python-version }}
145+
146+
- name: Set up Rust
147+
uses: dtolnay/rust-toolchain@stable
148+
149+
- name: Cache Rust dependencies
150+
uses: Swatinem/rust-cache@v2
151+
with:
152+
workspaces: rust
153+
154+
- name: Cache Python virtual environment
155+
uses: actions/cache@v4
156+
with:
157+
path: .venv
158+
key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
159+
restore-keys: |
160+
venv-${{ runner.os }}-py${{ matrix.python-version }}-
161+
162+
- name: Install dependencies (if not cached)
163+
run: |
164+
uv sync --group dev
165+
166+
- name: Run critical tests
167+
env:
168+
REDIS_URL: redis://localhost:6379
169+
run: |
170+
make test-critical
171+
172+
# Markdown documentation tests
173+
test-docs:
174+
name: Documentation Examples
175+
runs-on: ubuntu-latest
176+
timeout-minutes: 10
177+
steps:
178+
- uses: actions/checkout@v4
179+
180+
- name: Install uv
181+
uses: astral-sh/setup-uv@v3
182+
with:
183+
enable-cache: true
184+
185+
- name: Set up Python
186+
run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }}
187+
188+
- name: Set up Rust
189+
uses: dtolnay/rust-toolchain@stable
190+
191+
- name: Cache Rust dependencies
192+
uses: Swatinem/rust-cache@v2
193+
with:
194+
workspaces: rust
195+
196+
- name: Cache Python virtual environment
197+
uses: actions/cache@v4
198+
with:
199+
path: .venv
200+
key: venv-${{ runner.os }}-py${{ env.DEFAULT_PYTHON_VERSION }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock', 'rust/**/*.rs', 'rust/**/Cargo.toml') }}
201+
restore-keys: |
202+
venv-${{ runner.os }}-py${{ env.DEFAULT_PYTHON_VERSION }}-
203+
204+
- name: Install dependencies (if not cached)
205+
run: |
206+
uv sync --group dev
207+
208+
- name: Run markdown documentation tests
209+
run: |
210+
make test-docs-examples
211+
212+
# Summary job (required for branch protection)
213+
ci-success:
214+
name: CI Success
215+
runs-on: ubuntu-latest
216+
needs: [version-check, quick-check, test-critical, test-docs]
217+
if: always()
218+
steps:
219+
- name: Check all jobs succeeded
220+
run: |
221+
if [[ "${{ needs.version-check.result }}" != "success" ]] || \
222+
[[ "${{ needs.quick-check.result }}" != "success" ]] || \
223+
[[ "${{ needs.test-critical.result }}" != "success" ]] || \
224+
[[ "${{ needs.test-docs.result }}" != "success" ]]; then
225+
echo "❌ One or more jobs failed"
226+
exit 1
227+
fi
228+
echo "✅ All CI checks passed"

0 commit comments

Comments
 (0)