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.9.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.9.0-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.9.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a7f4fb73d56e99982dc4a4aae029e475d3a4e1340d8b37220d9e325cd237c244
|
|
BLAKE2b-256 checksum How to use checksums |
99674cbf01f840f544e077c79c286ee77cc07175e345ddbd2f3a2ef9eff318bf
|
| 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.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.9.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 |
4997023262698416b7269e60811b73faf51958e1f2cfbf6ea75f5417f054ccb9
|
|
BLAKE2b-256 checksum How to use checksums |
4d25f522b1999a5c86c798eca50102510146f3ef6e94737495b631076f312141
|
| 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.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.9.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 |
9d0aad839fab7f8aa4f71d6d56456769ee8340ad606d31a4c34b665ca4499490
|
|
BLAKE2b-256 checksum How to use checksums |
a831708642f3f2c15be6ac395ed8232e8ce96bca9d9366f03b909e7494049aab
|
| 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.9.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.9.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 |
52a1b2ae48b816939fe3aee44581796e30086f507f3b8f038b42f12aad0daa9c
|
|
BLAKE2b-256 checksum How to use checksums |
a32a8dfe7b2bbcf6f7aeae993a982a09ceab5e65fa38dee343ad7801017b9d90
|
| 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.9.0-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.9.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
702d43dc10ffa21517a22f11c20039fd98c2b41029d12f458584853e6c4f49ce
|
|
BLAKE2b-256 checksum How to use checksums |
47bf42ef25f5b823e5b217a146acafad9ce073b4e96be37d2179c6e3fbcf19a3
|
| 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.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.9.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 |
9d0c39f3f1c9d388798105766f2eea84746a63bf14df8330aa2d688ac68f39e1
|
|
BLAKE2b-256 checksum How to use checksums |
960e458cbeea07b5c2bd41cfdc7f9c52ea21cb83f8ade300fa555ba0eaceca32
|
| 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.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.9.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 |
2f8c90e842b84b8d4352fd5d1cf2a8cefe128fc0767f78b6f2c51cd3a02aec89
|
|
BLAKE2b-256 checksum How to use checksums |
c4bd07b7b9bd9771b40a46d27436ebd8cd2c9f19338d3fa8b4df07346458c2c0
|
| 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.9.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.9.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 |
a67640777b5f0a65e14d21199b81d0b3e644e1539748aa51893ea7d2f4efa657
|
|
BLAKE2b-256 checksum How to use checksums |
2313307a175315935a76b70b797fdcda6fd05e0a21a651abde08c01ab094b135
|
| 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.9.0-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.9.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a70c4970bae3cd511b95c854bded16796110846a25caff940b6ccab8ab3f74a2
|
|
BLAKE2b-256 checksum How to use checksums |
f1137fba3672723c1424dc571848c7f4ea9248111b9aa0b4cb2ceb2aadb02b8d
|
| 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.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.9.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 |
f935071c892baeff3a6aba50de753c2c8dd000eabc043bd0cb336f5436f5ec6d
|
|
BLAKE2b-256 checksum How to use checksums |
0edd278ec6d0fba91050bcf16754ee85f11fc57cefd965e9ecd9f4c7ca4f9736
|
| 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.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.9.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 |
03e87b2680519c1079c5bb2a155eaf3db2a702ce648e0eba4c601a4f4735c96a
|
|
BLAKE2b-256 checksum How to use checksums |
9350f75d8109287a2aa5f2779e45f267f1dcdc19ad0a4463bf39cd01b4a7837e
|
| 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.9.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.9.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 |
ee3dabd68005b39e93bd349b61e7362f4894db135ef425699f775dc177095aca
|
|
BLAKE2b-256 checksum How to use checksums |
dfd6e9e7e36e9f4031c011db810b701a33c26738bf488ff9b08c13d6625a8d2d
|
| 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.9.0-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.9.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d6ff5986dbcb36027d2f80833dd80ebab3f98156efd5a501deff26e3dfc6ad75
|
|
BLAKE2b-256 checksum How to use checksums |
b5824ab13cf04bd551f4d6ab2b346943cb59f4ab22fcf15d319ac30009d0a4ce
|
| 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.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.9.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 |
f3fde1e6891dede0b58a0c784447fc541ced5c0fdc78330f1a5a776a4d13f9ba
|
|
BLAKE2b-256 checksum How to use checksums |
49ccf6905a69ee568a1a07878beb752a4af633eca2ef978ccd8aa591447a6cc2
|
| 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.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.9.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 |
39ce1a944b5fd3b7661297430bceab4c6e1e014df5381d6b8fc4f9dca4125d00
|
|
BLAKE2b-256 checksum How to use checksums |
0b98b543cef0b15c9f18307754567dd5d585d26869ab10277e339d58762d0b5b
|
| 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.9.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.9.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 |
9e6fd090abfd7e240f0ca6095701c97e16730b99836a692a65545c2489fd2fcc
|
|
BLAKE2b-256 checksum How to use checksums |
d34053a6812327450c69c80067084a0065476828edcaab1326d6a59c9f48de96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|