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.13.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.13.0-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.13.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
90ee198a8e0d2b87cc69916a4451092c3dc79a1c1c5836a1921e16311888ae64
|
|
BLAKE2b-256 checksum How to use checksums |
12891c77ea43795c617be27b44b70d2f5a4b0520f6d4c37749868185dcabe745
|
| 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.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.13.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 |
7dcd1f60c0c086fd50d8bc99497dc0f7e5b6344c1a9656bae5960ef43d765fd1
|
|
BLAKE2b-256 checksum How to use checksums |
4fc1d9db677961dfbfcede9551c336b88588c08e699ec7898ec818ea2714fe3f
|
| 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.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.13.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 |
215ac3221c2c929b05b88ea0ad685af319585c64a8a4a42faf2d89ed237cdb6a
|
|
BLAKE2b-256 checksum How to use checksums |
39b0cbb24bd22395ce82e8fab70b074c7bf0b04a661f738793253881e7e02442
|
| 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.13.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.13.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 |
2b79df106a9a4765cc209bf43688adeb1313390413704f56a9a08549968c4d0e
|
|
BLAKE2b-256 checksum How to use checksums |
9ed8d6d10ac7694839d56adebd54d783ab132ad6660fc470679262c3cef12d0b
|
| 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.13.0-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.13.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
371b3c1b8323cc912960eb46801800687ae801cb3f84f4b73d139bee0d52bdb8
|
|
BLAKE2b-256 checksum How to use checksums |
346e88b0b76a9fdc24002abdf15165ae6fe9524e979cf17348a6aa6b1967c77d
|
| 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.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.13.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 |
eaf701522c0cad0bc22d99a57c8ab40d47c79e6b88e39a59356c556d8d46737f
|
|
BLAKE2b-256 checksum How to use checksums |
2cffa2e7fe1ff0a3882845f2550c57a3ad8b9c6a00e346ac0c972f4da44c01d9
|
| 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.13.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.13.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 |
7dc7f070f248823a0746d8af1aaf83d3dbcb2abe3bfb226c3906d3c116314f82
|
|
BLAKE2b-256 checksum How to use checksums |
493b4c7b8b8795ade0c1944dfc3b39d29e0b1b0339f2be8b64b332808db7a4fb
|
| 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.13.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.13.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 |
e45a62d7848759692ad385c400229b65a2b40f418c276ad1378c0b29803a74b1
|
|
BLAKE2b-256 checksum How to use checksums |
c88ccfd3e47ef6021525f164d527e7d9a5490ea642d1d5e54fa7d0e0a8493b36
|
| 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.13.0-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.13.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
830622a24ae1065d9b5cfc9923131982ce45a8fef7ed98bf4726fcaf2e10ab23
|
|
BLAKE2b-256 checksum How to use checksums |
982a0d9be9b0e069463f826eb7f583857b98c944227eafa54fbc64f2dc70f747
|
| 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.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.13.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 |
619784a4ac8bf70211f6e1e6e346504b3d5487bf4a1beb0dfdea418db6482675
|
|
BLAKE2b-256 checksum How to use checksums |
de4aaef297c10531ed6252fd6bc47958e1ed29f00eb61b4f8730bcc7ad784ed7
|
| 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.13.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.13.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 |
a2aa14df51992eab7a9e2d14d7038b4255cd983b7fc8caf46269348f6258fc3d
|
|
BLAKE2b-256 checksum How to use checksums |
aadc43a6c834dde2eaa7c0c50b7b8fd10f18d465c496338713fb46d8d957cc7a
|
| 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.13.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.13.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 |
8d9cf1701bec0f6fac92545d8359a4497f09ef315f67e7381f81f3d24fdc7eac
|
|
BLAKE2b-256 checksum How to use checksums |
5bb4269bcf728e51b000d78073ef90a68864dbca898c155709030dbcbdc8c0c9
|
| 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.13.0-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.13.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d49b33afae8f23faa1a223401abbc9184f6423114abeb1a076fd58bbc48ddd5a
|
|
BLAKE2b-256 checksum How to use checksums |
b61bbabb0aa19fde90f85b3d3c30ef8a99a923b5d78aa77784c2b5d3931bb8d4
|
| 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.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.13.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 |
699cd738a5e56e2ed6f873a94db6739d2a8ff556fa8edd7e089aaa6c2f2d4c21
|
|
BLAKE2b-256 checksum How to use checksums |
9bd43a6e0661556e6bc23dd97b42cc4dd0a5926658b0de48f0389eb49a62bd2f
|
| 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.13.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.13.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 |
3e63334dce6425e2c66e7b748791b823fdd809a6fdc46eb791943e9e383b0347
|
|
BLAKE2b-256 checksum How to use checksums |
919a6ba6786b19320f948805eeae17d5b3cae4fac6ecd0dc0148abd659996526
|
| 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.13.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.13.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 |
c09c78a9e9f18f790a6aa50f279d2982bd82b9c2f5efd468c63010199502dead
|
|
BLAKE2b-256 checksum How to use checksums |
8403b96e948e945c4d96ffded8220d4ed4dadc8b7397627d7f668c5e7374cc1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|