This application helps you identify the folder in the Trainz Assets Database which holds a particular asset without using Content Manager.
- Translates numeric KUIDs to hexadecimal
- Translates hexadecimal KUIDs to decimal
- Calculates the hash for a specific KUID -> Used to identify the directory in which a particular Trainz asset is stored
See more about the KUID Format Specification here: KUID Format Specification
The app runs as a GUI when started without arguments, and as a command line tool when arguments are given. From the repository root, run it without installing the package by adding src to Python's module search path:
# Windows PowerShell
$env:PYTHONPATH = "src"
python -m kuid2hash.gui # starts the GUI
python -m kuid2hash.cli "kuid 68787 1097" # runs in CLI modeOn macOS or Linux, prefix the command with PYTHONPATH=src, for example PYTHONPATH=src python -m kuid2hash.cli.
The kuid2hash command is created by installing the package (for example, with python -m pip install -e ".[gui]"); it is not available from a fresh source checkout. The GUI requires the optional PyQt6 dependency, which is included in the gui extra above.
CLI examples:
$ kuid2hash "kuid 68787 1097"
kuid: <kuid:68787:1097>
hex: B3 0C 01 00 49 04 00 00
hash: hash-F3
$ kuid2hash "B3 0C 01 00 49 04 00 00"
kuid: <kuid:68787:1097>
hex: B3 0C 01 00 49 04 00 00
hash: hash-F3
A single kuid may be passed quoted ("kuid 68787 1097") or as separate tokens (kuid2 328583 1373 2). Hex kuids (4 bytes for uid -1, 8 bytes otherwise, separated by space/dash/colon/comma) are detected automatically.
Requires Python 3.10+.
python -m venv .venv
.venv\Scripts\pip install -e ".[gui,test]" # Windows (use bin/activate on unix)
pytest # run the tests
build.py builds distributable packages for the host OS:
| Platform | Artifact | Requirement |
|---|---|---|
| Windows | dist/Kuid2Hash.exe (GUI) and dist/Kuid2HashCli.exe (CLI), both one-file |
pip install ".[gui,build]" |
| macOS | dist/Kuid2Hash-<ver>-macos.dmg |
pip install ".[gui,build]" |
| Linux | dist/kuid2hash_<ver>_amd64.deb and .pkg.tar.zst |
gem install fpm |
python build.py # build everything this host supports
python build.py --only exe # build a single artifact
PyInstaller cannot cross-compile, so each artifact must be built on its target OS. The GitHub Actions workflow in .github/workflows/release.yml builds all packages (Windows exes zip + MSI installer, macOS dmg, Linux deb and zst) automatically on every v* tag and attaches them to the release.
On Windows the GUI and CLI ship as separate executables: a windowed exe cannot write to the console when invoked from a terminal with arguments, so Kuid2Hash.exe is the GUI and Kuid2HashCli.exe is the command line tool.
The MSI wraps the two exes from dist\ and installs for the current user only — no elevation needed, files land in %LOCALAPPDATA%\Programs\Kuid2Hash, and a Start Menu shortcut is created. Reinstalling the same version over an existing install is allowed. Build it after the exes:
python build.py --only exe # produces dist\Kuid2Hash.exe + Kuid2HashCli.exe
pwsh installer/build.ps1 # produces dist\Kuid2Hash-<ver>.msiThe build uses the WiX v5 command-line tool; install it once with:
dotnet tool install --global wix
wix extension add -g WixToolset.UI.wixextThe MSI version is read from pyproject.toml (or passed with -Version, e.g. pwsh installer/build.ps1 -Version v3.0). The CI workflow builds the MSI automatically on the Windows job and attaches it to the release.
- Windows 10 or newer, macOS 12+ (Apple Silicon/Intel), or any recent Linux with Python 3.10+
- The GUI packages bundle PyQt6 (Qt 6); the deb/zst packages use the system Python and pull in its PyQt6 binding (
python3-pyqt6on Debian/Ubuntu,python-pyqt6on Arch)
