Skip to main content

Python bindings for Rusty Runways

Project description

Rusty Runways — Python Bindings

Docs PyPI

Rusty Runways

Deterministic airline logistics simulation written in Rust with a rich Python API for scripting, analysis, and RL/ML. Includes fast vectorized environments and optional Gymnasium wrappers.

— Full docs: https://dennislent.github.io/RustyRunways

Install

Python (PyPI):

pip install rusty-runways

# Optional Gym wrappers
pip install 'rusty-runways[gym]'

Local dev (build from source):

cd crates/py
maturin develop --release

Quick Start (Python)

Engine bindings (single and vector):

from rusty_runways_py import GameEnv, VectorGameEnv

g = GameEnv(seed=1, num_airports=5, cash=1_000_000)
g.step(1)
print(g.time(), g.cash())

venv = VectorGameEnv(4, seed=1)
venv.step_all(1, parallel=True)
print(venv.times())

Notes:

  • Seeds control determinism.
  • VectorGameEnv.step_all(..., parallel=True) releases the GIL and uses Rayon under the hood.

Gymnasium Wrappers (optional)

Wrappers live in the pure‑Python package rusty_runways and require gymnasium:

from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv
from rusty_runways import RustyRunwaysGymEnv, make_sb3_envs

# Single‑env Gym
env = RustyRunwaysGymEnv(seed=1, num_airports=5)

# SB3 convenience (DummyVecEnv)
vec_env = DummyVecEnv(make_sb3_envs(4, seed=1, num_airports=5))
model = PPO("MlpPolicy", vec_env, verbose=1)
model.learn(total_timesteps=10_000)

YAML Worlds and Custom Airplanes

All constructors accept a config_path pointing to a YAML world. The YAML can optionally define an airplanes catalog to replace or extend the built‑in models. Example:

seed: 42
starting_cash: 650000.0
airports: [ ... ]
airplanes:
  strategy: replace   # or: add (default)
  models:
    - name: WorkshopCombi
      mtow: 15000.0
      cruise_speed: 520.0
      fuel_capacity: 3200.0
      fuel_consumption: 260.0
      operating_cost: 950.0
      payload_capacity: 3200.0
      passenger_capacity: 24
      purchase_price: 780000.0
      min_runway_length: 1200.0
      role: Mixed        # Cargo | Passenger | Mixed

From Python:

from rusty_runways_py import GameEnv

g = GameEnv(config_path="examples/sample_world.yaml")
# List the models the current game exposes (custom + built‑ins depending on strategy)
print(g.models_py())       # Python list of dicts
print(g.models_json())     # JSON string

Validation ensures all fields are present and role constraints hold (Cargo requires payload_capacity > 0; Passenger requires passenger_capacity > 0; Mixed requires both).

Links

License: MIT

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

rusty_runways-3.0.2.tar.gz (128.0 kB view details)

Uploaded Source

Built Distributions

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

rusty_runways-3.0.2-cp38-abi3-win_amd64.whl (641.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

rusty_runways-3.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (740.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

rusty_runways-3.0.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file rusty_runways-3.0.2.tar.gz.

File metadata

  • Download URL: rusty_runways-3.0.2.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.3

File hashes

Hashes for rusty_runways-3.0.2.tar.gz
Algorithm Hash digest
SHA256 b343216ed5203191cd446dc8170e27bf05f1d7390784ce5bd8453c3976ff329e
MD5 f214f0f8d0a8a85bcc51d9685463fb56
BLAKE2b-256 3210365f4c8e8ffda1a184d48422c3e9391c73ea0d81411ac2bd631b259dc663

See more details on using hashes here.

File details

Details for the file rusty_runways-3.0.2-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rusty_runways-3.0.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5012a8541c37796450390add904ecb498c4e026908ae612d2c4537e6319a812b
MD5 9791c91723618a9d38728e738c5889d5
BLAKE2b-256 5637723d84970ed66faf88dd7bb2d77e88f6d91eb498c6fa1b1672b6f56447a5

See more details on using hashes here.

File details

Details for the file rusty_runways-3.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_runways-3.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ae9b5a39afcdecb71757f957d99c15a0bd8ee96cdacd727689b23a7d5aff17c
MD5 ba229c44a6673623071de4ca45678c3e
BLAKE2b-256 9b9beed60e1ea53fbb63fc28f07908b5a2882ae2ec0f2c27fb936b4817894df0

See more details on using hashes here.

File details

Details for the file rusty_runways-3.0.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for rusty_runways-3.0.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3787f17d4adc7330af0ef80ec1d319d86225e873c499aac156dd2f26b9bdab9b
MD5 92d524bd3970171e5841ef454221bf59
BLAKE2b-256 601649af426ab93b642c0c46384d6d2245dab926c8b9957ac335cea2ee34cd94

See more details on using hashes here.

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