fm-index 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.
- fm_index-0.1.0/.github/workflows/CI.yml +265 -0
- fm_index-0.1.0/.gitignore +77 -0
- fm_index-0.1.0/Cargo.lock +192 -0
- fm_index-0.1.0/Cargo.toml +15 -0
- fm_index-0.1.0/LICENSE +7 -0
- fm_index-0.1.0/PKG-INFO +42 -0
- fm_index-0.1.0/README.md +1 -0
- fm_index-0.1.0/benchmarks/__init__.py +0 -0
- fm_index-0.1.0/benchmarks/bench_fm_index.py +51 -0
- fm_index-0.1.0/benchmarks/bench_multi_fm_index.py +55 -0
- fm_index-0.1.0/docs/fm_index.html +473 -0
- fm_index-0.1.0/docs/index.html +7 -0
- fm_index-0.1.0/fm_index.pyi +28 -0
- fm_index-0.1.0/pyproject.toml +97 -0
- fm_index-0.1.0/src/fm_index/base_fm_index.rs +231 -0
- fm_index-0.1.0/src/fm_index/fm_index.rs +174 -0
- fm_index-0.1.0/src/fm_index/mod.rs +4 -0
- fm_index-0.1.0/src/fm_index/multi_fm_index.rs +331 -0
- fm_index-0.1.0/src/lib.rs +14 -0
- fm_index-0.1.0/src/python/fm_index.rs +557 -0
- fm_index-0.1.0/src/python/mod.rs +2 -0
- fm_index-0.1.0/src/python/multi_fm_index.rs +1064 -0
- fm_index-0.1.0/src/utils/bit_vector.rs +291 -0
- fm_index-0.1.0/src/utils/bit_width.rs +36 -0
- fm_index-0.1.0/src/utils/mod.rs +4 -0
- fm_index-0.1.0/src/utils/suffix_array.rs +372 -0
- fm_index-0.1.0/src/utils/wavelet_matrix.rs +349 -0
- fm_index-0.1.0/tests/__init__.py +0 -0
- fm_index-0.1.0/tests/test_fm_index.py +82 -0
- fm_index-0.1.0/tests/test_multi_fm_index.py +193 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.9.6
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
needs: [cargo-test, python-test]
|
|
24
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
25
|
+
strategy:
|
|
26
|
+
matrix:
|
|
27
|
+
platform:
|
|
28
|
+
- runner: ubuntu-22.04
|
|
29
|
+
target: x86_64
|
|
30
|
+
- runner: ubuntu-22.04
|
|
31
|
+
target: x86
|
|
32
|
+
- runner: ubuntu-22.04
|
|
33
|
+
target: aarch64
|
|
34
|
+
- runner: ubuntu-22.04
|
|
35
|
+
target: armv7
|
|
36
|
+
- runner: ubuntu-22.04
|
|
37
|
+
target: s390x
|
|
38
|
+
- runner: ubuntu-22.04
|
|
39
|
+
target: ppc64le
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: 3.x
|
|
45
|
+
- name: Build wheels
|
|
46
|
+
uses: PyO3/maturin-action@v1
|
|
47
|
+
with:
|
|
48
|
+
target: ${{ matrix.platform.target }}
|
|
49
|
+
args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 python3.14
|
|
50
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
51
|
+
manylinux: auto
|
|
52
|
+
- name: Upload wheels
|
|
53
|
+
uses: actions/upload-artifact@v4
|
|
54
|
+
with:
|
|
55
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
56
|
+
path: dist
|
|
57
|
+
|
|
58
|
+
musllinux:
|
|
59
|
+
needs: [cargo-test, python-test]
|
|
60
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
61
|
+
strategy:
|
|
62
|
+
matrix:
|
|
63
|
+
platform:
|
|
64
|
+
- runner: ubuntu-22.04
|
|
65
|
+
target: x86_64
|
|
66
|
+
- runner: ubuntu-22.04
|
|
67
|
+
target: x86
|
|
68
|
+
- runner: ubuntu-22.04
|
|
69
|
+
target: aarch64
|
|
70
|
+
- runner: ubuntu-22.04
|
|
71
|
+
target: armv7
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: 3.x
|
|
77
|
+
- name: Build wheels
|
|
78
|
+
uses: PyO3/maturin-action@v1
|
|
79
|
+
with:
|
|
80
|
+
target: ${{ matrix.platform.target }}
|
|
81
|
+
args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 python3.13t python3.14t
|
|
82
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
83
|
+
manylinux: musllinux_1_2
|
|
84
|
+
- name: Upload wheels
|
|
85
|
+
uses: actions/upload-artifact@v4
|
|
86
|
+
with:
|
|
87
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
88
|
+
path: dist
|
|
89
|
+
|
|
90
|
+
windows:
|
|
91
|
+
needs: [cargo-test, python-test]
|
|
92
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
93
|
+
strategy:
|
|
94
|
+
matrix:
|
|
95
|
+
platform:
|
|
96
|
+
- runner: windows-latest
|
|
97
|
+
target: x64
|
|
98
|
+
- runner: windows-latest
|
|
99
|
+
target: x86
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/checkout@v4
|
|
102
|
+
- uses: actions/setup-python@v5
|
|
103
|
+
with:
|
|
104
|
+
python-version: 3.x
|
|
105
|
+
architecture: ${{ matrix.platform.target }}
|
|
106
|
+
- name: Build wheels
|
|
107
|
+
uses: PyO3/maturin-action@v1
|
|
108
|
+
with:
|
|
109
|
+
target: ${{ matrix.platform.target }}
|
|
110
|
+
args: --release --out dist --find-interpreter
|
|
111
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
112
|
+
- name: Upload wheels
|
|
113
|
+
uses: actions/upload-artifact@v4
|
|
114
|
+
with:
|
|
115
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
116
|
+
path: dist
|
|
117
|
+
|
|
118
|
+
macos:
|
|
119
|
+
needs: [cargo-test, python-test]
|
|
120
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
121
|
+
strategy:
|
|
122
|
+
matrix:
|
|
123
|
+
platform:
|
|
124
|
+
- runner: macos-14
|
|
125
|
+
target: x86_64
|
|
126
|
+
- runner: macos-14
|
|
127
|
+
target: aarch64
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/checkout@v4
|
|
130
|
+
- uses: actions/setup-python@v5
|
|
131
|
+
with:
|
|
132
|
+
python-version: 3.x
|
|
133
|
+
- name: Build wheels
|
|
134
|
+
uses: PyO3/maturin-action@v1
|
|
135
|
+
with:
|
|
136
|
+
target: ${{ matrix.platform.target }}
|
|
137
|
+
args: --release --out dist --find-interpreter
|
|
138
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
139
|
+
- name: Upload wheels
|
|
140
|
+
uses: actions/upload-artifact@v4
|
|
141
|
+
with:
|
|
142
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
143
|
+
path: dist
|
|
144
|
+
|
|
145
|
+
sdist:
|
|
146
|
+
needs: [cargo-test, python-test]
|
|
147
|
+
runs-on: ubuntu-latest
|
|
148
|
+
steps:
|
|
149
|
+
- uses: actions/checkout@v4
|
|
150
|
+
- uses: actions/setup-python@v5
|
|
151
|
+
with:
|
|
152
|
+
python-version: 3.x
|
|
153
|
+
- name: Build sdist
|
|
154
|
+
uses: PyO3/maturin-action@v1
|
|
155
|
+
with:
|
|
156
|
+
command: sdist
|
|
157
|
+
args: --out dist
|
|
158
|
+
- name: Upload sdist
|
|
159
|
+
uses: actions/upload-artifact@v4
|
|
160
|
+
with:
|
|
161
|
+
name: wheels-sdist
|
|
162
|
+
path: dist
|
|
163
|
+
|
|
164
|
+
cargo-test:
|
|
165
|
+
runs-on: ubuntu-22.04
|
|
166
|
+
steps:
|
|
167
|
+
- uses: actions/checkout@v4
|
|
168
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
169
|
+
with:
|
|
170
|
+
components: clippy
|
|
171
|
+
- name: Cargo test
|
|
172
|
+
run: |
|
|
173
|
+
cargo install cargo-llvm-cov --locked
|
|
174
|
+
cargo test --all --release
|
|
175
|
+
cargo llvm-cov \
|
|
176
|
+
--workspace \
|
|
177
|
+
--ignore-filename-regex 'src/lib\.rs' \
|
|
178
|
+
--codecov \
|
|
179
|
+
--output-path codecov.json
|
|
180
|
+
- name: Format check
|
|
181
|
+
run: cargo fmt --all -- --check
|
|
182
|
+
- name: Clippy check
|
|
183
|
+
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
184
|
+
- name: Upload coverage reports to Codecov
|
|
185
|
+
uses: codecov/codecov-action@v5
|
|
186
|
+
with:
|
|
187
|
+
fail_ci_if_error: true
|
|
188
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
189
|
+
|
|
190
|
+
python-test:
|
|
191
|
+
runs-on: ubuntu-22.04
|
|
192
|
+
steps:
|
|
193
|
+
- uses: actions/checkout@v4
|
|
194
|
+
- uses: actions/setup-python@v5
|
|
195
|
+
with:
|
|
196
|
+
python-version: 3.x
|
|
197
|
+
- name: Install packages
|
|
198
|
+
run: python -m pip install -e .[dev]
|
|
199
|
+
- name: Run tests
|
|
200
|
+
run: pytest --benchmark-skip
|
|
201
|
+
- name: Docs check
|
|
202
|
+
run: |
|
|
203
|
+
pdoc fm_index \
|
|
204
|
+
--output-directory docs \
|
|
205
|
+
--no-search \
|
|
206
|
+
--no-show-source \
|
|
207
|
+
--docformat markdown \
|
|
208
|
+
--footer-text "© 2025 Koki Watanabe"
|
|
209
|
+
if ! git diff --exit-code -- docs; then
|
|
210
|
+
echo "::error::Docs are out of date. Please run pdoc and commit generated docs."
|
|
211
|
+
exit 1
|
|
212
|
+
fi
|
|
213
|
+
- name: Format check
|
|
214
|
+
run: ruff check
|
|
215
|
+
|
|
216
|
+
python-benchmark:
|
|
217
|
+
runs-on: ubuntu-22.04
|
|
218
|
+
strategy:
|
|
219
|
+
fail-fast: false
|
|
220
|
+
matrix:
|
|
221
|
+
python:
|
|
222
|
+
- "3.9"
|
|
223
|
+
- "3.10"
|
|
224
|
+
- "3.11"
|
|
225
|
+
- "3.12"
|
|
226
|
+
- "3.13"
|
|
227
|
+
- "3.14"
|
|
228
|
+
steps:
|
|
229
|
+
- uses: actions/checkout@v4
|
|
230
|
+
- uses: actions/setup-python@v5
|
|
231
|
+
with:
|
|
232
|
+
python-version: ${{ matrix.python }}
|
|
233
|
+
- name: Install packages
|
|
234
|
+
run: |
|
|
235
|
+
python -m pip install --upgrade pip
|
|
236
|
+
python -m pip install -e .[test]
|
|
237
|
+
- name: Run benchmarks
|
|
238
|
+
run: pytest --benchmark-only
|
|
239
|
+
|
|
240
|
+
release:
|
|
241
|
+
name: Release
|
|
242
|
+
runs-on: ubuntu-latest
|
|
243
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
244
|
+
needs: [linux, musllinux, windows, macos, sdist, cargo-test, python-test, python-benchmark]
|
|
245
|
+
permissions:
|
|
246
|
+
# Use to sign the release artifacts
|
|
247
|
+
id-token: write
|
|
248
|
+
# Used to upload release artifacts
|
|
249
|
+
contents: write
|
|
250
|
+
# Used to generate artifact attestation
|
|
251
|
+
attestations: write
|
|
252
|
+
steps:
|
|
253
|
+
- uses: actions/download-artifact@v4
|
|
254
|
+
- name: Generate artifact attestation
|
|
255
|
+
uses: actions/attest-build-provenance@v2
|
|
256
|
+
with:
|
|
257
|
+
subject-path: 'wheels-*/*'
|
|
258
|
+
- name: Publish to PyPI
|
|
259
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
260
|
+
uses: PyO3/maturin-action@v1
|
|
261
|
+
env:
|
|
262
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
263
|
+
with:
|
|
264
|
+
command: upload
|
|
265
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
73
|
+
|
|
74
|
+
target/
|
|
75
|
+
Cargo.lock
|
|
76
|
+
.ruff_cache/
|
|
77
|
+
.benchmarks/
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "fm-index"
|
|
13
|
+
version = "0.1.0"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"num-integer",
|
|
16
|
+
"num-traits",
|
|
17
|
+
"pyo3",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "heck"
|
|
22
|
+
version = "0.5.0"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "indoc"
|
|
28
|
+
version = "2.0.7"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
31
|
+
dependencies = [
|
|
32
|
+
"rustversion",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "libc"
|
|
37
|
+
version = "0.2.179"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "memoffset"
|
|
43
|
+
version = "0.9.1"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"autocfg",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "num-integer"
|
|
52
|
+
version = "0.1.46"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
|
55
|
+
dependencies = [
|
|
56
|
+
"num-traits",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "num-traits"
|
|
61
|
+
version = "0.2.19"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"autocfg",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "once_cell"
|
|
70
|
+
version = "1.21.3"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
73
|
+
|
|
74
|
+
[[package]]
|
|
75
|
+
name = "portable-atomic"
|
|
76
|
+
version = "1.13.0"
|
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
78
|
+
checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "proc-macro2"
|
|
82
|
+
version = "1.0.104"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"unicode-ident",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[[package]]
|
|
90
|
+
name = "pyo3"
|
|
91
|
+
version = "0.27.2"
|
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
+
checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
|
|
94
|
+
dependencies = [
|
|
95
|
+
"indoc",
|
|
96
|
+
"libc",
|
|
97
|
+
"memoffset",
|
|
98
|
+
"once_cell",
|
|
99
|
+
"portable-atomic",
|
|
100
|
+
"pyo3-build-config",
|
|
101
|
+
"pyo3-ffi",
|
|
102
|
+
"pyo3-macros",
|
|
103
|
+
"unindent",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "pyo3-build-config"
|
|
108
|
+
version = "0.27.2"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"target-lexicon",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "pyo3-ffi"
|
|
117
|
+
version = "0.27.2"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
|
|
120
|
+
dependencies = [
|
|
121
|
+
"libc",
|
|
122
|
+
"pyo3-build-config",
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
[[package]]
|
|
126
|
+
name = "pyo3-macros"
|
|
127
|
+
version = "0.27.2"
|
|
128
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
129
|
+
checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
|
|
130
|
+
dependencies = [
|
|
131
|
+
"proc-macro2",
|
|
132
|
+
"pyo3-macros-backend",
|
|
133
|
+
"quote",
|
|
134
|
+
"syn",
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
[[package]]
|
|
138
|
+
name = "pyo3-macros-backend"
|
|
139
|
+
version = "0.27.2"
|
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
+
checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
|
|
142
|
+
dependencies = [
|
|
143
|
+
"heck",
|
|
144
|
+
"proc-macro2",
|
|
145
|
+
"pyo3-build-config",
|
|
146
|
+
"quote",
|
|
147
|
+
"syn",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
[[package]]
|
|
151
|
+
name = "quote"
|
|
152
|
+
version = "1.0.42"
|
|
153
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
154
|
+
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
|
155
|
+
dependencies = [
|
|
156
|
+
"proc-macro2",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
[[package]]
|
|
160
|
+
name = "rustversion"
|
|
161
|
+
version = "1.0.22"
|
|
162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
164
|
+
|
|
165
|
+
[[package]]
|
|
166
|
+
name = "syn"
|
|
167
|
+
version = "2.0.113"
|
|
168
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
169
|
+
checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4"
|
|
170
|
+
dependencies = [
|
|
171
|
+
"proc-macro2",
|
|
172
|
+
"quote",
|
|
173
|
+
"unicode-ident",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "target-lexicon"
|
|
178
|
+
version = "0.13.4"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba"
|
|
181
|
+
|
|
182
|
+
[[package]]
|
|
183
|
+
name = "unicode-ident"
|
|
184
|
+
version = "1.0.22"
|
|
185
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
186
|
+
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
|
187
|
+
|
|
188
|
+
[[package]]
|
|
189
|
+
name = "unindent"
|
|
190
|
+
version = "0.2.4"
|
|
191
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
192
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "fm-index"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
8
|
+
[lib]
|
|
9
|
+
name = "fm_index"
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
num-integer = "0.1.46"
|
|
14
|
+
num-traits = "0.2.19"
|
|
15
|
+
pyo3 = "0.27.2"
|
fm_index-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Koki Watanabe
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
fm_index-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fm-index
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Intended Audience :: Developers
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: Intended Audience :: Information Technology
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
18
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: maturin>=1.9,<2.0 ; extra == 'test'
|
|
21
|
+
Requires-Dist: numpy>=2.0.2 ; extra == 'test'
|
|
22
|
+
Requires-Dist: pytest>=7.0 ; extra == 'test'
|
|
23
|
+
Requires-Dist: pytest-benchmark>=4.0 ; extra == 'test'
|
|
24
|
+
Requires-Dist: maturin>=1.9,<2.0 ; extra == 'dev'
|
|
25
|
+
Requires-Dist: numpy>=2.0.2 ; extra == 'dev'
|
|
26
|
+
Requires-Dist: pdoc>=16.0 ; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-benchmark>=4.0 ; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.14 ; extra == 'dev'
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Summary: High-performance FM-index powered by Rust, enabling fast substring search and count/locate queries.
|
|
34
|
+
Keywords: fm-index,full-text index,compressed index,substring search,pattern matching,succinct,information retrieval
|
|
35
|
+
Author: Koki Watanabe
|
|
36
|
+
Requires-Python: >=3.9
|
|
37
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
38
|
+
Project-URL: homepage, https://github.com/math-hiyoko/fm-index
|
|
39
|
+
Project-URL: documentation, https://math-hiyoko.github.io/fm-index
|
|
40
|
+
Project-URL: repository, https://github.com/math-hiyoko/fm-index
|
|
41
|
+
|
|
42
|
+
# FM Index
|
fm_index-0.1.0/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# FM Index
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from fm_index import FMIndex
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture
|
|
10
|
+
def random_data(size: int, ucs: Literal["ucs1", "ucs2", "ucs4"]) -> str:
|
|
11
|
+
rng = np.random.default_rng(42)
|
|
12
|
+
if ucs == "ucs1":
|
|
13
|
+
codepoints = rng.integers(0x20, 0x80, size=size, dtype=np.uint8)
|
|
14
|
+
elif ucs == "ucs2":
|
|
15
|
+
codepoints = rng.integers(0x20, 0xD800, size=size, dtype=np.uint16)
|
|
16
|
+
elif ucs == "ucs4":
|
|
17
|
+
codepoints = rng.integers(0x20, 0x110000, size=size, dtype=np.uint32)
|
|
18
|
+
else:
|
|
19
|
+
raise ValueError(f"Unknown ucs: {ucs}")
|
|
20
|
+
return "".join(map(chr, codepoints))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.fixture
|
|
24
|
+
def random_fm_index(random_data: str) -> FMIndex:
|
|
25
|
+
return FMIndex(random_data)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.mark.parametrize("size", [5000, 50000, 500000])
|
|
29
|
+
@pytest.mark.parametrize("ucs", ["ucs1", "ucs2", "ucs4"])
|
|
30
|
+
class BenchFMIndex:
|
|
31
|
+
def bench_construction(self, benchmark, random_data):
|
|
32
|
+
benchmark(FMIndex, random_data)
|
|
33
|
+
|
|
34
|
+
def bench_item(self, benchmark, random_fm_index):
|
|
35
|
+
benchmark(random_fm_index.item)
|
|
36
|
+
|
|
37
|
+
def bench_count(self, benchmark, random_fm_index):
|
|
38
|
+
pattern = random_fm_index.item()[:50]
|
|
39
|
+
benchmark(random_fm_index.count, pattern)
|
|
40
|
+
|
|
41
|
+
def bench_locate(self, benchmark, random_fm_index):
|
|
42
|
+
pattern = random_fm_index.item()[:50]
|
|
43
|
+
benchmark(random_fm_index.locate, pattern)
|
|
44
|
+
|
|
45
|
+
def bench_startswith(self, benchmark, random_fm_index):
|
|
46
|
+
prefix = random_fm_index.item()[:50]
|
|
47
|
+
benchmark(random_fm_index.startswith, prefix)
|
|
48
|
+
|
|
49
|
+
def bench_endswith(self, benchmark, random_fm_index):
|
|
50
|
+
suffix = random_fm_index.item()[-50:]
|
|
51
|
+
benchmark(random_fm_index.endswith, suffix)
|