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.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 29.7 MB
Release files / aria_engine-1.6.1-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.6.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9d7bfe50dbbfac8a031e38f534a6ad7830d6ad19cf31e7a0207ca36101513da7
|
|
BLAKE2b-256 checksum How to use checksums |
3cf7d0e804a4e9866fcd571ef70b5d6edecf50da4342de5a16e609cfe5c00bff
|
| 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.6.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.1-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 |
94fc3c6b216efda513722a095f1b81397653f8909360fff5b71ecfc40016e5d7
|
|
BLAKE2b-256 checksum How to use checksums |
d2f9a81e172fd82442f496c18669010deb7fecd89ab1765768e7df069a2ec7c0
|
| 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.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.1-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 |
b232eab7ff7dd8099628fc8a689f9229e1c755e91a87f1877b3f4ba15e26e73d
|
|
BLAKE2b-256 checksum How to use checksums |
00e572168c122a6eaa94c5cb59fe285dd05994e04302946ffdce4dd3d48edafd
|
| 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.6.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8f2413a884f2b0fc3a19718205582de9e5dbba268780b54501c863d713900b8e
|
|
BLAKE2b-256 checksum How to use checksums |
94aa119e3889ca2b96246f420d5b966835f1ab0e37234b7113e6696a2ce6de73
|
| 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.6.1-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.6.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b118935d9f4d61e8404bdc67d1b74fee5809545bad1b0ebc126e97a955202903
|
|
BLAKE2b-256 checksum How to use checksums |
ac1c0f88107db512b962f84f3c9ea820a51caa43fea7a0c6fe3e091b824a0f99
|
| 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.6.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.1-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 |
bde65f8ccb1076aac1e8bca0ff58bae4723fbe3d6aae718afe493217bf7e89af
|
|
BLAKE2b-256 checksum How to use checksums |
12d0bcc44f5bcf09cf48e17401b42bbb1237336b49cf1f5f457cdf464c6039a0
|
| 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.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.1-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 |
d71de562691fae38fd695295d1428f326b1238a67171dabff04b3c8df84ee9b6
|
|
BLAKE2b-256 checksum How to use checksums |
d6c31311ce23a9567ab20fe0b1183b7fb19f6a4655998bc5eb577ac19d492b7b
|
| 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.6.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ad53eef3b1d1b2b09f740c9b0819c3607752fab15e590309543ca324ea1c7bc2
|
|
BLAKE2b-256 checksum How to use checksums |
ab62f4ba6571242156c441b4e99bc1656cba0e1755699931880f53782d7a1b7e
|
| 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.6.1-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.6.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1c6f273a61f27ea55cf8d5c439c4ea464387c35bfd539f02aaaa222d1582161c
|
|
BLAKE2b-256 checksum How to use checksums |
aac638be29c6745d0bae3daee8f4924380463d6093a63ccc0179454a35c52e40
|
| 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.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.1-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 |
b9f79291e59d2783b4d28421b5f1f01fb1d44e6498c816af0c3f13343e1c3a8d
|
|
BLAKE2b-256 checksum How to use checksums |
da61f9d649406a13cf85a8dfc19a6bf193513b31604b9bd5a1b6c278fb6887f9
|
| 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.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.1-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 |
33c9c17ae56269662f1bbe8307f6ec36bf41a4275199bee034c9abf5f450b837
|
|
BLAKE2b-256 checksum How to use checksums |
a7faddee34632891da43a5cfde2802aaa2fcdf72e8a2ce59261aaf80dc47d08d
|
| 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.6.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d1a0c6d70567865dffd088d760941691299bea0a9e278ac4802687615ccdc75e
|
|
BLAKE2b-256 checksum How to use checksums |
9a0568a4c53c838f732b190da24241826571c68ec597dcafbc87213527b7da8e
|
| 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.6.1-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.6.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e346d7ab05a372b4cf69d2b1074bba978d253b3730341e826e6f652dcdf3046a
|
|
BLAKE2b-256 checksum How to use checksums |
9915767b79980c41756350a7b9ce4bd67e27d9352b41566d1dc11c9fece6d0d1
|
| 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.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.1-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 |
98e16da00c97ca868bcbdc66334d18ae1f98d022ce26c3bcfd6b0b15dcb34f01
|
|
BLAKE2b-256 checksum How to use checksums |
940b52de7070a2d152c39cbc21d1f510e0a84a59f18cdc4d3ea7efe8fbfce3a2
|
| 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.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.1-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 |
e4d0eb2e815787e225fa84861484fe3e877c71fba7eb891095847c8e62135a94
|
|
BLAKE2b-256 checksum How to use checksums |
3f836ab3d94062068dec7ea93f2cd7b990af1a38dbd3e15da76e02a51983f5cc
|
| 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.6.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
91ff26040d1c594c2c6b6b753da8292967dd84aea300543e203531939da176d4
|
|
BLAKE2b-256 checksum How to use checksums |
7d17d277073b8a6b14ea2fdca5cc92d4145959b52abd0b0897ca13a25c6a5727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|