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.5
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.5-cp313-cp313-win_amd64.whl
| Download URL | aria_engine-1.6.5-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
dc691cb9eac4ea354fa495c14443c7b4779098dba985af4419bf9dff1eb38051
|
|
BLAKE2b-256 checksum How to use checksums |
36d972b1bee28f70e2befabea62201b84744e310bc6450cf3d34c56c83f38b07
|
| 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.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.5-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 |
91aca7f9912397c03d2b3051ba5fa02b03ba5ac6bb2581b5f2d42a553b046cea
|
|
BLAKE2b-256 checksum How to use checksums |
747f4d6b82fcbf053d58ac202e0f8ef9c63377fb51c56f71a00160757047b7e3
|
| 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.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.5-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 |
005f2e7e31f6a0dfb95e629d00b9d7d4eaeb0d796610d5592e5a6fca1601f689
|
|
BLAKE2b-256 checksum How to use checksums |
112f2dda838be4f938f0b7837d5881bc36d55b91ba8cccecbb3e923aee00c0b4
|
| 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.5-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.5-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 |
346c48b1eeaa06d1bdefde9b1fc91519350037e1f681e02cbf84656489e75d9a
|
|
BLAKE2b-256 checksum How to use checksums |
0bc6359572cd729214e15001e6f7d2735040dc5379dc414571b1a81a2d47363c
|
| 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.5-cp312-cp312-win_amd64.whl
| Download URL | aria_engine-1.6.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
924c9d6890e0459510f0edce95125ad667225d48052127428b3b139709468b55
|
|
BLAKE2b-256 checksum How to use checksums |
8632cf5f1a38b8a1514ef05fb61e9d94b326b346c38afc04fd2ed3b8eaf218c5
|
| 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.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.5-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 |
d405827f3bde5e82dbc89081d8993d68b63cad72d304829904609799bc65bd12
|
|
BLAKE2b-256 checksum How to use checksums |
76c09919b96a270cf15d7f5bc9a20842bbe4c324727df656d07dcc2febfc4e6f
|
| 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.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.5-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 |
b5ead8fe2dd05d16a6ae9b9409b120b1dcca5387b7d38cef9391eaaeb37ebbb6
|
|
BLAKE2b-256 checksum How to use checksums |
e420664e5cff7085e735f07e1c3e24521fc66d0ab7ddf173b5b78009dfc638c9
|
| 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.5-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.5-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 |
b011236806cc3a35012d440238bafcf7f644d15225c06bee086ebed778d61834
|
|
BLAKE2b-256 checksum How to use checksums |
d771f223c16c46a76820467c249430a3f9c61dbf52b91cfbca8dabf6571613d4
|
| 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.5-cp311-cp311-win_amd64.whl
| Download URL | aria_engine-1.6.5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4defd0187d83815780d45a49203388b498da81117986646df2304fcc65542333
|
|
BLAKE2b-256 checksum How to use checksums |
8f2cc073c2e918a566b761619fb966cf4992bc12f5cebd313cd9bc56a8c31302
|
| 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.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.5-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 |
1237bc934a430fb458f8513588e7bfd872ee4b538cc58c1f81f8f88b2c228a78
|
|
BLAKE2b-256 checksum How to use checksums |
fa760cc48d9fd0681b2c7111287db7db8825fbc86a5d64408c436b139bb0b127
|
| 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.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.5-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 |
b92fc5c5050a42aa2259aa1c1c10abd991dc038f1d7c7365308eabd7d5cc7fe1
|
|
BLAKE2b-256 checksum How to use checksums |
c511e8470429736497690673eff15ba7b8d6cf507c1086c7f828db4b091434ac
|
| 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.5-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.5-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 |
86ae6c2237e1ed17068f7df3ae5d48f23cbe1241e38a52265b0884c09e2ebdc8
|
|
BLAKE2b-256 checksum How to use checksums |
b5ca8494357b8ead800507325d83ac4daf4a12313ba75bee6ebe0342f15c56b4
|
| 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.5-cp310-cp310-win_amd64.whl
| Download URL | aria_engine-1.6.5-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
bcfae1b3066a1d674cd0a64e08a1923fe8b5d2db9dfeeb8ad864fb93cf163b12
|
|
BLAKE2b-256 checksum How to use checksums |
7b35682d5a5b1c12bac4aade2ce755c4ad38bcfc8dd02e39a99730b1789b4fb8
|
| 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.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aria_engine-1.6.5-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 |
faf4b6264be0d385f8c388113366cd7c2fcd7006c2875a3ac7a01f0770a97cc9
|
|
BLAKE2b-256 checksum How to use checksums |
831c62cfc027fea304e80ef6211d09acd6de3ff9fb12146c255d5e3d1868f173
|
| 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.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aria_engine-1.6.5-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 |
195cfd0203c70db18e4d034da3ad02c8060876012b1b40a175c6ad94bc752c66
|
|
BLAKE2b-256 checksum How to use checksums |
6e7797e01346586ac51151d085697df9dc6c7c69f6012c3249e37b79b3c9d2c1
|
| 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.5-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aria_engine-1.6.5-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 |
c67afd985f455aa9da1e31325b54c61329cec1019d481c619151e57c4209b659
|
|
BLAKE2b-256 checksum How to use checksums |
f9dcb062bf21d384e60939894d39113076e5993800cac9198bec85aa31a4f5bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|