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.
Metadata
Release files for pykotor 2.3.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pykotor-2.3.12.tar.gz | 2.3 MB | Without provenance | Details |
Release files / pykotor-2.3.12.tar.gz
| Download URL | pykotor-2.3.12.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d48ba6c612dc0704517c5a02559a928ffda154a453b7e9a8dab8dfa2c8062ae
|
|
BLAKE2b-256 checksum How to use checksums |
fbc3d1bf25775dbfea41e10f500b2462076d154bb9ec18aca7209f8dddccc728
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for pykotor 2.3.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.