Metadata-Version: 2.4
Name: macro-traffic-sim
Version: 0.1.2
Summary: Python gRPC client for macroscopic traffic simulation via 4-step demand model
Author-email: Dmitrii Lopanov <sexykdi@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/LdDl/macro_traffic_sim_grpc
Project-URL: Documentation, https://github.com/LdDl/macro_traffic_sim_grpc/tree/main/clients/python
Project-URL: Repository, https://github.com/LdDl/macro_traffic_sim_grpc
Project-URL: Issues, https://github.com/LdDl/macro_traffic_sim_grpc/issues
Keywords: traffic,simulation,grpc,transportation,demand
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: grpcio>=1.60.0
Requires-Dist: protobuf>=4.25.0
Provides-Extra: dev
Requires-Dist: grpcio-tools>=1.60.0; extra == "dev"

# Python client for macro_traffic_sim gRPC Server

[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
[![Typing: Typed](https://img.shields.io/badge/typing-typed-green.svg)](https://peps.python.org/pep-0561/)

Python client library for the macroscopic traffic simulation gRPC server with full type hints support.

## Installation

```bash
pip install macro-traffic-sim
```

## Usage

```python
import 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...
```

## Documentation

- **Full example**: See [examples/](https://github.com/LdDl/macro_traffic_sim_grpc/tree/master/clients/python/examples) for a complete simulation workflow

## Running the example

1. Start the gRPC server:
```bash
cargo run --features server --bin macro_traffic_sim
```

2. Run the example (from repository root):
```bash
source clients/python/.venv/bin/activate
python clients/python/examples/main.py
```
