Python client library for the macroscopic traffic simulation gRPC server with full type hints support.
pip install macro-traffic-simimport grpc
from macro_traffic_sim import (
MacroServiceStub,
NewSessionRequest,
Node,
Link,
Zone,
NetworkChunk,
ZoneChunk,
ModelConfigRequest,
BprConfig,
RunPipelineRequest,
LinkVolumesRequest,
UUIDv4,
)
# Connect to server
channel = grpc.insecure_channel("127.0.0.1:50052")
client = MacroServiceStub(channel)
# Create a new session
response = client.NewSession(NewSessionRequest())
session_id = response.session_id.value
print(f"Session: {session_id}")
# Push network, zones, configure, run pipeline, get results...- Full example: See examples/ for a complete simulation workflow
- Start the gRPC server:
cargo run --features server --bin macro_traffic_sim- Run the example (from repository root):
source clients/python/.venv/bin/activate
python clients/python/examples/main.py