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.2-cp311-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.11+Windows x86-64

moviepilot_rust-0.2.2-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.2-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.2-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.2-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.2-cp311-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

moviepilot_rust-0.2.2-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.2-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6a4c8b41f00b5ddce499f13caa9346fbac5ea46bface2f2996a5ed574acb6a07
MD5 6668dd13655a8c416deed4970592e613
BLAKE2b-256 2fa6e026291eb39a35d4366e85e87be19b170902bca8db2b9f6a78d6bf0eede6

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 7748e0b4e2a8f835c434309839f70507f6c5e3306aa426030f8ff03159c43e72
MD5 f54b9996f2cf460865fbd5c3d24e5052
BLAKE2b-256 1815cfd76380f7cb550eeab023e035f855a1f860291c104a77b71ae31e80ca38

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 29675ed91a5ace788c00913d334e5e72a5cb15ff1992db7c273daa1de3b93982
MD5 fdcf3b228292337bdb90803c9b8868c7
BLAKE2b-256 61ad667a06bf785f30e332c96590d1d85d2e5f4c06d65bc490dcce6e542f49fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1919a1b4471404ba05bab4aadfc75d6a219c4f0ad4d3492f323f93207e0a8d58
MD5 e537ea2ad01c032a31a628df1187e492
BLAKE2b-256 9c7cc2d44b05d7caa50219480e529d2a58e1cc3724cf4f1c60c36ef6bf466cd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6217f8158d51cf1b2819315d8266930d926b17eb777e4f18c7dd5246e81d7f69
MD5 a9576580937342c10fb6ef65b5768d38
BLAKE2b-256 4f7129d7fec9f5f2c1841ce7a47fb08f829ae15d0f0b1bcdd5f903d8da41d96d

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f092a0e310aa9f5d9f8567b890aad5157f5d4718ce73e2490f24de7af8333f80
MD5 c1996389aa244ffd0834ebf0a8208870
BLAKE2b-256 0e80c08241a6ab13a000f537919377d9c63396466150b66bd331e8bf7e98dbd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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.2-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for moviepilot_rust-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a511786521d8aaf4fdd4c8fd957727586a42c7870654abc1d9671469b8fd8720
MD5 f5690153bdde2f75c85a7c6295116f9c
BLAKE2b-256 2958e40537dadbd7acec32e3011f0c05409379236f435c1939cd145e14d4a8bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for moviepilot_rust-0.2.2-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