Skip to main content

lfs_insim

A Python library for the Live for Speed InSim protocol: InSim (TCP), OutSim and OutGauge (UDP). Plain import, no framework, no dependencies.

Status: alpha. The library is checked against a real LFS (0.8C), but its API may still change before 1.0.

  • Python 3.11 or newer, no dependencies, fully typed.
  • Every packet class is generated from the official specification published at lfs.net, so the fields are named exactly as in InSim.txt.
  • Handlers with decorators, await insim.request(...), chat commands, a roster of connections and players, and automatic reconnection if LFS restarts.

Install

pip install lfs-insim

A first program

In LFS, type /insim=29999 to let it listen for InSim. Then run this and type !hello in the game:

from lfs_insim import Command, InSim, received

insim = InSim(name="hello", prefix="!")  # admin_password="..." if LFS has one


@insim.on.IS_VER
def connected(packet: received.IS_VER) -> None:
    print(f"Connected to LFS {packet.Version}, InSim {packet.InSimVer}")


@insim.on_command("hello")
def hello(command: Command) -> None:
    command.reply("Hello from Python")


if __name__ == "__main__":
    insim.run()  # blocks until Ctrl+C; reconnects on its own if LFS restarts

What is in the box

You want to… Use
Receive a packet @insim.on.IS_XXX
Answer a chat command @insim.on_command("name")
Send a packet, chat or /commands insim.send.IS_XXX(...), insim.say(...), insim.command(...)
Ask LFS and wait for the answer await insim.request(IS_STA), request_all(...)
Run something on a rhythm @insim.every(seconds)
Know who is connected and who is driving lfs_insim.state.Roster
Read car physics or the dashboard OutSim and OutGauge
Show LFS text without colour codes lfs_insim.text.plain(...)

The guide is in docs/. Short, runnable programs are in examples/: hello.py, who.py, buttons.py and gauge.py.

Development

This repository is worked on with the notes in docs/dev (in Spanish). To check everything: python scripts/verify.py.

License

MIT — see LICENSE.

Metadata

Release files for lfs-insim 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lfs-insim 0.5.0
File Size Uploaded
lfs_insim-0.5.0.tar.gz 150.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lfs-insim 0.5.0
File Interpreter ABI Platform
lfs_insim-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 223.3 kB

Release files / lfs_insim-0.5.0.tar.gz

Download URL lfs_insim-0.5.0.tar.gz
Size 150.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0f0503f6cda3e1849c6c762a1341e09592dfec558ae390646109ca3efb72de6c
BLAKE2b-256 checksum
How to use checksums
4b1c6628fc8d3b1de978ab3b0053fae0d2d90d312fdae96d928bd11ef6110820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / lfs_insim-0.5.0-py3-none-any.whl

Download URL lfs_insim-0.5.0-py3-none-any.whl
Size 72.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6506f53da2a43b31a1aae51581bbadb1b81d805e02c35a57c9707cb3c392a1d6
BLAKE2b-256 checksum
How to use checksums
3a0bd155a295d14dcc6560c913735f5c8cb5f27321451d244907f774eee51d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.0

2 release files

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page