Parse Minecraft mod metadata (modid, version, etc.) from Forge/NeoForge/Fabric/Quilt JARs
Project description
mcmod-parser
解析 Minecraft mod 元数据(modId, version, displayName 等)的 Python 库与 CLI 工具。
支持加载器: Forge, NeoForge, Fabric, Quilt
安装
pip install -e .
CLI 使用
parse — 解析单个文件
mcmod-parser parse jei-1.20.1-15.2.0.27.jar # 从 JAR
mcmod-parser parse META-INF/mods.toml # 从元数据文件
mcmod-parser parse jei.jar -o table # 表格输出
mcmod-parser parse mod.jar -o csv -f info.csv # 导出 CSV
scan — 批量扫描目录
mcmod-parser scan ./mods/ # JSON 输出
mcmod-parser scan ./mods/ -o table # 表格
mcmod-parser scan ./mods/ -o csv # CSV
mcmod-parser scan ./mods/ -o csv -f mods.csv # 导出到文件
mcmod-parser scan ./mods/ -o csv -f # -f 自动命名
mcmod-parser scan ./mods/ -r -l fabric # 递归 + 仅 Fabric
diff — 比较两个目录
mcmod-parser diff old_mods/ new_mods/ # 彩色差异
mcmod-parser diff old_mods/ new_mods/ --no-color # 无颜色
mcmod-parser diff old_mods/ new_mods/ -r -f diff.txt # 递归 + 导出
mcmod-parser diff old_mods/ new_mods/ -l forge # 只比较 Forge
输出格式: json | table | text | csv
通用选项:
| 选项 | 简写 | 说明 |
|---|---|---|
--output |
-o |
输出格式(parse/scan) |
--output-file |
-f |
导出到文件;-f 单独使用自动命名 |
--loader |
-l |
按加载器过滤 |
--recursive |
-r |
递归扫描子目录(scan/diff) |
--no-color |
禁用颜色输出(diff) |
API 使用
from mcmod_parser import parse_jar, scan_directory, ModInfo, LoaderType
# 解析单个 JAR
mods = parse_jar("jei-1.20.1-15.2.0.27.jar")
for mod in mods:
print(mod.mod_id, mod.version)
# 扫描目录
results = scan_directory("./mods/")
for mod in results:
print(f"{mod.loader_type.value}: {mod.mod_id}@{mod.version}")
# 访问元数据
mod = results[0]
print(mod.display_name) # 显示名称
print(mod.description) # 描述
print(mod.authors) # 作者列表
print(mod.license) # 许可证
print(mod.dependencies) # 依赖列表
print(mod.to_json_dict()) # JSON 序列化
ModInfo 字段
| 字段 | 类型 | 说明 |
|---|---|---|
mod_id |
str |
mod 唯一标识 |
version |
str |
版本号(占位符自动回退到文件名) |
loader_type |
LoaderType |
forge / neoforge / fabric / quilt |
display_name |
str |
显示名称 |
description |
str |
描述文本 |
authors |
Authors |
作者列表(统一格式化) |
license |
str |
许可证 |
dependencies |
list[DependencyInfo] |
依赖项 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcmod_parser-0.1.0.tar.gz.
File metadata
- Download URL: mcmod_parser-0.1.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eeb8c71b44c603e5d3e340bd5f0d1b4714b28776a49c94643d8ed8465343db6
|
|
| MD5 |
ad29daa302cf50dc8d04ebd39110d9b7
|
|
| BLAKE2b-256 |
88c9e8bcbac7981f6f6fb2e7099412f2dfb6b68a89a4ce93b6f379d095e26016
|
Provenance
The following attestation bundles were made for mcmod_parser-0.1.0.tar.gz:
Publisher:
pypi.yml on heartalborada-del/mcmod-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcmod_parser-0.1.0.tar.gz -
Subject digest:
4eeb8c71b44c603e5d3e340bd5f0d1b4714b28776a49c94643d8ed8465343db6 - Sigstore transparency entry: 1809064016
- Sigstore integration time:
-
Permalink:
heartalborada-del/mcmod-parser@b8450ea80608c9c2d7fdde5c83d0c8de7eb49279 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heartalborada-del
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b8450ea80608c9c2d7fdde5c83d0c8de7eb49279 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcmod_parser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcmod_parser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aef216d8b9ec80f2d060ab26623046e4047890b757e345379d0430e52554fabe
|
|
| MD5 |
dd48badadcddbff817b712756dcc778d
|
|
| BLAKE2b-256 |
7bbc3d454639709c54a0880d0690478ebd5ba0a606ea8a1f9f00d5aed1167d8c
|
Provenance
The following attestation bundles were made for mcmod_parser-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on heartalborada-del/mcmod-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcmod_parser-0.1.0-py3-none-any.whl -
Subject digest:
aef216d8b9ec80f2d060ab26623046e4047890b757e345379d0430e52554fabe - Sigstore transparency entry: 1809064037
- Sigstore integration time:
-
Permalink:
heartalborada-del/mcmod-parser@b8450ea80608c9c2d7fdde5c83d0c8de7eb49279 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heartalborada-del
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b8450ea80608c9c2d7fdde5c83d0c8de7eb49279 -
Trigger Event:
push
-
Statement type: