Skip to main content

GTFS Kit

Tests: pipeline status

GTFS Kit is a Python 3.10+ library for analyzing General Transit Feed Specification (GTFS) data in memory without a database. It uses Pandas and GeoPandas to do the heavy lifting. (Seems to work fine with Pandas 2 and Pandas 3.)

It can also combine multiple feeds into one via combine_feeds, which unions any number of feeds and deduplicates entities that recur across them, such as shared stops, jointly operated routes, and common shapes.

The functions/methods of GTFS Kit assume a valid GTFS feed but offer no inbuilt validation, because GTFS validation is complex and already solved by dedicated libraries. So unless you know what you’re doing, use the Canonical GTFS Validator before you analyze a feed with GTFS Kit.

Installation

Install it from PyPI with UV, say, via uv add gtfs_kit.

Examples

In the Marimo notebook notebooks/examples.py.

Authors

  • Alex Raichev (2019-09), maintainer

Documentation

The documentation is built via Sphinx from the source code in the docs directory then published to Codeberg Pages at araichev.codeberg.page/gtfs_kit_docs.

Conventions

  • Throughout GTFS Kit, date means GTFS service date and is encoded as a YYYYMMDD string. In conformance with GTFS, times are HH:MM:SS service-day offsets that can exceed 24 hours. Time-series functions preserve those offsets instead of wrapping them modulo 24 hours. Their date column identifies the service date, while datetime can fall on a later calendar date. For example, 25:30:00 on date 20250101 becomes datetime 2025-01-02 01:30:00 and retains date 20250101. Route, stop, and network stats and timetables use the same date convention. See also gtfs_kit.trips.is_active_trip, which is used in gtfs_kit.routes.compute_route_stats, gtfs_kit.stops.compute_stop_stats, and gtfs_kit.miscellany.compute_network_stats.

  • ‘DataFrame’ and ‘Series’ refer to Pandas DataFrame and Series objects, respectively.

  • Aggregate service metrics distinguish no service from unknown distance. A group or time bin with no active service has zero distance, duration, and speed. If any contributing trip has unknown distance, aggregate service_distance and service_speed are NA while counts and service_duration remain available. This rule applies to route and network stats and time series, so results remain consistent across aggregation levels and time frequencies.

Notes

  • This project’s development status is Alpha. I use GTFS Kit at my job and change it breakingly to suit my needs.

  • This project uses semantic versioning.

  • I aim for GTFS Kit to handle the current GTFS. In particular, i avoid handling GTFS extensions. That is the most reasonable scope boundary i can draw at present, given this project’s tiny budget. If you would like to fund this project to expand its scope, please email me.

  • Thanks to MRCagney for periodically donating to this project.

  • Constructive feedback and contributions are welcome. Please issue pull requests from a feature branch into the develop branch and include tests.

  • GTFS time is measured relative to noon minus 12 hours, which can mess things up when crossing into daylight savings time. I don’t think this issue causes any bugs in GTFS Kit, but you and i have been warned. Thanks to user Github user derhuerst for bringing this to my attention in closed Issue 8.

  • With release 10.0.0, i removed the validation module validators.py to avoid duplicating the work of what is now the canonical feed validator (written in Java).

  • I might require Pandas 3 in the future to take advantage of its new features.

Maintainer Notes

  • After pushing to master, update the published docs via uv run make -C docs publish-docs

Metadata

Release files for gtfs-kit 14.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gtfs-kit 14.0.0
File Size Uploaded Provenance Actions
gtfs_kit-14.0.0.tar.gz 1.2 MB Without provenance Details for gtfs_kit-14.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gtfs-kit 14.0.0
File Interpreter ABI Platform Actions
gtfs_kit-14.0.0-py3-none-any.whl Python 3 none any Details for gtfs_kit-14.0.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / gtfs_kit-14.0.0.tar.gz

Download URL gtfs_kit-14.0.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
b1c43cca7243f64a93c99b7842e4a9b522b887d37d3e16d3e6008a33bda62667
BLAKE2b-256 checksum
How to use checksums
565085cc9c34e6b8224b352fb3ad88797e00530405cdf61ab58c3e1b9ed7e667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gtfs_kit-14.0.0-py3-none-any.whl

Download URL gtfs_kit-14.0.0-py3-none-any.whl
Size 84.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0f35b644d5014b6c7e0cf5862fd3467b813ba4697665958467fc604cf780a41
BLAKE2b-256 checksum
How to use checksums
1f711e8f3d6e82a04a57430f6d71ac3d20734bf6ea929b68f9ad499ab5bb5660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for gtfs-kit 14.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

14.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page