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.10.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.10.0-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.10.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fe97610bd4de5c5c6346afe245024effc64e87bd6b2cede955b702d7f02ac5c8
|
|
BLAKE2b-256 checksum How to use checksums |
c6610dce4d153845e6c4799ac8a896f831889a1a4c57ec64d77be13e39493fcc
|
| 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.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.10.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 |
1dfccd43e866aa8635dd108f10a69ab48ab2ab79878ef9ec9691553d178b79a6
|
|
BLAKE2b-256 checksum How to use checksums |
1aa318ad04604a2d2814b31e8bb49a53c2e676b4038362981f807fb03d139ec1
|
| 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.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.10.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 |
ee95659e12e8b42a1f1126e6c5a5020f15d206c1245d1af98804f8a8c8d68746
|
|
BLAKE2b-256 checksum How to use checksums |
b38d7693a490d311f98e73de1f52a6f3e46a62575855bee4b9e27b18ab4a6aab
|
| 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.10.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.10.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 |
1a31f3a101fe49e78cf14d74d505a01e683b92288dc572cd9fcf8e143b63dc04
|
|
BLAKE2b-256 checksum How to use checksums |
241bd3098689b2b9cd8b841db40336916ea5cd7cb1cbd92b262474fd4fa8ce41
|
| 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.10.0-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.10.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fa2a744dc5c49e58d5f309182310dcbea36d2a217f19da966c13ead51c11c78a
|
|
BLAKE2b-256 checksum How to use checksums |
f8d2a5b4aab1af55b07d72b49332006ec59d58cecc43a2fddffe86f3275892f6
|
| 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.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.10.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 |
5b41f2150250b276df0e45b5c97fb565f9fcef937e2fd1e0bbfe64dd75044a36
|
|
BLAKE2b-256 checksum How to use checksums |
f5491baa7a235876fd50d42df7ebbfdb26eb66dd5e9ac9e1eda7adf4c795c615
|
| 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.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.10.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 |
1dce1f4eac05d3e7f8d8a5235f4b84837ede36873fd0eb24bdd90d74f699b18d
|
|
BLAKE2b-256 checksum How to use checksums |
7069ca6c987f4e116ee59505b37baf92f7cfc0a194c65f2fb9ee5068ef5e164e
|
| 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.10.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.10.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 |
241cd9c20a94c102690a8b13a91b4b99ce0cf309893f288eda4c8736579e5f0e
|
|
BLAKE2b-256 checksum How to use checksums |
71d696960d01afd88c321d76562509996758f82da2afb56f83ee7941f16f7f22
|
| 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.10.0-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.10.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
19e465a834de822a4f5210b16acd7b837cf8c1b2ae51ee1c7202d4535101c666
|
|
BLAKE2b-256 checksum How to use checksums |
332ce2eed73e81d867bb26308fe04b4c92ef5b897e935dcf7ab42f8a5c664613
|
| 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.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.10.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 |
6ef9559b49d8cd76f1deb5bb1e1e67c40beaee02ba3844dd431665315e97ad86
|
|
BLAKE2b-256 checksum How to use checksums |
f82c1e81e8188d6acfd59d82366c134b22f40ddcb3dc800a306530b589080d54
|
| 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.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.10.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 |
bb1f44eec54d0633f0f311a33d812a59d45084dbd79e10778104efb02a350daa
|
|
BLAKE2b-256 checksum How to use checksums |
8ca66e7c3c2d2b57278ce31beba2653bf1a23c599872e229a1b2777cae6c4c10
|
| 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.10.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.10.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 |
285ba9b290c9eb995c7b9318cf20a94e27100f6cd37b32815ca4869f2abb9ea4
|
|
BLAKE2b-256 checksum How to use checksums |
ab3066795d3c59bd2c13ff527be90526908152dbb7efc81be7f2c43335236967
|
| 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.10.0-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.10.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
253b99c1b71ff1e2d308b7193461d9e95c7ff6981fa611711346a0492e46725d
|
|
BLAKE2b-256 checksum How to use checksums |
0d66e4738360dbbebc49eb1e4f88d8a61a1e6b877656aabc929538aded70750d
|
| 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.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.10.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 |
f87677eae3db5a3981675c2774d0a5c6ae8c81047a56352febdae9597476729a
|
|
BLAKE2b-256 checksum How to use checksums |
0dc804486ccea7633574c53f0832202c4e38f33011cd6b04b3556d3996918472
|
| 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.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.10.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 |
76d5406dbdc92db10b4d24cdd02ada355a8155164f98c1a42916b8f75bfd8cad
|
|
BLAKE2b-256 checksum How to use checksums |
813b2884cd69a5a9371f599c5e0ede39207f44f8c123ef99b5f34117fa97de6f
|
| 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.10.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.10.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 |
932c2c007610551425cadbb49dbf0091f252d0dea47b92b726cb6c760b86ad37
|
|
BLAKE2b-256 checksum How to use checksums |
6a777759831c26ed89cc4ee6d6b31840c8acb993de03487c1c634f2d006ee58e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|