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.2
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.2-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.6.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
42fbb881e33fa27b02dcbfc211924971006ade4be9bcdd0df273dd0ffa18a06a
|
|
BLAKE2b-256 checksum How to use checksums |
f1a299bd6e0b9d3637d2ffe26c66cfa0acc6c429037bf7c7e0b75a69ea7d2560
|
| 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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.2-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 |
744c41bc38deb5da572e2a30a34efcb527ed8811c252ef60d63a678e7abcee42
|
|
BLAKE2b-256 checksum How to use checksums |
844d47040cb03ba631929275934c64b9b222428f3209d69285d394aedc92af63
|
| 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.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.2-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 |
aa84fd4287816ebb098d20418607892fcb508efea40f1b79cff3170b78613d2a
|
|
BLAKE2b-256 checksum How to use checksums |
4948c97c9240c81474d406f5a8f9d49f2261088401acb0cd2f4ce903e195f4c5
|
| 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.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.2-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 |
3c750bfedd3ff4fbcfe02d0b0b62610333efa7793f65724a1eddeb7afe6ae74d
|
|
BLAKE2b-256 checksum How to use checksums |
436b10894f1aa34013ff224238cce20e7a1f632712c480591c3ae4b0a52b4bd2
|
| 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.2-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.6.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d10bf2e139a0a4dfb6befd6ea18acbd6333e9514da59603fb4b74dc0910f93b2
|
|
BLAKE2b-256 checksum How to use checksums |
8da4ea3bbfc6479a83eb2f3898803a61c098c7c89a716092e44242c6dfc0490a
|
| 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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.2-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 |
9d094d23d75f262f30aeb9d079c7bc7ee0f0d4daccbc10a8f8af068b2d919c8d
|
|
BLAKE2b-256 checksum How to use checksums |
d6294da7f828afc99edb72a00fbe4565adacab571c4b72b97f6996db040d2060
|
| 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.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.2-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 |
3f1e71b0f89ac9241dfd97ad832706c2c05e13a90d1e02b92d8ed16136113279
|
|
BLAKE2b-256 checksum How to use checksums |
e442b4e8e832d07204109bd0539fc2b4fc281dd375dade931451839cc8215e23
|
| 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.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.2-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 |
9665af00975d204ef4b0f4f73b1dcde4096fbe72dc0df8280f2fee5ea116397e
|
|
BLAKE2b-256 checksum How to use checksums |
9f13ca5c2701c647e109cf7ea63bfa42026fb948f04c8129e7ce10ce3d23eaf8
|
| 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.2-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.6.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3169fc87015b86ca9eb859871488d4fd0ec7eda319068e1f9fcc4cc54876e051
|
|
BLAKE2b-256 checksum How to use checksums |
b0b2c508bca50836ed77f0d7940c9be24815c35c2b2037549e20a126405a4152
|
| 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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.2-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 |
38775e469f5d35632654fa5227dfb56c0930191090723c82fe9f8219b5cd64af
|
|
BLAKE2b-256 checksum How to use checksums |
59d7bff1944121f482bfc3e00d6f7c2af50bdc075fa6494d5bfac66fb3d3c100
|
| 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.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.2-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 |
119ea93be0828e180d980e6e3d7213c4cfd0670a1acd34c1e0ecfc29d94940ad
|
|
BLAKE2b-256 checksum How to use checksums |
208d3b87215c95e78aafd30dd25bd1030b41fa4409437c584d43359f6386184a
|
| 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.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.2-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 |
6de17fa27e24855f79cfb42a49b7fae211f170a37a465016c95ab7213eb42072
|
|
BLAKE2b-256 checksum How to use checksums |
470e4ada6589daa6ec39b922036752a3618f9530526463dd6e91561aa391e7c2
|
| 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.2-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.6.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f155f47a3bf1031ce4631af9a816835000870c8630f93f15927529fe87f8414a
|
|
BLAKE2b-256 checksum How to use checksums |
17c0b87fc41b213af619d22e2d2f15a3d37066fe0ca05e77231d867ba28885ff
|
| 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.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.2-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 |
cac6a5c9f7fd388e43db45d8c0c8b05d99aa1154328be6ee155e3ea0f63fc5a2
|
|
BLAKE2b-256 checksum How to use checksums |
f0d96cacf2c2cfec74770e3e0a37ff83a4f66af90f76a43722e6a6ba3f27fdd0
|
| 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.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.2-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 |
bd3c201f29371353aa0fbaf61ba91e7c3d77626f6960daf849ff6ceeb1d27dcc
|
|
BLAKE2b-256 checksum How to use checksums |
f95c1eaa313756e8aa1144b076747fe35fc0623ac0b9bbd205e376a5721dd2db
|
| 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.2-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.2-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 |
e904cdf97f1f09cc267aa4d043b7f7a2596059fbfcbdeb03fe7c7a2ae4f5b6b0
|
|
BLAKE2b-256 checksum How to use checksums |
8f317070422cb62df3b947a42e48e3e063405146da273e04baa86fb2780eaf77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|