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)
This project follows unified K1/TSL reverse engineering practices. All resource logic is verified across both game engines using REVA MCP tools. See the Wiki for details on our protocol.
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 pykotor-2.2.1.tar.gz.
File metadata
- Download URL: pykotor-2.2.1.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e37704e2693f25e2081640975280c09757856e4fcfb02c0ae8cb14aef1891288
|
|
| MD5 |
160c5b0fde89aada6150c4fb8ed4a4b6
|
|
| BLAKE2b-256 |
0055049fc1802e68e9117f781943fe2456e38f098b9af6c7f48fe9c95137540e
|
File details
Details for the file pykotor-2.2.1-py3-none-any.whl.
File metadata
- Download URL: pykotor-2.2.1-py3-none-any.whl
- Upload date:
- Size: 2.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
464098dfbbbff04a83ace0c3a4520ce40aa43ac38086c22178ac3189ba4886ed
|
|
| MD5 |
afc72337ee2d190b88b69f06bf727805
|
|
| BLAKE2b-256 |
10da1723e807a76dad0f6208e94df509a266cd108c53246b191607e9f7833457
|