A Python library for reading and modifying file formats used by the game Knights of the Old Republic and its sequel.
On the Holowan public surface this library is Holowan Toolchain. Canonical repo: oldrepublicwizard/PyKotor. Portal: Holowan Underlabs.
- Complete file format support for KotOR and TSL game files
- Cross-platform (Windows, macOS, Linux)
- Holocron Toolset for modding and development
- Modern Python (3.8+)
- Type-annotated API with extensive documentation
- Python 3.8+
- Windows 7–11, macOS, or Linux
- All common architectures supported (x86, x64, arm64)
The fastest way to get started is using uvx (no installation required). Install uv from Installing uv, then run tools with --refresh to ensure you're using the latest version:
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
uvx --refresh holocrontoolsetmacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
uvx --refresh holocrontoolsetInstall the library:
pip install pykotorInstall tools:
pip install holocrontoolset holopatcher kotordiffOr use pipx for isolated tool installation:
pipx install holocrontoolset
pipx install holopatcher
pipx install kotordiffNote: The PyKotor CLI is included with the pykotor package and accessible via pykotor or pykotorcli commands.
See CONTRIBUTING.md for development installation. If cloning the repo is slow or stalls, use a shallow clone: git clone --depth 1 <repo-url> (see CONTRIBUTING for details).
from pykotor.resource.type import ResourceType
from pykotor.extract.installation import Installation
from pykotor.resource.formats.tpc import write_tpc
# Load game installation
inst = Installation("C:/Program Files (x86)/Steam/steamapps/common/swkotor")
# Extract a texture
texture = inst.texture("C_Gammorean01")
write_tpc(texture, "./C_Gammorean01.tga", ResourceType.TGA)HolocronToolset - GUI editor for KotOR files:
uvx --refresh holocrontoolsetHoloPatcher - Cross-platform TSLPatcher alternative:
uvx --refresh holopatcher --helpPyKotor CLI - Command-line build tool (included with pykotor):
uvx --refresh pykotor --help
# Example: convert 2DA to CSV
uvx --refresh pykotor 2da2csv "path/to/file.2da"KotorDiff - Compare and generate patches:
uvx --refresh kotordiff
# or if installed via pip/pipx
kotordiffSee individual tool documentation for detailed usage.
| Tool | Description | Documentation |
|---|---|---|
| HolocronToolset | Full-featured GUI editor for KotOR files | README |
| HoloPatcher | Fast, cross-platform mod installer | README |
| PyKotor CLI | Command-line build tool (part of pykotor package) | Docs |
| KotorDiff | File comparison and TSLPatcher data generator | README |
- Installation & Usage - Detailed library documentation
- Contributing Guide - Development setup and guidelines
- Project Wiki — community documentation (GitHub UI); clone with
git submodule update --init wikito editwiki/*.mdin-tree (see CONTRIBUTING.md) - PowerShell Setup - Windows PowerShell configuration
- Design System Rules - Comprehensive UI design system documentation
Contributions are welcome! Please see CONTRIBUTING.md for:
- Development environment setup
- Code style guidelines
- Testing procedures
- Pull request process
This project is licensed under the LGPL-3.0-or-later License.