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.12.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.12.0-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.12.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
60f29f42cfc6e5452cc6e1b12c4d440519be1e0e75edc06bdab22c3f4dd44488
|
|
BLAKE2b-256 checksum How to use checksums |
b3b45bf091c17085e285c9fa664fd1771a96e042a681ae5a66a330496bde6201
|
| 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.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.12.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 |
046dc22dc686f0600db987d2e4fd37562ca09e80fab4a7baa78d948f0229bd37
|
|
BLAKE2b-256 checksum How to use checksums |
e974cdc76fac16428135b828506e7c945da536e1e3ed7ea35cd1f1032c22f17a
|
| 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.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.12.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 |
2c0cb271acd4fca4d693decd3784d2ac63ea07e92243828b07f59cca9543c1df
|
|
BLAKE2b-256 checksum How to use checksums |
7f3efffbea9e6e287b4e21f710f313bf2d0bb4d7cc83c364760f9cb1866337ac
|
| 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.12.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.12.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 |
19808f81c48fd279d6caef8dcf5fcd38b29ad0038e14590e43f8189783529572
|
|
BLAKE2b-256 checksum How to use checksums |
e035e52811754e45564e22d922ba86d1be9ae79b7924cf5f3818a906dfaf9cca
|
| 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.12.0-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.12.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
51c9f20bc1afc5d841a1470bfd4d05beca1f57801f7ce049c0de803a24e5f081
|
|
BLAKE2b-256 checksum How to use checksums |
dc967d310775c69b3bffeb5cc1dcac160bd3f9666401913989e6bd051e9277b5
|
| 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.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.12.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 |
af19ec36269763700aa614838cece8210fe38adc6e887642eb1373b31937e804
|
|
BLAKE2b-256 checksum How to use checksums |
4d355d483fd3a907ea2d82767936e047f91c6978e2065b77566216d7c6c70438
|
| 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.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.12.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 |
c77d59bd3968c4d7303d977aa2a929b2922cf2df5ff957e36d0f6abf74a80f59
|
|
BLAKE2b-256 checksum How to use checksums |
e5dd8e7a11e2d4736a162a27d442788b56a499cecd8eb6911597632f54b1ef58
|
| 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.12.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.12.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 |
2e24545bc7dce874d84b1918f9d980e1557a5b157f06f8119dc9129fb19099c2
|
|
BLAKE2b-256 checksum How to use checksums |
8ddaedbcf1daa8665f5e95bb7410b03c1b93fc6808e97fcae357753f12053139
|
| 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.12.0-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.12.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
17cde2460424990f5d1b0b14627d456f8f5ab549cc0899a0cc023245ab6f0338
|
|
BLAKE2b-256 checksum How to use checksums |
a2cea40781ae0737bf27dece4e0e0f34ff19ee9cf0258b4e28ee99d63c3bd4db
|
| 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.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.12.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 |
fe8393bef40994edc728e1bf5cfafa072783eed04ca4f1963e00645723d96054
|
|
BLAKE2b-256 checksum How to use checksums |
3567482813d407c0090413c42e63c553bb3068b8a8f128c5b4e73c2417a0cb65
|
| 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.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.12.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 |
6f129cf306bebed83ef29036081eb8c8e9b94a24e60dd0e0217c28c2a4efc014
|
|
BLAKE2b-256 checksum How to use checksums |
54dcd390780ba7757b7dfd7fe2c8091ef9a27d3c9ac49c28269ecf9d6c3d2290
|
| 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.12.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.12.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 |
b454269518878d04e0033ec7cbcc09b5b6c5691c252bc602d01ed8954cc75d89
|
|
BLAKE2b-256 checksum How to use checksums |
60ffdf6beed43e1608b37295d10ace1843329cb0948a87b53902aca5fd3809a9
|
| 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.12.0-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.12.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
86095f0eab8026b166bd39a1a0f7638693769c7519115a719c4383bed895a736
|
|
BLAKE2b-256 checksum How to use checksums |
e28fb5bcd0dd4c1aa5e59b2539ba2a9e636821dda050cf7f1fb84c5ffb921adc
|
| 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.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.12.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 |
3e0e09b4727ae908c4a1af565d02d016ea1a9fc36d5bd8458510377a1c36dfa7
|
|
BLAKE2b-256 checksum How to use checksums |
bbb6b95d2c39918e9da7beb3ec199dddcd4b93207ba5c4ccc3dfe55883725738
|
| 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.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.12.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 |
a5abdb75bb4b4dc3f3310f2d5cf95e8471899a2d456ba57865dd4769274f7736
|
|
BLAKE2b-256 checksum How to use checksums |
0723f1e187583fe43a220585b867fe2abd7e24bc2547b8eef8da25bae980675a
|
| 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.12.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.12.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 |
09aba434274b5445766a2fff7edf2009f88b076147e0392001ec7d07cf7bdf5a
|
|
BLAKE2b-256 checksum How to use checksums |
e02b5c0bea072b4c79c523694d6cc7d9f7d566a1f1b30e924d7a5ade6e87b147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|