adhara 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.
- adhara-0.1.0/.github/workflows/ci.yml +86 -0
- adhara-0.1.0/.gitignore +11 -0
- adhara-0.1.0/CLAUDE.md +31 -0
- adhara-0.1.0/Cargo.lock +620 -0
- adhara-0.1.0/Cargo.toml +38 -0
- adhara-0.1.0/DEV.md +37 -0
- adhara-0.1.0/LICENSE +21 -0
- adhara-0.1.0/PKG-INFO +115 -0
- adhara-0.1.0/Package.swift +24 -0
- adhara-0.1.0/README.md +87 -0
- adhara-0.1.0/RESULTS.md +94 -0
- adhara-0.1.0/bench/bench_hybrid.py +34 -0
- adhara-0.1.0/bench/bench_tok.py +31 -0
- adhara-0.1.0/bench/common.py +20 -0
- adhara-0.1.0/include/adhara.h +9 -0
- adhara-0.1.0/include/sqlite3.h +14447 -0
- adhara-0.1.0/pyproject.toml +37 -0
- adhara-0.1.0/python/adhara/__init__.py +19 -0
- adhara-0.1.0/scripts/gen_tables.py +25 -0
- adhara-0.1.0/scripts/swift_release.sh +14 -0
- adhara-0.1.0/scripts/xcframework.sh +15 -0
- adhara-0.1.0/src/fold.rs +136 -0
- adhara-0.1.0/src/hybrid.rs +298 -0
- adhara-0.1.0/src/lib.rs +54 -0
- adhara-0.1.0/src/py.rs +40 -0
- adhara-0.1.0/src/tables.rs +273 -0
- adhara-0.1.0/src/tok.rs +134 -0
- adhara-0.1.0/swift/Sources/Adhara/Adhara.swift +117 -0
- adhara-0.1.0/swift/Tests/AdharaTests/AdharaTests.swift +65 -0
- adhara-0.1.0/tests/conftest.py +16 -0
- adhara-0.1.0/tests/test_fold.py +28 -0
- adhara-0.1.0/tests/test_hybrid.py +124 -0
- adhara-0.1.0/tests/test_tok.py +36 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
tags: ['v*']
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.12'
|
|
22
|
+
- run: cargo test --release
|
|
23
|
+
- run: pip install -e '.[dev]'
|
|
24
|
+
- run: pytest -q
|
|
25
|
+
|
|
26
|
+
swift:
|
|
27
|
+
runs-on: macos-15
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
31
|
+
- run: scripts/xcframework.sh
|
|
32
|
+
- run: swift test
|
|
33
|
+
|
|
34
|
+
build:
|
|
35
|
+
needs: test
|
|
36
|
+
strategy:
|
|
37
|
+
fail-fast: false
|
|
38
|
+
matrix:
|
|
39
|
+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14, macos-15-intel]
|
|
40
|
+
runs-on: ${{ matrix.os }}
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: PyO3/maturin-action@v1
|
|
44
|
+
with:
|
|
45
|
+
args: --profile dist --out dist
|
|
46
|
+
manylinux: 2_28 # usearch's numkong needs a newer gcc than manylinux2014 has
|
|
47
|
+
- uses: actions/upload-artifact@v4
|
|
48
|
+
with:
|
|
49
|
+
name: wheels-${{ matrix.os }}
|
|
50
|
+
path: dist
|
|
51
|
+
|
|
52
|
+
sdist:
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
- uses: PyO3/maturin-action@v1
|
|
57
|
+
with:
|
|
58
|
+
command: sdist
|
|
59
|
+
args: -o dist
|
|
60
|
+
- uses: actions/upload-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: wheels-sdist
|
|
63
|
+
path: dist
|
|
64
|
+
|
|
65
|
+
publish:
|
|
66
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
67
|
+
needs: [build, sdist, swift]
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
permissions:
|
|
70
|
+
contents: write
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/download-artifact@v4
|
|
73
|
+
with:
|
|
74
|
+
pattern: wheels-*
|
|
75
|
+
path: dist
|
|
76
|
+
merge-multiple: true
|
|
77
|
+
- uses: softprops/action-gh-release@v2
|
|
78
|
+
with:
|
|
79
|
+
files: dist/*
|
|
80
|
+
generate_release_notes: true
|
|
81
|
+
- uses: PyO3/maturin-action@v1
|
|
82
|
+
env:
|
|
83
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
84
|
+
with:
|
|
85
|
+
command: upload
|
|
86
|
+
args: --non-interactive --skip-existing dist/*
|
adhara-0.1.0/.gitignore
ADDED
adhara-0.1.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Working in this repo
|
|
2
|
+
|
|
3
|
+
The Rust code in `src/` is the source. The Python package (`python/adhara`) and the Swift package (`swift/`, `Package.swift`) are thin layers over it. `scripts/gen_tables.py` writes `src/tables.rs`. Never edit `src/tables.rs` by hand.
|
|
4
|
+
|
|
5
|
+
## The one rule
|
|
6
|
+
|
|
7
|
+
adhara gives the results of litesearch. A faster method that changes a result is a bug. The tests in `tests/` compare adhara with litesearch directly.
|
|
8
|
+
|
|
9
|
+
- The folds equal `litesearch/sanskrit.py` on every word of the test corpus.
|
|
10
|
+
- The tokens equal the litesearch chain. One apsw quirk is the exception. `RESULTS.md` describes it.
|
|
11
|
+
- `adhara_hybrid` returns the rows of litesearch `search` in the same order. `ann` selects the HNSW search or the exact search, as `ann` does in litesearch.
|
|
12
|
+
|
|
13
|
+
## Three parts
|
|
14
|
+
|
|
15
|
+
- `fold.rs` is the port of `sanskrit.py`. It does not use SQLite.
|
|
16
|
+
- `tok.rs` is the FTS5 tokenizer `adhara`. Porter goes outside it (`porter adhara`), as litesearch puts porter outside its chain.
|
|
17
|
+
- `hybrid.rs` is the table function `adhara_hybrid`. It reads the litesearch schema: `<store>`, `<store>_fts` and `usearch_indices`.
|
|
18
|
+
|
|
19
|
+
## Builds
|
|
20
|
+
|
|
21
|
+
- `--features python` builds the Python module. The same file is the SQLite extension (`sqlite3_adhara_init`).
|
|
22
|
+
- `--features static` builds SQLite into the library, for Swift (`adhara_register`). This build also registers `simplify` for the litesearch chain. The extension does not, because apsw registers its own `simplify` on a Python connection.
|
|
23
|
+
- A change in tokens needs a new tokenizer name. Do not change the behaviour of an existing name. FTS5 tokenizes old content again on delete, so a changed token corrupts an index.
|
|
24
|
+
|
|
25
|
+
## Numbers
|
|
26
|
+
|
|
27
|
+
Each speed claim has a row in `RESULTS.md` and a script in `bench/`. Change the number before you change the claim.
|
|
28
|
+
|
|
29
|
+
## Licence
|
|
30
|
+
|
|
31
|
+
MIT.
|