Skip to main content

Rust acceleration helpers for MoviePilot

Project description

MoviePilot-Rust

MoviePilot Rust 加速模块。

  • PyPI 包名:moviepilot-rust
  • Python 导入名:moviepilot_rust
  • 支持版本:Python 3.11+
  • 构建工具:PyO3 + maturin

项目结构

src/
├── bindings/   # Python API、输入快照和输出对象转换
├── filter/     # 类型化过滤规则、表达式 AST 和执行引擎
├── indexer/    # Indexer 配置模型、HTML 选择器和字段解析
├── metainfo/   # 元信息模型、配置、正则规则和影视标题解析
├── rss/        # RSS/Atom 数据模型和流式解析器
└── support/    # 与业务无关的有界缓存等基础设施

业务模块只接收和返回纯 Rust 类型,不直接持有 Python 对象。bindings 负责 PyO3 边界转换,因此核心解析器可以独立单测,并可在转换完成后释放 Python GIL。

本地开发安装

在本仓库根目录创建 .venv,并把 Rust 扩展直接安装到这个虚拟环境:

python3 -m venv .venv
.venv/bin/python -m pip install "maturin>=1.9,<2"
.venv/bin/python -m maturin develop --release

验证扩展是否可导入:

.venv/bin/python -c "import moviepilot_rust; print(moviepilot_rust.is_available())"

输出 True 表示本地编译安装成功。

本地检查

优先使用项目目录下的 .venv,一次编译后运行 Rust 和 Python 两层测试:

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
.venv/bin/python -m maturin develop
cargo test --lib
.venv/bin/python -m pytest -q

本地打包

使用仓库内脚本构建当前平台 wheel 和源码包:

scripts/build_wheels.sh

产物会输出到 dist/,例如:

dist/moviepilot_rust-x.x.x-cp311-abi3-macosx_11_0_arm64.whl
dist/moviepilot_rust-x.x.x.tar.gz

脚本默认使用本仓库 .venv/bin/python

在 MoviePilot 主项目中使用

主项目通过普通 pip 依赖使用本模块,不再从主项目源码内编译 Rust。

以下命令在 MoviePilot 主项目根目录执行。

安装 PyPI 版本:

.venv/bin/pip install moviepilot-rust

安装本地刚构建的 wheel:

.venv/bin/pip install --force-reinstall ../MoviePilot-Rust/dist/moviepilot_rust-*.whl

在 MoviePilot 主项目里验证运行时状态:

.venv/bin/python -c "from app.utils import rust_accel; print(rust_accel.status())"

available=True 表示扩展已安装可用,enabled=True 表示 MoviePilot 当前配置开关允许使用 Rust 加速。

发布

更新 Cargo.toml 中的 package version 并推送到 main 后,GitHub Actions 会自动创建对应的 v版本号 Release,构建 Linux(glibc/musl)、macOS、Windows wheel 并发布到 PyPI;发布成功后还会向 MoviePilotv2 分支提交 bump requirements.in 的 PR(需配置 MOVIEPILOT_REPO_TOKEN)。

# 修改 Cargo.toml 中的 version = "x.x.x"
git push origin main

手动在 GitHub 上 Publish Release 仍会触发同一套发布流程,但 Release tag 必须与 Cargo.toml 中的 package version 一致,例如 v0.2.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

moviepilot_rust-0.2.3-cp311-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.11+Windows x86-64

moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.1+ x86-64

moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.1+ ARM64

moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

moviepilot_rust-0.2.3-cp311-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

moviepilot_rust-0.2.3-cp311-abi3-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ac9d093272e52cbb0421f8bec502f922127a9d9229985a0d46f949a534f55d0d
MD5 fe279a5ee4564a3ba23b15f01ed5437c
BLAKE2b-256 e387b9c90001579ed3cd8cb1d92e84e80823ec037409848d5dafe62da9f188da

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-win_amd64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b28aa9246cf9a2b099e9693704c4e495183fe1c7be5cd5171d00245ffb92f8c5
MD5 d117ade3b77451e531beb2b8f2c22a1c
BLAKE2b-256 d2f1eaf3feebe190551b235b4ebb10011f3751e09413951ada6bab959c8a5c96

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_x86_64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 ccd2753bb01e43f99ca7e0b92fa18af4a92fafd931468723cefd7740a15e99d8
MD5 46187c2defb8877c57c425d45c9c1119
BLAKE2b-256 0311e63b3730013a3df2fa9fe9a424f5c59c4f8f1587098326c584248f446734

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-musllinux_1_1_aarch64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30d1e095520aecabe94ba43ef5b7bb5ec38df23cdd81d099e796744d79e21154
MD5 81ff25962b820a5b188a50d50953b728
BLAKE2b-256 f228f9e25f1321e810b21b4a93cd093df4d313c2c4b2e482788622d0b2a8b206

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 13d1368f7c2f354116d841f9db791afee1d146138fd373d5a9ed890edfb2e743
MD5 db7e58b8361869d5e97b34886cec3731
BLAKE2b-256 91d92fa87c08ac33397c3c0e29b804b3a4c8fac136f4c4a8b3d564672f29fc06

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ddf812827394f6ec24ddf144dd5aced26a896670e04a0b7ec7c9bf5f5874bfe
MD5 be5558afd63a8185955b1e17ce77629e
BLAKE2b-256 dc918be69b6a06ef888281b06983ab24a9198ef6570af76a626245498669f93b

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moviepilot_rust-0.2.3-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.3-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4a122de9e10a7d8294bb292d996689148c4b08d111b7f19cd9130b53b7105a42
MD5 05635839278825dda2da2916e1bd8704
BLAKE2b-256 ab6fe383b57e0d74342d9444afa62bb5069b853b759b5da5b9fd230c1d424404

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.3-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on jxxghp/MoviePilot-Rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page