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.2.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.2.0
File Size Uploaded Provenance Actions
continuous_gtfs-0.2.0.tar.gz 110.4 kB With provenance Details for continuous_gtfs-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 238.8 kB

Release files / continuous_gtfs-0.2.0.tar.gz

Download URL continuous_gtfs-0.2.0.tar.gz
Size 110.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b687a11038c4c4f8b562e98bef851d52219a7b375b59a79f9c141631a110e23d
BLAKE2b-256 checksum
How to use checksums
9c9d820ddd83f0bde6ab9a5160f76d7c2744873d8ccdf8a059e9d8bebcde6cd4
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 Oct 30, 2026.

Transparency log

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

Download URL continuous_gtfs-0.2.0-py3-none-any.whl
Size 128.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
762f620ca705831d6ded6f96e81c444d23d0a7f420d5121530f683c379d7af1a
BLAKE2b-256 checksum
How to use checksums
4303e73460fb91fec76dab72b994a35ab844b458282be89cfafc1b328129b7b3
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 Oct 30, 2026.

Transparency log

Security for continuous-gtfs 0.2.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.2.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 Oct 30, 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