speedupy-native 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 (35) hide show
  1. speedupy_native-0.1.0/.github/workflows/release.yml +196 -0
  2. speedupy_native-0.1.0/.gitignore +9 -0
  3. speedupy_native-0.1.0/.gitmodules +10 -0
  4. speedupy_native-0.1.0/AGENTS.md +63 -0
  5. speedupy_native-0.1.0/Cargo.lock +201 -0
  6. speedupy_native-0.1.0/Cargo.toml +29 -0
  7. speedupy_native-0.1.0/LICENSE +21 -0
  8. speedupy_native-0.1.0/NOTICE +22 -0
  9. speedupy_native-0.1.0/PKG-INFO +90 -0
  10. speedupy_native-0.1.0/README.md +70 -0
  11. speedupy_native-0.1.0/build.rs +44 -0
  12. speedupy_native-0.1.0/crates/museair/Cargo.toml +16 -0
  13. speedupy_native-0.1.0/pyproject.toml +36 -0
  14. speedupy_native-0.1.0/python/speedupy_native/__init__.py +32 -0
  15. speedupy_native-0.1.0/src/lib.rs +96 -0
  16. speedupy_native-0.1.0/tests/test_vectors.py +158 -0
  17. speedupy_native-0.1.0/tools/gen_vectors.py +159 -0
  18. speedupy_native-0.1.0/vendor/a5hash/LICENSE +21 -0
  19. speedupy_native-0.1.0/vendor/a5hash/README.md +558 -0
  20. speedupy_native-0.1.0/vendor/a5hash/a5hash.h +874 -0
  21. speedupy_native-0.1.0/vendor/a5hash/a5hash_wrapper.c +10 -0
  22. speedupy_native-0.1.0/vendor/meow_hash/.gitignore +3 -0
  23. speedupy_native-0.1.0/vendor/meow_hash/.travis.yml +156 -0
  24. speedupy_native-0.1.0/vendor/meow_hash/LICENSE +19 -0
  25. speedupy_native-0.1.0/vendor/meow_hash/README.md +44 -0
  26. speedupy_native-0.1.0/vendor/meow_hash/build.bat +40 -0
  27. speedupy_native-0.1.0/vendor/meow_hash/build.sh +11 -0
  28. speedupy_native-0.1.0/vendor/meow_hash/meow_example.cpp +233 -0
  29. speedupy_native-0.1.0/vendor/meow_hash/meow_hash_x64_aesni.h +744 -0
  30. speedupy_native-0.1.0/vendor/meow_hash/meow_wrapper.cpp +45 -0
  31. speedupy_native-0.1.0/vendor/meow_hash/util/meow_bench.cpp +1027 -0
  32. speedupy_native-0.1.0/vendor/meow_hash/util/meow_search.cpp +494 -0
  33. speedupy_native-0.1.0/vendor/meow_hash/util/meow_smhasher.cpp +63 -0
  34. speedupy_native-0.1.0/vendor/meow_hash/util/meow_test.cpp +390 -0
  35. speedupy_native-0.1.0/vendor/meow_hash/util/meow_test.h +366 -0
@@ -0,0 +1,196 @@
1
+ # Started from `maturin generate-ci github` (maturin 1.16) and trimmed to the
2
+ # platforms the package supports (docs/native-hashes.md in dew-uff/speedupy):
3
+ # Linux x86_64 and aarch64 (manylinux), Windows x64, macOS x86_64 and arm64,
4
+ # plus the sdist. One abi3 wheel per platform covers every Python from 3.10.
5
+ #
6
+ # Every wheel is installed and run against tests/test_vectors.py on its own
7
+ # system before it can be released. A tag publishes to PyPI through Trusted
8
+ # Publishing (no token stored): the PyPI project must list this repository,
9
+ # this workflow file and the `pypi` environment as its publisher.
10
+ name: CI
11
+
12
+ on:
13
+ push:
14
+ branches: [main]
15
+ tags: ['*']
16
+ pull_request:
17
+ workflow_dispatch:
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ jobs:
23
+ linux:
24
+ runs-on: ubuntu-24.04
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ target: [x86_64, aarch64]
29
+ steps:
30
+ - uses: actions/checkout@v6
31
+ with:
32
+ submodules: true
33
+ - uses: actions/setup-python@v6
34
+ with:
35
+ python-version: "3.10"
36
+ - name: Build wheel
37
+ uses: PyO3/maturin-action@v1
38
+ with:
39
+ target: ${{ matrix.target }}
40
+ args: --release --out dist
41
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
42
+ manylinux: auto
43
+ - name: Upload wheel
44
+ uses: actions/upload-artifact@v6
45
+ with:
46
+ name: wheels-linux-${{ matrix.target }}
47
+ path: dist
48
+ - uses: astral-sh/setup-uv@v7
49
+ if: ${{ matrix.target == 'x86_64' }}
50
+ - name: Test the wheel (x86_64)
51
+ if: ${{ matrix.target == 'x86_64' }}
52
+ shell: bash
53
+ run: |
54
+ set -e
55
+ uv venv .venv
56
+ source .venv/bin/activate
57
+ uv pip install speedupy-native --no-index --no-deps --find-links dist --reinstall
58
+ uv pip install pytest
59
+ pytest -q
60
+ - name: Test the wheel (aarch64, emulated)
61
+ if: ${{ matrix.target == 'aarch64' }}
62
+ uses: uraimo/run-on-arch-action@v3
63
+ with:
64
+ arch: aarch64
65
+ distro: ubuntu24.04
66
+ githubToken: ${{ github.token }}
67
+ install: |
68
+ apt-get update
69
+ apt-get install -y --no-install-recommends python3 python3-venv
70
+ run: |
71
+ set -e
72
+ python3 -m venv .venv
73
+ source .venv/bin/activate
74
+ pip install pytest
75
+ pip install speedupy-native --no-index --no-deps --find-links dist --force-reinstall
76
+ pytest -q
77
+
78
+ windows:
79
+ runs-on: windows-latest
80
+ steps:
81
+ - uses: actions/checkout@v6
82
+ with:
83
+ submodules: true
84
+ - uses: actions/setup-python@v6
85
+ with:
86
+ python-version: "3.10"
87
+ architecture: x64
88
+ - name: Build wheel
89
+ uses: PyO3/maturin-action@v1
90
+ with:
91
+ target: x64
92
+ args: --release --out dist
93
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
94
+ - name: Upload wheel
95
+ uses: actions/upload-artifact@v6
96
+ with:
97
+ name: wheels-windows-x64
98
+ path: dist
99
+ - uses: astral-sh/setup-uv@v7
100
+ - name: Test the wheel
101
+ shell: bash
102
+ run: |
103
+ set -e
104
+ uv venv .venv
105
+ source .venv/Scripts/activate
106
+ uv pip install speedupy-native --no-index --no-deps --find-links dist --reinstall
107
+ uv pip install pytest
108
+ pytest -q
109
+
110
+ macos:
111
+ runs-on: ${{ matrix.platform.runner }}
112
+ strategy:
113
+ fail-fast: false
114
+ matrix:
115
+ platform:
116
+ - runner: macos-15-intel
117
+ target: x86_64
118
+ - runner: macos-latest
119
+ target: aarch64
120
+ steps:
121
+ - uses: actions/checkout@v6
122
+ with:
123
+ submodules: true
124
+ - uses: actions/setup-python@v6
125
+ with:
126
+ python-version: "3.10"
127
+ - name: Build wheel
128
+ uses: PyO3/maturin-action@v1
129
+ with:
130
+ target: ${{ matrix.platform.target }}
131
+ args: --release --out dist
132
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
133
+ - name: Upload wheel
134
+ uses: actions/upload-artifact@v6
135
+ with:
136
+ name: wheels-macos-${{ matrix.platform.target }}
137
+ path: dist
138
+ - uses: astral-sh/setup-uv@v7
139
+ - name: Test the wheel
140
+ run: |
141
+ set -e
142
+ uv venv .venv
143
+ source .venv/bin/activate
144
+ uv pip install speedupy-native --no-index --no-deps --find-links dist --reinstall
145
+ uv pip install pytest
146
+ pytest -q
147
+
148
+ sdist:
149
+ runs-on: ubuntu-latest
150
+ steps:
151
+ - uses: actions/checkout@v6
152
+ with:
153
+ submodules: true
154
+ - name: Build sdist
155
+ uses: PyO3/maturin-action@v1
156
+ with:
157
+ command: sdist
158
+ args: --out dist
159
+ - name: Upload sdist
160
+ uses: actions/upload-artifact@v6
161
+ with:
162
+ name: wheels-sdist
163
+ path: dist
164
+
165
+ # The one required check for the `main` ruleset, as in dew-uff/speedupy.
166
+ ci-ok:
167
+ runs-on: ubuntu-latest
168
+ needs: [linux, windows, macos, sdist]
169
+ if: ${{ always() }}
170
+ steps:
171
+ - name: Every build and test job succeeded
172
+ run: |
173
+ test "${{ needs.linux.result }}" = success
174
+ test "${{ needs.windows.result }}" = success
175
+ test "${{ needs.macos.result }}" = success
176
+ test "${{ needs.sdist.result }}" = success
177
+
178
+ release:
179
+ name: Release
180
+ runs-on: ubuntu-latest
181
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
182
+ needs: [linux, windows, macos, sdist]
183
+ environment: pypi
184
+ permissions:
185
+ id-token: write # Trusted Publishing and artifact signing
186
+ contents: write # release artifacts
187
+ attestations: write # artifact attestation
188
+ steps:
189
+ - uses: actions/download-artifact@v7
190
+ - name: Generate artifact attestation
191
+ uses: actions/attest@v4
192
+ with:
193
+ subject-path: 'wheels-*/*'
194
+ - uses: astral-sh/setup-uv@v7
195
+ - name: Publish to PyPI (Trusted Publishing)
196
+ run: uv publish --trusted-publishing always 'wheels-*/*'
@@ -0,0 +1,9 @@
1
+ /target/
2
+ /dist/
3
+ /.venv/
4
+ __pycache__/
5
+ *.pyc
6
+ .pytest_cache/
7
+ *.so
8
+ *.pyd
9
+ *.dylib
@@ -0,0 +1,10 @@
1
+ [submodule "vendor/a5hash"]
2
+ path = vendor/a5hash
3
+ url = https://github.com/JoaoLopez/a5hash
4
+ [submodule "vendor/meow_hash"]
5
+ path = vendor/meow_hash
6
+ url = https://github.com/JoaoLopez/meow_hash
7
+ [submodule "vendor/museair"]
8
+ path = vendor/museair
9
+ url = https://github.com/JoaoLopez/museair
10
+ branch = oficial
@@ -0,0 +1,63 @@
1
+ # speedupy-native: instructions for agents
2
+
3
+ Read this before touching the repository. `README.md` says what the package is
4
+ and how to build it; `docs/native-hashes.md` in `dew-uff/speedupy` is the
5
+ design this repository implements.
6
+
7
+ ## Working conventions
8
+
9
+ The same as `dew-uff/speedupy`'s `AGENTS.md`, in short:
10
+
11
+ - Everything versioned is in English. Documents say "the maintainer", never a
12
+ person's name.
13
+ - One task, one issue, one branch `issue_<N>`, one pull request. Commit
14
+ messages start with `Issue(#N): `. Pull requests are integrated with a merge
15
+ commit, never a squash or a rebase.
16
+ - Do not commit on your own: leave the change in the working tree and show the
17
+ diff and the result of each check. Commit, push and the pull request are the
18
+ dev's, or yours when the dev says so.
19
+ - Do what the task says and nothing more; anything else found on the way goes
20
+ to a new issue.
21
+ - Three failed attempts at the same goal: stop, explain, recommend.
22
+
23
+ ## What never changes without a decision
24
+
25
+ - **The vendored commits** under `vendor/`. They are the sources the
26
+ measurements of the SpeeduPy papers used. Moving a submodule changes hash
27
+ values; it is a maintainers' decision, at least a minor version, written in
28
+ the release notes with before and after values of one input.
29
+ - **`tests/test_vectors.py`.** Generated, never edited by hand. It changes only
30
+ with the previous item, by running `tools/gen_vectors.py` against the
31
+ original `.so` libraries built from the new commit.
32
+ - **The Python API** (`a5hash_128_64`, `museair_bfast_64`, `meowhash_32`,
33
+ `HAS_MEOWHASH`, `PLATFORM`): SpeeduPy's hash classes call it by name.
34
+
35
+ ## Definition of done
36
+
37
+ - `maturin develop --release` builds on the dev's machine.
38
+ - `pytest -q` is green: every reference value reproduced.
39
+ - `cargo fmt --check` is clean.
40
+ - CI is green at the tip of the branch: `ci-ok` is the one job that says so.
41
+ It fails when any wheel failed to build or to pass the tests on its own
42
+ platform (Linux x86_64 and aarch64, Windows x64, macOS Intel and arm64, and
43
+ the sdist).
44
+
45
+ ## Traps
46
+
47
+ - **Submodules.** `git clone` without `--recurse-submodules` leaves `vendor/`
48
+ empty and `build.rs` fails at the first `#include`. Run
49
+ `git submodule update --init`.
50
+ - **MuseAir is a cdylib.** The fork's `Cargo.toml` only produces a shared
51
+ library, which Cargo cannot link. `crates/museair/Cargo.toml` is a bridge
52
+ manifest whose `[lib] path` points into the submodule; it is the dependency
53
+ the extension uses. Do not copy the source.
54
+ - **MeowHash is x86_64 only.** `build.rs` compiles its wrapper only there and
55
+ sets `cfg(has_meowhash)`; `HAS_MEOWHASH` also checks AES-NI at run time. A
56
+ test that needs MeowHash skips where `HAS_MEOWHASH` is false, never fails.
57
+ - **abi3.** The extension uses the stable ABI from Python 3.10, so PyO3's
58
+ `PyBuffer` is unavailable; the functions take `bytes` (`&[u8]`), which is
59
+ what SpeeduPy passes. Do not widen them to the buffer protocol without
60
+ raising the ABI floor.
61
+ - **The tests import the installed wheel**, not `python/`: run them after
62
+ `maturin develop`, or after installing a built wheel, never with `python/` on
63
+ `sys.path`.
@@ -0,0 +1,201 @@
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.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "cc"
13
+ version = "1.11.3"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69"
16
+ dependencies = [
17
+ "find-msvc-tools",
18
+ "shlex",
19
+ ]
20
+
21
+ [[package]]
22
+ name = "find-msvc-tools"
23
+ version = "0.1.15"
24
+ source = "registry+https://github.com/rust-lang/crates.io-index"
25
+ checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
26
+
27
+ [[package]]
28
+ name = "heck"
29
+ version = "0.5.0"
30
+ source = "registry+https://github.com/rust-lang/crates.io-index"
31
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
32
+
33
+ [[package]]
34
+ name = "indoc"
35
+ version = "2.0.8"
36
+ source = "registry+https://github.com/rust-lang/crates.io-index"
37
+ checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
38
+ dependencies = [
39
+ "rustversion",
40
+ ]
41
+
42
+ [[package]]
43
+ name = "libc"
44
+ version = "0.2.191"
45
+ source = "registry+https://github.com/rust-lang/crates.io-index"
46
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
47
+
48
+ [[package]]
49
+ name = "memoffset"
50
+ version = "0.9.1"
51
+ source = "registry+https://github.com/rust-lang/crates.io-index"
52
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
53
+ dependencies = [
54
+ "autocfg",
55
+ ]
56
+
57
+ [[package]]
58
+ name = "museair"
59
+ version = "0.4.0"
60
+
61
+ [[package]]
62
+ name = "once_cell"
63
+ version = "1.21.4"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
66
+
67
+ [[package]]
68
+ name = "portable-atomic"
69
+ version = "1.15.0"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
72
+
73
+ [[package]]
74
+ name = "proc-macro2"
75
+ version = "1.0.107"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
78
+ dependencies = [
79
+ "unicode-ident",
80
+ ]
81
+
82
+ [[package]]
83
+ name = "pyo3"
84
+ version = "0.25.1"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
87
+ dependencies = [
88
+ "indoc",
89
+ "libc",
90
+ "memoffset",
91
+ "once_cell",
92
+ "portable-atomic",
93
+ "pyo3-build-config",
94
+ "pyo3-ffi",
95
+ "pyo3-macros",
96
+ "unindent",
97
+ ]
98
+
99
+ [[package]]
100
+ name = "pyo3-build-config"
101
+ version = "0.25.1"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
104
+ dependencies = [
105
+ "once_cell",
106
+ "target-lexicon",
107
+ ]
108
+
109
+ [[package]]
110
+ name = "pyo3-ffi"
111
+ version = "0.25.1"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
114
+ dependencies = [
115
+ "libc",
116
+ "pyo3-build-config",
117
+ ]
118
+
119
+ [[package]]
120
+ name = "pyo3-macros"
121
+ version = "0.25.1"
122
+ source = "registry+https://github.com/rust-lang/crates.io-index"
123
+ checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
124
+ dependencies = [
125
+ "proc-macro2",
126
+ "pyo3-macros-backend",
127
+ "quote",
128
+ "syn",
129
+ ]
130
+
131
+ [[package]]
132
+ name = "pyo3-macros-backend"
133
+ version = "0.25.1"
134
+ source = "registry+https://github.com/rust-lang/crates.io-index"
135
+ checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
136
+ dependencies = [
137
+ "heck",
138
+ "proc-macro2",
139
+ "pyo3-build-config",
140
+ "quote",
141
+ "syn",
142
+ ]
143
+
144
+ [[package]]
145
+ name = "quote"
146
+ version = "1.0.47"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
149
+ dependencies = [
150
+ "proc-macro2",
151
+ ]
152
+
153
+ [[package]]
154
+ name = "rustversion"
155
+ version = "1.0.23"
156
+ source = "registry+https://github.com/rust-lang/crates.io-index"
157
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
158
+
159
+ [[package]]
160
+ name = "shlex"
161
+ version = "2.0.1"
162
+ source = "registry+https://github.com/rust-lang/crates.io-index"
163
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
164
+
165
+ [[package]]
166
+ name = "speedupy_native"
167
+ version = "0.1.0"
168
+ dependencies = [
169
+ "cc",
170
+ "museair",
171
+ "pyo3",
172
+ ]
173
+
174
+ [[package]]
175
+ name = "syn"
176
+ version = "2.0.119"
177
+ source = "registry+https://github.com/rust-lang/crates.io-index"
178
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
179
+ dependencies = [
180
+ "proc-macro2",
181
+ "quote",
182
+ "unicode-ident",
183
+ ]
184
+
185
+ [[package]]
186
+ name = "target-lexicon"
187
+ version = "0.13.6"
188
+ source = "registry+https://github.com/rust-lang/crates.io-index"
189
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
190
+
191
+ [[package]]
192
+ name = "unicode-ident"
193
+ version = "1.0.27"
194
+ source = "registry+https://github.com/rust-lang/crates.io-index"
195
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
196
+
197
+ [[package]]
198
+ name = "unindent"
199
+ version = "0.2.4"
200
+ source = "registry+https://github.com/rust-lang/crates.io-index"
201
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
@@ -0,0 +1,29 @@
1
+ [package]
2
+ name = "speedupy_native"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ rust-version = "1.83"
6
+ license = "MIT"
7
+ description = "Prebuilt native hash functions for SpeeduPy: a5hash, MeowHash 0.5 and MuseAir BFast"
8
+ repository = "https://github.com/dew-uff/speedupy-native"
9
+ publish = false
10
+ readme = "README.md"
11
+
12
+ [lib]
13
+ name = "_speedupy_native"
14
+ crate-type = ["cdylib"]
15
+
16
+ [dependencies]
17
+ # abi3-py310: one wheel per platform for every Python from 3.10 on (retrofit D6).
18
+ pyo3 = { version = "0.25", features = ["abi3-py310", "extension-module"] }
19
+ # The vendored MuseAir source, built as an rlib through the bridge manifest in
20
+ # crates/museair (the fork's own Cargo.toml only produces a cdylib).
21
+ museair = { path = "crates/museair" }
22
+
23
+ [build-dependencies]
24
+ cc = "1"
25
+
26
+ [profile.release]
27
+ opt-level = 3
28
+ lto = true
29
+ codegen-units = 1
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Universidade Federal Fluminense
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,22 @@
1
+ speedupy-native bundles three third-party hash implementations, vendored as git
2
+ submodules under vendor/ at pinned commits. Their licenses apply to their code
3
+ and are reproduced in the files named below; the glue code of this package is
4
+ MIT (see LICENSE).
5
+
6
+ a5hash (vendor/a5hash)
7
+ Copyright (c) Aleksey Vaneev
8
+ License: MIT, vendor/a5hash/LICENSE
9
+ Source: https://github.com/JoaoLopez/a5hash, commit 7ff7fa34c406279f3f3203fb01d39c8b8cf263b1
10
+ (fork of https://github.com/avaneev/a5hash adding a5hash_wrapper.c)
11
+
12
+ MeowHash 0.5 (vendor/meow_hash)
13
+ (C) Copyright 2018 Molly Rocket, Inc.
14
+ License: zlib, vendor/meow_hash/LICENSE
15
+ Source: https://github.com/JoaoLopez/meow_hash, commit beeb71f01c2a3a85d5956589c0b14a825d28fdc9
16
+ (fork of https://github.com/cmuratori/meow_hash adding meow_wrapper.cpp)
17
+
18
+ MuseAir (vendor/museair)
19
+ Copyright (c) K--Aethiax
20
+ License: MIT OR Apache-2.0, as declared in vendor/museair/Cargo.toml
21
+ Source: https://github.com/JoaoLopez/museair, branch oficial, commit 91e7304675d35139e4be9054e793a5504393b2bd
22
+ (fork of https://github.com/eternal-io/museair adding the museair_bfast_64 C export)
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: speedupy-native
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Python :: Implementation :: CPython
7
+ Classifier: Operating System :: POSIX :: Linux
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Topic :: Software Development :: Libraries
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Summary: Prebuilt native hash functions for SpeeduPy: a5hash, MeowHash 0.5 and MuseAir BFast
14
+ License-Expression: MIT
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
+ Project-URL: Documentation, https://github.com/dew-uff/speedupy/blob/main/docs/native-hashes.md
18
+ Project-URL: Repository, https://github.com/dew-uff/speedupy-native
19
+
20
+ # speedupy-native
21
+
22
+ Prebuilt native hash functions for [SpeeduPy](https://github.com/dew-uff/speedupy):
23
+ a5hash, MeowHash 0.5 and MuseAir BFast, as one Python extension with wheels for
24
+ Linux (x86_64, aarch64), Windows (x64) and macOS (Intel, Apple Silicon).
25
+ `pip install speedupy` brings it in; nothing is compiled on the user's machine.
26
+
27
+ ```python
28
+ import speedupy_native as native
29
+
30
+ native.a5hash_128_64(b"abc") # lower 64 bits of a5hash-128, seed 0
31
+ native.museair_bfast_64(b"abc") # MuseAir BFast, 64-bit, seed 0
32
+ native.meowhash_32(b"abc") # MeowHash 0.5, lower 32 bits, default seed
33
+ native.HAS_MEOWHASH # False on arm64 and on x86_64 without AES-NI
34
+ native.PLATFORM # "linux-x86_64", "macos-aarch64", ...
35
+ ```
36
+
37
+ The functions take `bytes` and return the integers the original `ctypes`
38
+ wrappers of SpeeduPy returned, computed from the same sources at the same
39
+ commits (`NOTICE`). `tests/test_vectors.py` holds reference values produced
40
+ from those original shared libraries; every wheel must reproduce them on its
41
+ own platform before it is released.
42
+
43
+ MeowHash exists for x86_64 with AES-NI only; its official implementation has no
44
+ ARM port. On other platforms `HAS_MEOWHASH` is false and `meowhash_32` raises
45
+ `RuntimeError`; the other hashes work everywhere.
46
+
47
+ Design and rationale: `docs/native-hashes.md` in the SpeeduPy repository
48
+ (decision D3 of the retrofit).
49
+
50
+ ## Layout
51
+
52
+ ```
53
+ Cargo.toml, build.rs, src/lib.rs the extension (Rust, PyO3; build.rs compiles the C/C++ wrappers)
54
+ crates/museair/Cargo.toml bridge manifest that builds vendor/museair as a Rust library
55
+ python/speedupy_native/ the Python package
56
+ vendor/{a5hash,meow_hash,museair} git submodules, pinned (see NOTICE)
57
+ tests/test_vectors.py reference values; generated by tools/gen_vectors.py
58
+ .github/workflows/release.yml wheels for every platform, tests, release to PyPI on a tag
59
+ ```
60
+
61
+ ## Developing
62
+
63
+ Needs Rust (`rustup`), a C and C++ compiler, Python 3.10 or newer and
64
+ [maturin](https://www.maturin.rs) (`uv tool install maturin`). No Docker.
65
+
66
+ ```bash
67
+ git clone --recurse-submodules https://github.com/dew-uff/speedupy-native
68
+ cd speedupy-native
69
+ uv venv && source .venv/bin/activate
70
+ maturin develop --release
71
+ uv pip install pytest && pytest -q
72
+ ```
73
+
74
+ `maturin build --release` writes the wheel of this machine to `target/wheels/`.
75
+
76
+ The reference values are regenerated only when a vendored commit changes, from
77
+ the original `.so` libraries built from that commit on Linux x86_64:
78
+ `python tools/gen_vectors.py <dir with liba5hash.so libmeow.so libmuseair.so> > tests/test_vectors.py`.
79
+ A change in the values is a new hash to SpeeduPy's users, not a bug fix: it is
80
+ at least a minor version and is written in the release notes.
81
+
82
+ ## Releasing
83
+
84
+ Tags are SemVer without a `v` (`0.1.0`). A pushed tag builds every wheel, runs
85
+ the tests on each platform, attests the artifacts and publishes to PyPI with
86
+ Trusted Publishing: the PyPI project lists this repository, this workflow file
87
+ and the `pypi` environment as its publisher, and no token is stored. SpeeduPy
88
+ pins the exact version in its dependencies; bumping it there is a pull request
89
+ of its own.
90
+