Reference
Python library
Use beamng.assetto's steps from your own Python code.
beamng.assetto is also a typed Python package, beamng_assetto, with one module per step: kspkg, evo and beamng. The command line is a thin layer over them.
Read a package
The kspkg module reads Kunos packages on its own, with no knowledge of circuits or BeamNG:
read_package.py
from beamng_assetto.kspkg import Package, Selection, extract
with Package.open("content.kspkg") as package:
# Read one file
entry = package.find("content/tracks/laguna_seca/laguna_seca.scene")
assert entry is not None
scene = package.read(entry)
# Extract a selection of paths, as `kspkg extract -i` does
report = extract(package, "game", Selection.from_patterns(["^content/tracks/spa/"]))
assert report.ok, report.failures
The modules' docstrings describe every function. The library follows the tool's version: an update may change it.