Skip to main content

Continuous GTFS

Define, test, and run GTFS data pipelines as Python steps.

continuous-gtfs is a framework for transforming GTFS schedule feeds and GTFS-Realtime protobuf feeds with small, declarative, dependency-ordered steps — plus a CLI to run pipelines locally, diff feeds, and inspect the step DAG.

# pipelines/my_agency/transforms.py
from continuous_gtfs.builtins.schedule import (
    InitScheduleOutput,
    MatchCondition,
    RemoveRows,
)

init = InitScheduleOutput()

remove_inactive_calendars = RemoveRows(
    "calendar.txt",
    [
        MatchCondition("monday", value="0"),
        MatchCondition("tuesday", value="0"),
        MatchCondition("wednesday", value="0"),
        MatchCondition("thursday", value="0"),
        MatchCondition("friday", value="0"),
        MatchCondition("saturday", value="0"),
        MatchCondition("sunday", value="0"),
    ],
    description="Remove calendar records with no active service days",
)
continuous-gtfs schedule pipelines/my_agency --input schedule=./gtfs.zip -o ./out

Steps declare what they touch and what they run after; the framework scans the pipeline folder, resolves the DAG, and executes it. Custom logic is a decorated function away:

from continuous_gtfs import step

@step(files=["stops.txt"])
def drop_test_stops(ctx):
    stops = ctx.output["stops.txt"]
    ctx.output["stops.txt"] = stops.filter(~stops["stop_id"].str.starts_with("TEST_"))

Install

pip install continuous-gtfs

The first PyPI release (v0.1.0) is landing shortly. Until it does, install straight from this repository:

pip install git+https://github.com/continuousgtfs/continuous-gtfs

Or work from a clone (uses uv):

git clone https://github.com/continuousgtfs/continuous-gtfs
cd continuous-gtfs
uv sync
uv run continuous-gtfs --help

Requires Python 3.12+.

What's in the box

  • Step framework — @step functions and Step classes with files=, after=, before= ordering; scan_pipeline() / resolve_dag() discover and order a pipeline folder's steps.
  • Checks — @check functions and Check classes run after every transform, in parallel, against read-only views of the output; they report findings and never change the feed or fail the run.
  • Evaluation clock — every step reads ctx.now, one moment per run, so a run replays deterministically (--now pins it from the CLI).
  • Directory inputs — a file_tree input kind hands a step a whole directory as a FileTree, packed with a byte-deterministic zip encoding.
  • Schedule builtins — RemoveRows, UpdateFields, ClearField, SortRows, TransformTripId, UpdateFeedInfo, semantic removals (RemoveRoutes / RemoveTrips / RemoveStops / RemoveServices with reference-following), and more, all operating on Polars DataFrames.
  • Realtime builtins — FilterStopsByID, RenameVehicles, TransformTripId, CombineFeeds, ExpireCancelledTrips, InsertMissingCancellations, ConvertScheduledToNew, and more, operating on GTFS-RT FeedMessage protobufs.
  • Testing kit — continuous_gtfs.testing gives you gtfs_df, schedule_context, realtime_context, feed builders, and assert_unchanged for unit-testing a single step against a tiny in-memory fixture. No network, no real feed.
  • Schedule semantics — derivation of service-date / stop-pattern / time-profile tables and semantic trip pairing between two feed versions (semantics, pair-trips commands).
  • CLI — see below.

CLI

The package installs a continuous-gtfs command:

Command What it does
continuous-gtfs schedule <pipeline-dir> Run a schedule pipeline on a GTFS zip, write the transformed zip
continuous-gtfs realtime <pipeline-dir> Run a realtime pipeline on GTFS-RT protobuf file(s)
continuous-gtfs dag <pipeline-dir> Show a pipeline's resolved step DAG
continuous-gtfs diff <a.zip> <b.zip> Diff two GTFS zips table-by-table
continuous-gtfs rt-compare <a.pb> <b.pb> Semantically compare two GTFS-RT protobuf feeds
continuous-gtfs semantics <feed.zip> Derive schedule-semantics tables for a feed
continuous-gtfs pair-trips <target> <candidate> Pair two feeds' trips into a trip_pairs table

Each command supports --help for its full options.

Defining a pipeline

A pipeline is a directory:

pipelines/
└── my_agency/
    ├── __init__.py      # FEED_TYPE = "schedule", INPUTS = {"schedule": "gtfs_schedule_zip"}
    └── transforms.py    # step definitions (any module name works; all are scanned)

FEED_TYPE is "schedule" or "realtime". INPUTS declares the named input slots the pipeline consumes and their content kinds. Every module in the folder is scanned for steps; sibling modules next to the pipeline folder are importable for sharing code between pipelines (see examples/cross-pipeline-trip-id).

Start from examples/minimal-schedule for the smallest working pipeline.

Testing your pipeline

from continuous_gtfs.testing import gtfs_df, schedule_context

from pipelines.my_agency.transforms import remove_inactive_calendars

def test_remove_inactive_calendars():
    ctx = schedule_context(**{
        "calendar.txt": gtfs_df("""
            service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday
            DEAD,0,0,0,0,0,0,0
            LIVE,1,1,1,1,1,0,0
        """)
    })
    remove_inactive_calendars.apply(ctx)
    assert ctx.output["calendar.txt"]["service_id"].to_list() == ["LIVE"]

Relationship to the Continuous GTFS platform

This framework is the open-source core of Continuous GTFS, a hosted platform that runs these same pipelines continuously against live agency feeds — with orchestration, versioned feed history, review workflows, validation, and CDN publishing on top. Pipelines you define and test with this package run unchanged on the platform, and the framework as published here powers a production deployment serving a major US transit agency today.

Contributing

See CONTRIBUTING.md. Run the test suite with uv run pytest.

License

Apache License 2.0 — see LICENSE and NOTICE. Copyright 2026 Jarvus Innovations.

Metadata

Release files for continuous-gtfs 0.3.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 continuous-gtfs 0.3.0
File Size Uploaded Provenance Actions
continuous_gtfs-0.3.0.tar.gz 110.6 kB With provenance Details for continuous_gtfs-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for continuous-gtfs 0.3.0
File Interpreter ABI Platform Actions
continuous_gtfs-0.3.0-py3-none-any.whl Python 3 none any Details for continuous_gtfs-0.3.0-py3-none-any.whl

Total release size: 239.2 kB

Release files / continuous_gtfs-0.3.0.tar.gz

Download URL continuous_gtfs-0.3.0.tar.gz
Size 110.6 kB
Tags Source
SHA-256 checksum
How to use checksums
72de16a3b3a5fcbb0cf60c81a0a4be084c5f1337914f0119c4fd4532db85ed76
BLAKE2b-256 checksum
How to use checksums
72224ebb109732ea057fed6c0ff744ef723eb06958d2cf89017c280d0dead925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / continuous_gtfs-0.3.0-py3-none-any.whl

Download URL continuous_gtfs-0.3.0-py3-none-any.whl
Size 128.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54fbf030d2c8bfd52e10305ed23740a96d9b56dfe6c0899774cac6bd7568a3bf
BLAKE2b-256 checksum
How to use checksums
224d0c9a8444b42813e8ebba9fbdd799bd1459fc8eac830cc6e46b57f37e332f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for continuous-gtfs 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for continuous_gtfs-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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.

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