A simple package for reading Halo tag files.
Project description
A simple python library for reading (and perhaps writing in the future) Halo 2 tag files. Allows for tags to be introspected on any platform without the hassle of using the official tools.
SemVer may eventually be used but for now the API is unstable and subject to change at any time. Tag layouts are defined in XML in a separate repository and are compiled into a pickled format during package installation. The package license does not cover this layout metadata.
Sample usage
from Pytolith import TagSystem
import os
# initialize new tag system using layouts packaged with Pytolith
system = TagSystem()
MY_H2EK_TAGS_FOLDER = r"T:\SteamLibrary\steamapps\common\H2EK\tags"
BRUTE_TAG_PATH = r"objects\characters\brute\brute.biped"
path = os.path.join(MY_H2EK_TAGS_FOLDER, BRUTE_TAG_PATH)
# load the brute tag
tag1 = system.load_tag_from_path(path)
# inspect the feign_death_chance setting
print(tag1.fields.feign_death_chance)
If you want to edit the XML definitions first clone https://github.com/num0005/Halo2TagLayouts into a local path:
T:\> git clone https://github.com/num0005/Halo2TagLayouts
Cloning into 'Halo2TagLayouts'...
remote: Enumerating objects: 156, done.
remote: Counting objects: 100% (156/156), done.
remote: Compressing objects: 100% (96/96), done.
remote: Total 156 (delta 60), reused 156 (delta 60), pack-reused 0 (from 0)
Receiving objects: 100% (156/156), 384.26 KiB | 11.64 MiB/s, done.
Resolving deltas: 100% (60/60), done.
And then set the custom definitions when constructing the TagSystem object:
from Pytolith.Definitions import Definitions
from Pytolith import TagSystem
custom_defintions = Definitions()
custom_defintions.load_from_xml(r"T:\Halo2TagLayouts")
system = TagSystem(tag_definitions=custom_defintions)
You will now be using the tag definitions from T:\Halo2TagLayouts instead of the ones packaged with the library.
Using the package without install
Install the package using pip is the recommended way to use it, but if you are unable to to that or want to avoid installing it during development you can load the package directly. For instance setup.py does it like so:
root_directory = pathlib.Path(os.path.abspath(__file__)).parent
sys.path.append(str(root_directory/"src"))
import Pytolith
This depends on the tag definitions being located in the Data folder. Make sure you initialize git submodules if you are doing this.
Performance
Using PyPy is recommended as the tracing compiler provides a ~2x speed up on tag loading.
Installed packages include autogenerated tag readers which provide a minor (~10%) speed-up when using CPython. These can only be used if you use the tag definitions packaged with the library. See code_generator.py and setup.py for details on how the "fast loaders" are generated.
Installed packages also use pickle'd tag definitions, this provides a modest speed-up on first tag load.
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 pytolith-0.0.9.dev0.tar.gz.
File metadata
- Download URL: pytolith-0.0.9.dev0.tar.gz
- Upload date:
- Size: 374.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97da436e57f9af0a3883e3dc663f8d09753a00afca0bfcfe64db9a7bd0d2c0e5
|
|
| MD5 |
66a2b90a65e967d04f4c251dce368109
|
|
| BLAKE2b-256 |
cc6f79dd863a58aed31e03a0bd35fc833b8bd969c3e84375188a8b904a1517c2
|
Provenance
The following attestation bundles were made for pytolith-0.0.9.dev0.tar.gz:
Publisher:
build.yml on num0005/Pytolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytolith-0.0.9.dev0.tar.gz -
Subject digest:
97da436e57f9af0a3883e3dc663f8d09753a00afca0bfcfe64db9a7bd0d2c0e5 - Sigstore transparency entry: 156738276
- Sigstore integration time:
-
Permalink:
num0005/Pytolith@179bc752ce08ffc5f7555f014c4df56137c51382 -
Branch / Tag:
refs/tags/0.0.8 - Owner: https://github.com/num0005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@179bc752ce08ffc5f7555f014c4df56137c51382 -
Trigger Event:
push
-
Statement type:
File details
Details for the file Pytolith-0.0.9.dev0-py3-none-any.whl.
File metadata
- Download URL: Pytolith-0.0.9.dev0-py3-none-any.whl
- Upload date:
- Size: 579.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
838755449b5670854eb7f43614bec77dfb8a807971303d43cb9996ca593cad8d
|
|
| MD5 |
f0a8f0586e509d92a2dc27674923a874
|
|
| BLAKE2b-256 |
8453807715a742cbc37cbf6254f04854422a3ae0a2242d16133d69d85fdd3dd6
|
Provenance
The following attestation bundles were made for Pytolith-0.0.9.dev0-py3-none-any.whl:
Publisher:
build.yml on num0005/Pytolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytolith-0.0.9.dev0-py3-none-any.whl -
Subject digest:
838755449b5670854eb7f43614bec77dfb8a807971303d43cb9996ca593cad8d - Sigstore transparency entry: 156738278
- Sigstore integration time:
-
Permalink:
num0005/Pytolith@179bc752ce08ffc5f7555f014c4df56137c51382 -
Branch / Tag:
refs/tags/0.0.8 - Owner: https://github.com/num0005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@179bc752ce08ffc5f7555f014c4df56137c51382 -
Trigger Event:
push
-
Statement type: