aria-engine (Python)
aria-engine 是 Aria 推理引擎的 Python SDK(ctypes 封装 libaria_ffi)。
通过 PyPI 安装的 平台 wheel 内已捆绑动态库,开箱即用,无需手动设置环境变量。
安装(PyPI 发布版)
pip install aria-engine
支持 Linux (x86_64 / aarch64 manylinux)、macOS (x86_64 / arm64)、Windows (x86_64), Python 3.10+。wheel 内自带
libaria_ffi.so/.dylib/.dll。
用法
from aria_engine import Engine
with Engine("/path/to/bundle") as eng:
print(eng.complete([{"role":"user","content":"hi"}], {"max_tokens": 16}))
按模型名自动下载
Engine 同时接受本地 bundle 路径或 Aria 模型名(如 gemma-4-e2b-it_q4)。含 /
或本地已存在的值直接加载;否则由 SDK 从 Dashboard 私有源 自动下载(需 token,
site 默认 https://ariacompute.com)到 ~/.ariacompute/models/{model} 再加载。
缓存中已有有效 bundle 时直接复用,不重复下载。
with Engine("gemma-4-e2b-it_q4", token="API_TOKEN") as eng:
print(eng.complete([{"role":"user","content":"hi"}], {"max_tokens": 16}))
动态库查找顺序
_load_lib() 按以下顺序解析:
- 显式传入的
path - 环境变量
ARIA_FFI_LIB(源码安装 / 自定义路径时使用) - wheel 内捆绑的
aria_engine/lib/<libaria_ffi.so|dylib|dll> - 都找不到 →
RuntimeError(提示安装 wheel 或设置ARIA_FFI_LIB)
源码安装(开发)
export ARIA_FFI_LIB=/path/to/libaria_ffi.so
pip install -e .
构建 wheel(cibuildwheel)
bash scripts/build-python-ffi.sh # 编译 libaria_ffi 并拷入 aria_engine/lib/
pip install cibuildwheel
cibuildwheel --platform linux # 或 macos / windows
发布到 PyPI
GitHub Release 触发 .github/workflows/publish-pypi.yml:五平台构建 + twine upload。
需要仓库 Secret PYPI_TOKEN(PyPI API token,project-scoped,owner ariacompute)。
版本号取 tag 去 v(也支持 workflow_dispatch 手动输入)。
Metadata
Release files for aria-engine 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 30.0 MB
Release files / aria_engine-1.8.0-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.8.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
03f5c2f6eef3c728f0120c2f3f040f10b083ec326e76df3e00482a6a936b0dcc
|
|
BLAKE2b-256 checksum How to use checksums |
5fb5f38ec8c97b95b50080a83dcb426d5e1f69fb97acbc060dbf5877da6ac2bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
f1fca2095ad431973b180a749af8df4aead2e51dc3d4cbaa1439c5f16f76dd67
|
|
BLAKE2b-256 checksum How to use checksums |
bea3e50a1c898e20b6e183914595d633e542ffad97f8092fa2a2106b92c5bcdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
f0e48d70bb296305f0728354d95c574c958a5f9280d870577009c9337c118723
|
|
BLAKE2b-256 checksum How to use checksums |
228d596f4100fc32d4d8e0b3b4fc30c14000ab357ff0881779fce9c809244354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.8.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
01fe86614e98ab9689289559c5ead4bdb9744eb951682ab3e57897462022acf7
|
|
BLAKE2b-256 checksum How to use checksums |
6a25850244ee55b97747bf8ad3508c6108a36d1f36c63b2615b8b61e768dbdc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.8.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
70cc2b1433d8a803d7a6ee77222d59a53064c3bcc0c51fb56dc2d88b6fd0f904
|
|
BLAKE2b-256 checksum How to use checksums |
2187bb9829a5be79288a0bb1c9b8fca9d54638c8def153cbcaaba880c7350270
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9aef6034672ed344498e18f1c48a5488219b7f1674f8778557c7101f9a0e8f40
|
|
BLAKE2b-256 checksum How to use checksums |
0ea3a117deb9f9f0073a64494811f3d536b3636f9b5321f4ebaf5cd6f42d70a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
d16b8ee0fd0019cca78b979b621d048174475e603e19a4c9139549a51e66c44d
|
|
BLAKE2b-256 checksum How to use checksums |
072c64f22fcaa035c8b1cd44e41098a9e917be02df87258a42ea817b989bc870
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.8.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
be75336450c7a23dcba54596cbf9822a7000e333c522b4871459f4ed4688078a
|
|
BLAKE2b-256 checksum How to use checksums |
dac23c836fa1466544e1e7de02963c6a058cb5f35655cd7364210ea3cc8c863c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.8.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
95c2ff3b74d1f778ba691e4aa686aa7680e2bf6ebaf1cc9f6ca55cd42c4d7694
|
|
BLAKE2b-256 checksum How to use checksums |
c116821e333f205cb274b24ef1d9cdef4abc2352078baa660302aa070137d467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9c2d8adf01e869c60548457b6ae6e17893c79d40bb0529231226bfd6853e8b40
|
|
BLAKE2b-256 checksum How to use checksums |
f8f91ee67bf7ef4df0f201ab482521de187482458f1bf405b8e9a2ddd2d2691b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
eab3b15db6ca323bb59708cb0677ef3efb49b0bce0f47f764b4cd65e6870f264
|
|
BLAKE2b-256 checksum How to use checksums |
a83f5b9a44ed2c57e548b8008a351965f628c36add03c48e0618738c84eeef27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.8.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b37b63c511775d1e046174713bf7c58c17495cc8b8bc849499e85b6fa32e8798
|
|
BLAKE2b-256 checksum How to use checksums |
f62aa546e60ff103357f2ce99f8abd006278daf1f17830a6b0d955f1b014319d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.8.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
482c94f74fea82cbdf81acf21e380d9592567d14bcf511e6d3a92e59367842d5
|
|
BLAKE2b-256 checksum How to use checksums |
9cbed5a8457b990388fb39bfdc6cb367eb9e08bc381940688745516d72b247ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ebcb1c14104cc1499679b473d37b50c67122ae16acaa59838ed0a6d91ff3abf8
|
|
BLAKE2b-256 checksum How to use checksums |
df4e1f17c141f8b3e18ac9b0301f9ff14dc320de70bc85f7a7817ef6e28ad470
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.8.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
52b5bc0d8225aaadc1d853b0017beb71aadf835345c66551f50753f3d06b4e6e
|
|
BLAKE2b-256 checksum How to use checksums |
9a1932468cb59eac5a24f5bb2b0138644a7810cb423dc42c330afa996d5bf6a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / aria_engine-1.8.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.8.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bb3c9e99a4d28c2f698b6261738a3be484a4b9712a925d58ac0a9ef399a9d87a
|
|
BLAKE2b-256 checksum How to use checksums |
547850410796b1573194c653fba3135a024474ab81bbf70eb372c6bd4eccecea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|