Skip to content

Transit Parser

High-performance Python+Rust library for parsing GTFS and TXC transit data.

Python 3.9+ License

Features

  • 🚀 Blazing Fast - Rust-powered parsing with Python convenience
  • 📦 Multiple Formats - GTFS, TransXChange (TXC), CSV, JSON
  • 🔄 TXC → GTFS Conversion - Convert UK bus data to standard GTFS
  • 🔍 Filtering API - Query by route, stop, date, and more
  • 📊 Lazy Loading - Defer parsing until you need the data
  • 🐼 DataFrame Support - Optional pandas integration
  • Schedule Validation - Validate operational schedules against GTFS
  • 🚌 Deadhead Inference - Infer pull-out, pull-in, and interlining movements

Quick Example

from transit_parser import GtfsFeed, TxcDocument, TxcToGtfsConverter
from transit_parser.filtering import GtfsFilter

# Load a GTFS feed
feed = GtfsFeed.from_path("path/to/gtfs/")
print(f"Routes: {feed.route_count}, Trips: {feed.trip_count}")

# Filter by route
f = GtfsFilter(feed)
route_1_trips = f.trips_for_route("route_1")
stops = f.stops_for_route("route_1")

# Find active services on a date
active = f.active_services_on("2025-07-04")

# Convert TXC to GTFS
txc = TxcDocument.from_path("service.xml")
converter = TxcToGtfsConverter()
result = converter.convert(txc)
result.feed.to_zip("output.zip")

Performance

Transit Parser is designed for speed. See the Performance page for benchmarks.

Operation Transit Parser partridge gtfs-kit
Load feed 0.01ms (lazy) 120ms 850ms
stop_times 136ms 410ms N/A

Installation

pip install transit-parser

Or with uv:

uv add transit-parser

Next Steps