Read, modify and write files used by KotOR's game engine.
Project description
PyKotor
PyKotor is a modern Python library and toolset for reading, writing, and modding resources from the Star Wars: Knights of the Old Republic (KOTOR, K1) and The Sith Lords (KOTOR II, TSL) game engines.
Features
- Read and write almost all K1/TSL resource and file formats (BIF, ERF, GFF, KEY, TLK, DLG, UTC, UTP, UTI, UTS, etc.)
- Support for both K1 (swkotor.exe) and TSL (swkotor2.exe) with unified APIs
- High-fidelity, reverse-engineered format logic and type safety
- Command-line toolkit (
pykotorcli) for file conversion, inspection, and batch operations - Programmatic API for advanced automation and mod tooling
- Modern, type-checked, actively maintained, and well-tested codebase
Documentation & Community
- 📚 Docs / Usage: Wiki & Getting Started
- 🐛 Bugs: GitHub Issues
- 💬 Community Discord: Invite Link
- 🌟 Changelog: Releases
Quick Install
pip install pykotor
Or with extras for format encodings and update tool:
pip install "pykotor[encodings,updater]"
CLI Example
# Convert a BIF file to readable resources
pykotorcli extract-bif --input KOTOR1/BIFs/data.bif --output ./output_dir
# Inspect a GFF (generic file format)
pykotorcli gff-dump --file some_file.uti
# See all CLI features
pykotorcli --help
Python Usage Example
from pykotor.tsl.gff import GFF
# Parse a .utc (creature) file
gff = GFF.parse("dan13_01.utc")
print(gff.root["FirstName"].string) # Accessing the field value
# Modify and save
gff.root["FirstName"].string = "HK-47"
gff.write("hk_utc.gff")
Supported Formats
Major types:
- Containers: BIF, ERF, KEY, MOD, RIM
- Resources: GFF/UT*, GIT, DLG, ARE, UTP, UTI, UTC, UTS, UTM, UTR, UTT, JRL, TLK, etc.
- 2DA, SSF, NCS/NSS, NDB, models, textures, etc. See Wiki Format Coverage.
Development & Contributing
- Clone the repo and install Poetry or use
uv. poetry installoruv pip install -e .[dev]- Run
pytestandruff check .andmypy --strictbefore submitting PRs.
For feature requests, new formats, or reverse-engineering findings, see CONTRIBUTING.md.
License
LGPL-3.0-or-later (see LICENSE)
Format behavior is cross-checked against retail KotOR I and TSL builds; tooling can use REVA MCP helpers where that helps. Maintainer-facing workflow notes live in the project wiki.
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
File details
Details for the file pykotor-2.3.12.tar.gz.
File metadata
- Download URL: pykotor-2.3.12.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d48ba6c612dc0704517c5a02559a928ffda154a453b7e9a8dab8dfa2c8062ae
|
|
| MD5 |
9884578e86e839d46affcf7d1903dec0
|
|
| BLAKE2b-256 |
fbc3d1bf25775dbfea41e10f500b2462076d154bb9ec18aca7209f8dddccc728
|