rumen
小方块,大吞吐。Rust 干重活,Python 管好用。
用 Rust 编写的 fumen v115 解码器,通过 PyO3 提供 Python 绑定。输入谱面字符串或查看器链接,得到盘面、操作和注释,用来分析谱面、处理训练数据,或者接进你的方块工具。
- 每页独立的
24 × 10盘面快照、方块操作与事件标志,支持注释继承和 Quiz。 - 紧凑盘面存储、原地转义、Quiz 缓冲区复用,减少重复分配与搬运。
- Python 支持按页访问、批量整数矩阵和类型提示,解码时释放 GIL。
Python:几行就够
需要 Python 3.11+、Rust 工具链和 uv。以下从源码安装,在仓库根目录执行:
uv venv
uv pip install .
用 .venv 中的 Python 运行:
import rumen
fumen = rumen.parse("v115@ghE8JeAgHvhAAAA")
page = fumen[0]
matrix = page.to_matrix() # list[list[int]],24 行 × 10 列
for page in fumen:
print(page.notes, page.flag.positions())
matrices = fumen.to_matrices() # list[list[list[int]]],页 / 行 / 列
fumen 支持长度、下标、负索引和迭代。模型属性只读,导出的矩阵是独立的可变列表。
Rust:直接接上
在消费项目的 Cargo.toml 中添加本地依赖,把路径指向这个仓库:
[dependencies]
rumen = { path = "../rumen" }
use rumen::DecodeError;
fn main() -> Result<(), DecodeError> {
let fumen = rumen::parse("https://fumen.zui.jp/?v115@ghE8JeAgHvhAAAA")?;
for page in &fumen.pages {
println!("{} {:?}", page.notes, page.flag.positions());
}
Ok(())
}
Fumen 也实现了 FromStr。原生 Rust 使用不需要开启 python feature。
命令行也能用
cargo run --release -- 'v115@ghE8JeAgHvhAAAA'
输出完整的 Rust Debug 结构,方便检查谱面。
接口约定
- 盘面是当前页操作前的状态,按
[y][x]访问;左上角为(0, 0),向右、向下递增,y = 23为垃圾行。 - 矩阵编码
0..8依次对应Empty, I, L, O, Z, T, J, S, Garbage。 flag.location与flag.positions()使用同一套自上而下的坐标。positions()返回方块占据的四个格子,无活动方块时为None;坐标可能超出盘面。page.notes是继承与 Quiz 推进后的可见注释,page.flag.note表示该页是否显式更新了注释。- 解码失败时,Rust 返回
DecodeError,Python 抛出rumen.DecodeError(ValueError子类)。 - 目前仅提供 v115 解码,不含编码器。
开发
cargo fmt --check
cargo test --all-features --locked
cargo clippy --all-targets --all-features --locked -- -D warnings
# 先按上文安装 Python 包;以下为 Linux / macOS 路径
.venv/bin/python -B -m unittest discover -s tests -p test_python.py
发布
Release 工作流 构建 Linux x86_64 / aarch64、macOS x86_64 / arm64、Windows x86_64 的 ABI3 wheel,分别在 CPython 3.11–3.15 上测试,并验证源码包。
推送代码、标签或普通手动运行只做检查。发布 GitHub Release 时,标签须为 v<Cargo.toml 中的版本>;全部检查通过后,crates.io 与 PyPI 使用 OIDC 发布同一版本。两端 Trusted Publisher 均绑定 A-Minos/rumen 和 Release.yml,不设置 Environment 限制。
crates.io 首个版本需在本地 cargo publish --locked,之后才能配置 Trusted Publisher。首发时推送对应版本标签,不创建 GitHub Release;手动运行工作流,选择该标签并勾选 publish_pypi,只补发 PyPI。
项目采用 MIT 许可。协议行为参考 tetris-fumen,相关第三方许可见 LICENSES/tetris-fumen.txt。
Metadata
Release files for rumen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rumen-0.1.0.tar.gz | 37.5 kB | Without provenance | Details for rumen-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| rumen-0.1.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for rumen-0.1.0-cp311-abi3-win_amd64.whl |
| rumen-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for rumen-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| rumen-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for rumen-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| rumen-0.1.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for rumen-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
| rumen-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for rumen-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 1.4 MB
Release files / rumen-0.1.0.tar.gz
| Download URL | rumen-0.1.0.tar.gz |
|---|---|
| Size | 37.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e2d3f4f57258a483114235adfa2e0d10236353ffd9c7f3bfc63a0985a69a727
|
|
BLAKE2b-256 checksum How to use checksums |
99e64a49bd9cde32120c86c78f9d732d5797bd7981226478cb627a2a412d1f79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rumen-0.1.0-cp311-abi3-win_amd64.whl
| Download URL | rumen-0.1.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 162.1 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
27e6bee337bc925771c473e603b85ad41e080753c7ba274a30755963e66906ef
|
|
BLAKE2b-256 checksum How to use checksums |
a57200ff7c2c86af37bafcfe0065cc3a382e01a8339370a6bb4e86ccc5439b3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rumen-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rumen-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 308.8 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c593323fb36d707f5561e35a7ee0411432335d026c520c8af716536da40ed313
|
|
BLAKE2b-256 checksum How to use checksums |
96d101250d87e0755ed1853426b2f347d73e60b6eb40154d8f8702e1385e3408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rumen-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | rumen-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 305.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
479f22be1d47b615b8b81fc0d54eda4e796ca801e1c23ed903f41b6e6af0de9e
|
|
BLAKE2b-256 checksum How to use checksums |
77577ba2fdf6bb2192240e8b365a541fea47953fa918f5dc6bc1692e5bb61e38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rumen-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | rumen-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 275.5 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f0530ed27fe06075edf2197764df253e85444eb1dbe386cdca927a270152f1bf
|
|
BLAKE2b-256 checksum How to use checksums |
929a8c58227d1b5ce4ea6a281958803d07476df4967bc0e970d535e0b5b463f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rumen-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | rumen-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 274.7 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d91f918c7748f119041a6dfd0145e855b55f6dd6b76cafd939449b668036a1b
|
|
BLAKE2b-256 checksum How to use checksums |
d1f0ccaea662598ed9b908e7ce2d422a57ea0d454bd6fd12116333814085be9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for rumen 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.