Skip to main content

MSBT editing in Python using MSYT

Project description

PyMsyt

MSBT editing in Python using MSYT

PyMsyt is a Python library wrapping the MSYT project in Rust. It uses a custom fork built as both a library and application. PyMsyt supports reading and writing MSBT files in binary, YAML, and JSON formats. Basic documentation:

API

Class pymsyt.Msbt

Class representing an MSBT file. This is just a thin wrapper over the Msyt type from the Rust MSYT project providing a few convenient methods for Python use. Note that manipulating the contents of an MSBT in code can only be done staightforwardly by converting with to_dict() and from_dict(). This class cannot be directly instantiated. Instead, create it through static parsing methods. Example use:

from pymsyt import Msbt
data = open("ArmorHead.msbt", "rb").read()
msbt = Msbt.from_binary(data)
msyt_text = msbt.to_yaml() # Convert MSBT to MSYT YAML
json_text = msbt.to_json() # Convert MSBT to JSON
msbt_dict = msbt.to_dict() # Convert to an editable Python dictionary
for entry, contents in msbt_dict["entries"].items() # Iterate MSBT text entries
    print(f"{entry} = {contents}")
msbt_dict["entries"]["Armor_999_Head"] = { # Adding a new text entry
    "contents": [{"text":"Some new helmet"}]
}
open("ArmorHead.msbt", "wb").write( # Saving modified file
    Msbt.from_dict(msbt_dict).to_binary(big_endian=True)
)

Methods defined here:

to_binary(big_endian: bool) -> bytes

Serializes this MSBT file to bytes.

to_dict() -> dict

Converts the MSBT contents to a Python dict.

to_json() -> str

Generates a JSON representation of this MSBT file.

to_yaml() -> str

Generates a YAML representation of this MSBT file.

from_binary(data: BytesLike) -> Msbt

Parses an MSBT file from a byteslike object

from_dict(dict: dict) -> Msbt

Parses an MSBT file from a Python dictionary.

from_json(json: str) -> Msbt

Parses an MSBT file from a JSON representation.

from_yaml(yaml: str) -> Msbt

Parses an MSBT file from a YAML representation.

Class pymsyt.MsytError

Generic exception thrown for all errors with this library.

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

pymsyt-0.3.2-cp39-cp39-manylinux2010_x86_64.whl (863.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pymsyt-0.3.2-cp38-none-win_amd64.whl (736.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

pymsyt-0.3.2-cp38-cp38-manylinux2010_x86_64.whl (863.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pymsyt-0.3.2-cp38-cp38-manylinux1_x86_64.whl (851.4 kB view details)

Uploaded CPython 3.8

pymsyt-0.3.2-cp37-none-win_amd64.whl (736.2 kB view details)

Uploaded CPython 3.7 Windows x86-64

pymsyt-0.3.2-cp37-cp37m-manylinux2010_x86_64.whl (863.6 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pymsyt-0.3.2-cp37-cp37m-manylinux1_x86_64.whl (851.4 kB view details)

Uploaded CPython 3.7m

File details

Details for the file pymsyt-0.3.2-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pymsyt-0.3.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b5bcb78b75d2e143ee557fff5286e93f3f03c7eaf44d60dc152598e8f6500b96
MD5 8f5c448701f0a1f98f18ebb3a1a8e3fc
BLAKE2b-256 d6dfcbb0bd0ec28ef1a8a90122fd4ca9113cc20f8dadb0461ff8ec6fcb057f29

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp38-none-win_amd64.whl.

File metadata

  • Download URL: pymsyt-0.3.2-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 736.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.8.3

File hashes

Hashes for pymsyt-0.3.2-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 d9dc39a8632f6891bb8155aeba5697b82a6b7bd913c13cb87242cef9939f596e
MD5 761a56c10231f652b239a113bca6acf3
BLAKE2b-256 ec7b3205373eb00d61ab06fa8db843995891403df822843a37de55bfa3b619f4

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pymsyt-0.3.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b33ef7ac97031f26fb78162d35c8ec8afd61c4b81d3f30b8a3e1feae2fdbf22d
MD5 5c2516d298bd9ce5a736d9e1ec815b1a
BLAKE2b-256 39c489c669d15f38af0251c709b847ca15e43385de1f333cb84376730dea18f5

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pymsyt-0.3.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b61492baaae234b6ed054c39968de07f84b171e398e386d09641c021decc8706
MD5 5c7af9b56166c33355c809a2949753e9
BLAKE2b-256 cb9c5f010962d275cdd64c21beb2fef4076c04f6f396c399e7f744956e621768

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp37-none-win_amd64.whl.

File metadata

  • Download URL: pymsyt-0.3.2-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 736.2 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.8.3

File hashes

Hashes for pymsyt-0.3.2-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 8bbe74a9740b61a982bfabdd7376fadfa8011d039efebf6a6b1f5d63c051e95f
MD5 d457243dd403f5964867d4deb77e0589
BLAKE2b-256 cb718249541b25340db956f0d8d69871f4f4a001e7a892909271e7f7253891c2

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pymsyt-0.3.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cd5c58036304947ce333de7b7f532332ffd1dd7b97ccc41b0e55aa05c31bf36c
MD5 92ac734d8f8a37bb6653edc556794f38
BLAKE2b-256 b424adc88f86d35dcbd5627d56f671d502caaaf55748c62a3903742b99d69d07

See more details on using hashes here.

File details

Details for the file pymsyt-0.3.2-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pymsyt-0.3.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bd0cb81373cdff02941d66372c184754353b3afebfbe56a0ca28e8e01a15e5f9
MD5 39ac9a1ef292b22e823804bfa32ee223
BLAKE2b-256 e9498f56cffb124973105cd72726b1e1a54b136ca5b7dfc56c3ae0e2b9a1b5e5

See more details on using hashes here.

Supported by

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