Metadata-Version: 2.4
Name: tpk_ar
Version: 0.2.3
Summary: A package for parsing type tree packages (TPK)
Author-email: Rudolf Kolbe <rkolbe96@tuta.io>
License: MIT License
        
        Copyright (c) 2026-2026 K0lb3
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/K0lb3/tpk_ar
Project-URL: Bug Tracker, https://github.com/K0lb3/tpk_ar/issues
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing_extensions; python_version < "3.11"
Provides-Extra: brotli
Requires-Dist: brotli; extra == "brotli"
Provides-Extra: lz4
Requires-Dist: lz4; extra == "lz4"
Provides-Extra: full
Requires-Dist: brotli; extra == "full"
Requires-Dist: lz4; extra == "full"
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Requires-Dist: tpk_ar[full]; extra == "tests"
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pyperf; extra == "dev"
Requires-Dist: snakeviz; extra == "dev"
Requires-Dist: tpk_ar[tests]; extra == "dev"
Dynamic: license-file

# tpk_ar

A Python port of [AssetRipper/Tpk](https://github.com/AssetRipper/Tpk), primarily for use in UnityPy.

This is maintained as a separate project to ensure forward compatibility for older UnityPy versions against potential breaking changes in the original code.

Rather than acting as an exact mirror of the upstream project, this port focuses solely on providing a Tpk format parser with a stable, backward-compatible API.

## Options

The `brotli` and `lz4` dependencies are optional. To handle compressed Tpk files, install the package with the required extras:

```bash
pip install "tpk_ar[brotli]"
pip install "tpk_ar[lz4]"
pip install "tpk_ar[full]"  # Installs both
```

## Development

### TODO

- [x] Parser
- [ ] Dumper (for saving extracted type tree information of games)
- [ ] Native Extension (C++, for performance)

### Benchmarking

To measure the cost of loading a TPK file and inspect the same code path in snakeviz, install the dev extras:

```bash
uv sync --extra dev
```

Run the timing benchmark against the bundled uncompressed sample:

```bash
uv run python benchmarks/bench_load.py
```

Generate a profile for the same load path, then open it in snakeviz:

```bash
uv run python benchmarks/profile_load.py
uv run snakeviz profiles/uncompressed.prof
```
