Skip to main content

Python bindings for teehistorian with event processing

Project description

teehistorian-py

License: AGPL v3 PyPI version Python 3.8+ Documentation codecov

CI

High-performance Python bindings for parsing Teeworlds/DDNet teehistorian files. Built with Rust for speed and memory safety.

📚 Documentation | 🐛 Issue Tracker | 📦 PyPI

Features

  • 🚀 Fast: Rust-powered parsing with minimal Python overhead
  • 🔒 Memory Safe: No buffer overflows or memory leaks
  • 📦 Simple API: Clean Python interface for easy integration
  • 🧩 Extensible: Support for custom UUID handlers for mods
  • 🎯 Complete: Covers all standard teehistorian chunk types

Installation

pip install teehistorian-py

Quick Start

import teehistorian_py as th

# Parse a teehistorian file (modern Pythonic way)
with th.open("server.teehistorian") as parser:
    for chunk in parser:
        if isinstance(chunk, th.Join):
            print(f"Player {chunk.client_id} joined")
        elif isinstance(chunk, th.Drop):
            print(f"Player {chunk.client_id} left: {chunk.reason}")
        elif isinstance(chunk, th.PlayerName):
            print(f"Player {chunk.client_id} is now called '{chunk.name}'")

Or with Python 3.10+ match statement:

import teehistorian_py as th

with th.open("server.teehistorian") as parser:
    for chunk in parser:
        match chunk:
            case th.Join(client_id=cid):
                print(f"Player {cid} joined")
            case th.Drop(client_id=cid, reason=reason):
                print(f"Player {cid} left: {reason}")
            case th.PlayerName(client_id=cid, name=name):
                print(f"Player {cid} is now called '{name}'")

See the full documentation for more examples and advanced usage.

Development

Building from Source

# Clone the repository
git clone https://github.com/KoG-teeworlds/teehistorian-py.git
cd teehistorian-py

# Install development dependencies
pip install -e ".[dev]"

# Build extension module
maturin develop --release

# Run tests with coverage
pytest tests/ --cov=src/python/teehistorian_py --cov-report=html --cov-report=term-missing

# View coverage report
open htmlcov/index.html  # On macOS
# or visit htmlcov/index.html in your browser

Code Coverage & Security

We maintain 80%+ code coverage with branch coverage enabled and modern security practices:

  • Coverage: Branch coverage enabled with automatic PR reports via Codecov
  • Security: OIDC trusted publishing (no API keys required)
  • Modern CI/CD: GitHub Actions with hardened runners and security scanning
  • Automated: Rust security audits, Python vulnerability scans, and dependency checks

Requirements

  • Python 3.8+
  • Rust 1.70+ (for building from source)

License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

Credits

Related Projects

  • teehistorian - Original Rust implementation
  • Teeworlds - The game that generates these files
  • DDNet - Popular Teeworlds modification

Need help? Open an issue or check our documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teehistorian_py-2025.2.1.tar.gz (155.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

teehistorian_py-2025.2.1-cp314-cp314-win_amd64.whl (260.5 kB view details)

Uploaded CPython 3.14Windows x86-64

teehistorian_py-2025.2.1-cp314-cp314-macosx_11_0_arm64.whl (323.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

teehistorian_py-2025.2.1-cp313-cp313-win_amd64.whl (259.5 kB view details)

Uploaded CPython 3.13Windows x86-64

teehistorian_py-2025.2.1-cp313-cp313-macosx_11_0_arm64.whl (321.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

teehistorian_py-2025.2.1-cp312-cp312-win_amd64.whl (259.3 kB view details)

Uploaded CPython 3.12Windows x86-64

teehistorian_py-2025.2.1-cp312-cp312-manylinux_2_34_x86_64.whl (366.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

teehistorian_py-2025.2.1-cp312-cp312-macosx_11_0_arm64.whl (321.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

teehistorian_py-2025.2.1-cp311-cp311-win_amd64.whl (258.0 kB view details)

Uploaded CPython 3.11Windows x86-64

teehistorian_py-2025.2.1-cp311-cp311-manylinux_2_34_x86_64.whl (365.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

teehistorian_py-2025.2.1-cp311-cp311-macosx_11_0_arm64.whl (322.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

teehistorian_py-2025.2.1-cp310-cp310-win_amd64.whl (258.0 kB view details)

Uploaded CPython 3.10Windows x86-64

teehistorian_py-2025.2.1-cp39-cp39-win_amd64.whl (259.0 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

Details for the file teehistorian_py-2025.2.1.tar.gz.

File metadata

  • Download URL: teehistorian_py-2025.2.1.tar.gz
  • Upload date:
  • Size: 155.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for teehistorian_py-2025.2.1.tar.gz
Algorithm Hash digest
SHA256 c9bae1b0bcbe0ceca3da8d5315384556326df3f255a7997a567af5fc16e80cfd
MD5 4d0a99f195490e5c4614bcf6efc67ff5
BLAKE2b-256 a0ca4476baf305be2a997f93841e298a55bca0f8e5da7110aa96a5256bb21ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1.tar.gz:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 942d4e655ca78c2f6c21eee354034c24394ae6ab97cc655381358d1f886ae905
MD5 ba9ebdcf5214154c4c8c47e17951ec6d
BLAKE2b-256 d345539ad44d8efde52fa461b14b30f3f871a497afe9bf83e25e1fcbc9937440

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp314-cp314-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da34740ab84e51cf5b8e37a7a469226985a581f489fed8f57272408910351cf2
MD5 0ec7d789090de4402cd7d8cfe5371baa
BLAKE2b-256 a2b292eacba41b7df67ab57c36e7876443258c8ed5028c4eff71827e65d878d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 97fb72551bebe01876ced7592e7b128343f0805baecf1c0c7158a0e4dba4350d
MD5 c38c8e49bf65aabd12928c63f78fc52f
BLAKE2b-256 acfce8d7aebef46e1d06b112067606d34f986af0b71fb76d474123d514c8c2c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp313-cp313-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f733fd4e8b13e0640702801fbd2ceb3773f3934e782409802b35abaef5b00ccc
MD5 f2e9fc8cfd1692fb7e11cd9b5cf3ff50
BLAKE2b-256 48315c35a293b4c871510fd9aa15b88214be7f5629b04bad35ac5a81fbf7e970

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 63b1c2f709cf6a385d1c03d6b4cb4411a6b3925d8c8968c0bdf445162a8e27a0
MD5 2d41685d483d9eaecf431fe7339276e1
BLAKE2b-256 852a103f5410c1cae6b5ffa9b1c10f3bcd75c3702d216f18c2baaf6d4be05e18

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp312-cp312-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 12a9a7a71fd975ffd5a83e101fbd82d18fef88370e5784de9ccb154492a38479
MD5 594ce1d749439797eb921a865d6d6100
BLAKE2b-256 a8107a7a63edac0ebf44e070a9c086f6e06d107dfd17edbba98ae2883092d94b

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92d050c56ee0dcc9a366c3bb42994f580f0028a15dba320039152c27d8b4631c
MD5 bdac37a31cb2bb14263bad7083baa8aa
BLAKE2b-256 123452c2507707f646e65307b2059fdc6e3c9f98b05bfeebdb776cfa4854ff25

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9212d3ab4dd1928b3d73167e278d86531ef5616db764321a46201ba884a126c3
MD5 64811c2701310d503cfe54f2127e621b
BLAKE2b-256 3aacdaf764c62796365c04808eb2882b172b337d88624fd123cd83f6e62b5f61

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp311-cp311-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 abb5a470596880db210381c31d5869cfaaea70f56e5241dd208f0fc9a0b3b7e9
MD5 b4aaeecd7d48aff911b951205380a3af
BLAKE2b-256 0ce5ae758d4166afc2c6f7278ac2ade2fa3e4967ab6b78e534293fa79351e6a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efeb360460bdf39b7b12e8ec50350182b426859e39a9bc68547057b0a16ec00b
MD5 7820ebcc13bfdd5660ff0bbe0f89afbd
BLAKE2b-256 572e40cc9f187e93caa011b7efbe38f60720bfce40ab31004a82f4a1991c62d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2ee2b36d58b7fec8905bf3562ec55722dc6d35feed3194b30f6ea1322a7d3182
MD5 155ed860e9c3d8b68622ec8b4ecf08e3
BLAKE2b-256 0fe2c9ad877928113924907c5fa5b31f9b425d9edfc7a04ff862be21c1bffcc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp310-cp310-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file teehistorian_py-2025.2.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for teehistorian_py-2025.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 788ba7f940eea5a41d5b2c48a51f40466ac3faf2dcda5f52dd7027e07ffe038b
MD5 071345b3ce7458f14398aa358b8a9e73
BLAKE2b-256 a6368577e8677dcffbe31945848ae9e5c6e016a96f2f084a31d7f25747d4f320

See more details on using hashes here.

Provenance

The following attestation bundles were made for teehistorian_py-2025.2.1-cp39-cp39-win_amd64.whl:

Publisher: build.yml on KoG-teeworlds/teehistorian-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page