Parse Minecraft-relative JSON to structured objects
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
minecraft-schemes
Parse Minecraft-relative JSON to structured objects.
Disclaimer: Although the project name contains "minecraft", this project is not supported by Mojang Studios or Microsoft.
Install
pip install minecraft-schemes
Usage
To run the following demo code, you need to:
- Copy code to an empty python file
- Download the version manifest file and save them to the location near the python
file, with filename
version_manifest_v2.json - Download the client manifest file for 1.21.10,
save them to the location near the python file, with filename
1.21.10.json - Install both this package and rich
#!/usr/bin/env python3
from shutil import get_terminal_size
from rich.console import Console
import mcschemes
console = Console(markup=False)
# Version manifest
console.print('Version manifest'.center(get_terminal_size()[0], '='))
with open('version_manifest_v2.json') as f:
version_manifest = mcschemes.load(f, mcschemes.Scheme.VERSION_MANIFEST)
console.print('Latest release:', version_manifest.latest.release)
console.print('Latest snapshot:', version_manifest.latest.snapshot)
console.print('Prettified the first client manifest file info:', end=' ')
console.print(version_manifest.versions[0])
console.print('=' * get_terminal_size()[0])
console.print()
# Client manifest
console.print('Client manifest of 1.21.10'.center(get_terminal_size()[0], '='))
with open('1.21.10.json') as f:
client_manifest = mcschemes.load(f, mcschemes.Scheme.CLIENT_MANIFEST)
console.print('Version ID:', client_manifest.id)
console.print('Released at:', client_manifest.releaseTime.to_datetime_string())
console.print('Updated at:', client_manifest.time.to_datetime_string())
console.print('Main class name:', client_manifest.mainClass)
console.print('Asset version ID:', client_manifest.assets)
console.print('Prettified asset index file info:', end=' ')
console.print(client_manifest.assetIndex)
console.print('Prettified the first library dependency info:', end=' ')
console.print(client_manifest.libraries[0])
console.print('=' * get_terminal_size()[0])
Outputs in the terminal (the size is 80x24):
================================Version manifest================================
Latest release: 1.21.10
Latest snapshot: 1.21.11-pre5
Prettified the first client manifest file info: VersionEntry(
id='1.21.11-pre5',
type=<VersionType.SNAPSHOT: 'snapshot'>,
url='https://piston-meta.mojang.com/v1/packages/0c44a8417875d1b1d5d3056c3a35
ff9717342de0/1.21.11-pre5.json',
time=DateTime(2025, 12, 3, 13, 26, 59, tzinfo=datetime.timezone.utc),
releaseTime=DateTime(2025, 12, 3, 13, 14, 25, tzinfo=datetime.timezone.utc),
sha1=Sha1Sum(hexdigest='0c44a8417875d1b1d5d3056c3a35ff9717342de0'),
complianceLevel=1
)
================================================================================
===========================Client manifest of 1.21.10===========================
Version ID: 1.21.10
Released at: 2025-10-07 09:17:23
Updated at: 2025-10-07 09:17:23
Main class name: net.minecraft.client.main.Main
Asset version ID: 27
Prettified asset index file info: AssetIndexFileInfo(
id='27',
sha1=Sha1Sum(hexdigest='4a667d8cb576e16de8197074c978531c01cd6544'),
size=507362,
totalSize=435439577,
url='https://piston-meta.mojang.com/v1/packages/4a667d8cb576e16de8197074c978
531c01cd6544/27.json'
)
Prettified the first library dependency info: LibraryDependencyInfo(
name='ca.weblite:java-objc-bridge:1.1',
artifact=None,
classifiers={},
natives={},
extract=None,
rules=[
RuleEntry(
action=<RuleAction.ALLOW: 'allow'>,
features={},
os=RuleOSEntry(name='osx', version=None, arch=None)
)
]
)
================================================================================
History
Versions follow Semantic Versioning.
0.2.0 - 2025-12-11
Changes
- Project metadata: Declared build backend
setuptoolsintopyproject.toml. - Project metadata: Added
MANIFEST.infor setuptools. - Project structure: According to PEP 561, an empty
py.typedis added into the root directory of package. - Project structure: Moved
typings.pyto the root directory of package. - This history file: Corrected the date format in all tier-2 titles.
- Added a SHA-1 hexdigest container type for
sha1/hashfields (un-)structuring. Its definition can be found at:mcschemes.specials.Sha1Sum. - Added some tool functions to calculate a set of rules (iterable of
mcschemes.clientmanifest.nodes.RuleEntryinstances) means allow or disallow some operation, such as append an argument or download a library file.
0.1.0.post1 - 2025-12-05
Changes
Project metadata
- Added project urls into
pyproject.toml. - Added disclaimer in
README.md
0.1.0 - 2025-12-04
The initial release.
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 minecraft_schemes-0.2.0.tar.gz.
File metadata
- Download URL: minecraft_schemes-0.2.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af675199a60d4f50faedfc13a245debd8442f399c210f600ccd155ed659c6373
|
|
| MD5 |
6d3a5ad0a5e431b9db2af750b6454d7b
|
|
| BLAKE2b-256 |
e5a478f788af3d8694e8eebfa134eee89c2d320d925cbfeff0fdf198d6189715
|
File details
Details for the file minecraft_schemes-0.2.0-py3-none-any.whl.
File metadata
- Download URL: minecraft_schemes-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c7f81308260f25e023ba6970f168baefb597eeaed30ca726499ec6f1b25c6c2
|
|
| MD5 |
f27b455700b757a84fe04e2a8156206c
|
|
| BLAKE2b-256 |
a127dd288f166f0260804aa630ddf97e788a39089768ffef3662e09d40c0e06e
|