continuous-gtfs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. continuous_gtfs-0.1.0/LICENSE +202 -0
  2. continuous_gtfs-0.1.0/NOTICE +5 -0
  3. continuous_gtfs-0.1.0/PKG-INFO +165 -0
  4. continuous_gtfs-0.1.0/README.md +141 -0
  5. continuous_gtfs-0.1.0/pyproject.toml +68 -0
  6. continuous_gtfs-0.1.0/pyproject.toml.orig +53 -0
  7. continuous_gtfs-0.1.0/src/continuous_gtfs/__init__.py +24 -0
  8. continuous_gtfs-0.1.0/src/continuous_gtfs/analysis_storage.py +76 -0
  9. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/__init__.py +0 -0
  10. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/realtime/__init__.py +25 -0
  11. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/realtime/transforms.py +637 -0
  12. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/schedule/__init__.py +35 -0
  13. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/schedule/removals.py +573 -0
  14. continuous_gtfs-0.1.0/src/continuous_gtfs/builtins/schedule/transforms.py +540 -0
  15. continuous_gtfs-0.1.0/src/continuous_gtfs/cli.py +1479 -0
  16. continuous_gtfs-0.1.0/src/continuous_gtfs/context.py +246 -0
  17. continuous_gtfs-0.1.0/src/continuous_gtfs/executor.py +195 -0
  18. continuous_gtfs-0.1.0/src/continuous_gtfs/parsers.py +96 -0
  19. continuous_gtfs-0.1.0/src/continuous_gtfs/pipelines/__init__.py +12 -0
  20. continuous_gtfs-0.1.0/src/continuous_gtfs/pipelines/realtime.py +106 -0
  21. continuous_gtfs-0.1.0/src/continuous_gtfs/pipelines/schedule.py +232 -0
  22. continuous_gtfs-0.1.0/src/continuous_gtfs/prep.py +244 -0
  23. continuous_gtfs-0.1.0/src/continuous_gtfs/py.typed +0 -0
  24. continuous_gtfs-0.1.0/src/continuous_gtfs/results.py +44 -0
  25. continuous_gtfs-0.1.0/src/continuous_gtfs/rt_compare/__init__.py +7 -0
  26. continuous_gtfs-0.1.0/src/continuous_gtfs/rt_compare/compare.py +656 -0
  27. continuous_gtfs-0.1.0/src/continuous_gtfs/rt_compare/config.py +26 -0
  28. continuous_gtfs-0.1.0/src/continuous_gtfs/rt_compare/match.py +144 -0
  29. continuous_gtfs-0.1.0/src/continuous_gtfs/rt_compare/report.py +147 -0
  30. continuous_gtfs-0.1.0/src/continuous_gtfs/scanner.py +564 -0
  31. continuous_gtfs-0.1.0/src/continuous_gtfs/schedule_helpers.py +256 -0
  32. continuous_gtfs-0.1.0/src/continuous_gtfs/schedule_pairing.py +465 -0
  33. continuous_gtfs-0.1.0/src/continuous_gtfs/schedule_records.py +477 -0
  34. continuous_gtfs-0.1.0/src/continuous_gtfs/schedule_semantics.py +550 -0
  35. continuous_gtfs-0.1.0/src/continuous_gtfs/step.py +333 -0
  36. continuous_gtfs-0.1.0/src/continuous_gtfs/testing.py +304 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Continuous GTFS
2
+ Copyright 2026 Jarvus Innovations
3
+
4
+ This product includes software developed at
5
+ Jarvus Innovations (https://jarv.us/).
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: continuous-gtfs
3
+ Version: 0.1.0
4
+ Summary: Define, test, and run GTFS data pipelines as Python steps
5
+ Keywords: gtfs,gtfs-realtime,transit,pipeline,data-engineering
6
+ Author: Jarvus Innovations
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering :: GIS
14
+ Requires-Dist: polars>=1.0
15
+ Requires-Dist: protobuf>=7.35.1
16
+ Requires-Dist: gtfs-realtime-bindings>=1.0
17
+ Requires-Dist: gtfs-digester>=0.4.0
18
+ Requires-Dist: blake3>=1.0.8
19
+ Requires-Python: >=3.12
20
+ Project-URL: Homepage, https://continuousgtfs.com
21
+ Project-URL: Repository, https://github.com/continuousgtfs/continuous-gtfs
22
+ Project-URL: Issues, https://github.com/continuousgtfs/continuous-gtfs/issues
23
+ Description-Content-Type: text/markdown
24
+
25
+ # Continuous GTFS
26
+
27
+ Define, test, and run GTFS data pipelines as Python steps.
28
+
29
+ `continuous-gtfs` is a framework for transforming [GTFS](https://gtfs.org) 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.
30
+
31
+ ```python
32
+ # pipelines/my_agency/transforms.py
33
+ from continuous_gtfs.builtins.schedule import (
34
+ InitScheduleOutput,
35
+ MatchCondition,
36
+ RemoveRows,
37
+ )
38
+
39
+ init = InitScheduleOutput()
40
+
41
+ remove_inactive_calendars = RemoveRows(
42
+ "calendar.txt",
43
+ [
44
+ MatchCondition("monday", value="0"),
45
+ MatchCondition("tuesday", value="0"),
46
+ MatchCondition("wednesday", value="0"),
47
+ MatchCondition("thursday", value="0"),
48
+ MatchCondition("friday", value="0"),
49
+ MatchCondition("saturday", value="0"),
50
+ MatchCondition("sunday", value="0"),
51
+ ],
52
+ description="Remove calendar records with no active service days",
53
+ )
54
+ ```
55
+
56
+ ```console
57
+ continuous-gtfs schedule pipelines/my_agency --input schedule=./gtfs.zip -o ./out
58
+ ```
59
+
60
+ 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:
61
+
62
+ ```python
63
+ from continuous_gtfs import step
64
+
65
+ @step(files=["stops.txt"])
66
+ def drop_test_stops(ctx):
67
+ stops = ctx.output["stops.txt"]
68
+ ctx.output["stops.txt"] = stops.filter(~stops["stop_id"].str.starts_with("TEST_"))
69
+ ```
70
+
71
+ ## Install
72
+
73
+ ```console
74
+ pip install continuous-gtfs
75
+ ```
76
+
77
+ > The first PyPI release (v0.1.0) is landing shortly. Until it does, install
78
+ > straight from this repository:
79
+ >
80
+ > ```console
81
+ > pip install git+https://github.com/continuousgtfs/continuous-gtfs
82
+ > ```
83
+
84
+ Or work from a clone (uses [uv](https://docs.astral.sh/uv/)):
85
+
86
+ ```console
87
+ git clone https://github.com/continuousgtfs/continuous-gtfs
88
+ cd continuous-gtfs
89
+ uv sync
90
+ uv run continuous-gtfs --help
91
+ ```
92
+
93
+ Requires Python 3.12+.
94
+
95
+ ## What's in the box
96
+
97
+ - **Step framework** — `@step` functions and `Step` classes with `files=`, `after=`, `before=` ordering; `scan_pipeline()` / `resolve_dag()` discover and order a pipeline folder's steps.
98
+ - **Schedule builtins** — `RemoveRows`, `UpdateFields`, `ClearField`, `SortRows`, `TransformTripId`, `UpdateFeedInfo`, semantic removals (`RemoveRoutes` / `RemoveTrips` / `RemoveStops` / `RemoveServices` with reference-following), and more, all operating on [Polars](https://pola.rs) DataFrames.
99
+ - **Realtime builtins** — `FilterStopsByID`, `RenameVehicles`, `TransformTripId`, `CombineFeeds`, `ExpireCancelledTrips`, `InsertMissingCancellations`, `ConvertScheduledToNew`, and more, operating on GTFS-RT `FeedMessage` protobufs.
100
+ - **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.
101
+ - **Schedule semantics** — derivation of service-date / stop-pattern / time-profile tables and semantic trip pairing between two feed versions (`semantics`, `pair-trips` commands).
102
+ - **CLI** — see below.
103
+
104
+ ## CLI
105
+
106
+ The package installs a `continuous-gtfs` command:
107
+
108
+ | Command | What it does |
109
+ | --- | --- |
110
+ | `continuous-gtfs schedule <pipeline-dir>` | Run a schedule pipeline on a GTFS zip, write the transformed zip |
111
+ | `continuous-gtfs realtime <pipeline-dir>` | Run a realtime pipeline on GTFS-RT protobuf file(s) |
112
+ | `continuous-gtfs dag <pipeline-dir>` | Show a pipeline's resolved step DAG |
113
+ | `continuous-gtfs diff <a.zip> <b.zip>` | Diff two GTFS zips table-by-table |
114
+ | `continuous-gtfs rt-compare <a.pb> <b.pb>` | Semantically compare two GTFS-RT protobuf feeds |
115
+ | `continuous-gtfs semantics <feed.zip>` | Derive schedule-semantics tables for a feed |
116
+ | `continuous-gtfs pair-trips <target> <candidate>` | Pair two feeds' trips into a `trip_pairs` table |
117
+
118
+ Each command supports `--help` for its full options.
119
+
120
+ ## Defining a pipeline
121
+
122
+ A pipeline is a directory:
123
+
124
+ ```
125
+ pipelines/
126
+ └── my_agency/
127
+ ├── __init__.py # FEED_TYPE = "schedule", INPUTS = {"schedule": "gtfs_schedule_zip"}
128
+ └── transforms.py # step definitions (any module name works; all are scanned)
129
+ ```
130
+
131
+ `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`](examples/cross-pipeline-trip-id)).
132
+
133
+ Start from [`examples/minimal-schedule`](examples/minimal-schedule) for the smallest working pipeline.
134
+
135
+ ## Testing your pipeline
136
+
137
+ ```python
138
+ from continuous_gtfs.testing import gtfs_df, schedule_context
139
+
140
+ from pipelines.my_agency.transforms import remove_inactive_calendars
141
+
142
+ def test_remove_inactive_calendars():
143
+ ctx = schedule_context(**{
144
+ "calendar.txt": gtfs_df("""
145
+ service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday
146
+ DEAD,0,0,0,0,0,0,0
147
+ LIVE,1,1,1,1,1,0,0
148
+ """)
149
+ })
150
+ remove_inactive_calendars.apply(ctx)
151
+ assert ctx.output["calendar.txt"]["service_id"].to_list() == ["LIVE"]
152
+ ```
153
+
154
+ ## Relationship to the Continuous GTFS platform
155
+
156
+ This framework is the open-source core of [Continuous GTFS](https://continuousgtfs.com), 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.
157
+
158
+ ## Contributing
159
+
160
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Run the test suite with `uv run pytest`.
161
+
162
+ ## License
163
+
164
+ Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
165
+ Copyright 2026 Jarvus Innovations.
@@ -0,0 +1,141 @@
1
+ # Continuous GTFS
2
+
3
+ Define, test, and run GTFS data pipelines as Python steps.
4
+
5
+ `continuous-gtfs` is a framework for transforming [GTFS](https://gtfs.org) 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.
6
+
7
+ ```python
8
+ # pipelines/my_agency/transforms.py
9
+ from continuous_gtfs.builtins.schedule import (
10
+ InitScheduleOutput,
11
+ MatchCondition,
12
+ RemoveRows,
13
+ )
14
+
15
+ init = InitScheduleOutput()
16
+
17
+ remove_inactive_calendars = RemoveRows(
18
+ "calendar.txt",
19
+ [
20
+ MatchCondition("monday", value="0"),
21
+ MatchCondition("tuesday", value="0"),
22
+ MatchCondition("wednesday", value="0"),
23
+ MatchCondition("thursday", value="0"),
24
+ MatchCondition("friday", value="0"),
25
+ MatchCondition("saturday", value="0"),
26
+ MatchCondition("sunday", value="0"),
27
+ ],
28
+ description="Remove calendar records with no active service days",
29
+ )
30
+ ```
31
+
32
+ ```console
33
+ continuous-gtfs schedule pipelines/my_agency --input schedule=./gtfs.zip -o ./out
34
+ ```
35
+
36
+ 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:
37
+
38
+ ```python
39
+ from continuous_gtfs import step
40
+
41
+ @step(files=["stops.txt"])
42
+ def drop_test_stops(ctx):
43
+ stops = ctx.output["stops.txt"]
44
+ ctx.output["stops.txt"] = stops.filter(~stops["stop_id"].str.starts_with("TEST_"))
45
+ ```
46
+
47
+ ## Install
48
+
49
+ ```console
50
+ pip install continuous-gtfs
51
+ ```
52
+
53
+ > The first PyPI release (v0.1.0) is landing shortly. Until it does, install
54
+ > straight from this repository:
55
+ >
56
+ > ```console
57
+ > pip install git+https://github.com/continuousgtfs/continuous-gtfs
58
+ > ```
59
+
60
+ Or work from a clone (uses [uv](https://docs.astral.sh/uv/)):
61
+
62
+ ```console
63
+ git clone https://github.com/continuousgtfs/continuous-gtfs
64
+ cd continuous-gtfs
65
+ uv sync
66
+ uv run continuous-gtfs --help
67
+ ```
68
+
69
+ Requires Python 3.12+.
70
+
71
+ ## What's in the box
72
+
73
+ - **Step framework** — `@step` functions and `Step` classes with `files=`, `after=`, `before=` ordering; `scan_pipeline()` / `resolve_dag()` discover and order a pipeline folder's steps.
74
+ - **Schedule builtins** — `RemoveRows`, `UpdateFields`, `ClearField`, `SortRows`, `TransformTripId`, `UpdateFeedInfo`, semantic removals (`RemoveRoutes` / `RemoveTrips` / `RemoveStops` / `RemoveServices` with reference-following), and more, all operating on [Polars](https://pola.rs) DataFrames.
75
+ - **Realtime builtins** — `FilterStopsByID`, `RenameVehicles`, `TransformTripId`, `CombineFeeds`, `ExpireCancelledTrips`, `InsertMissingCancellations`, `ConvertScheduledToNew`, and more, operating on GTFS-RT `FeedMessage` protobufs.
76
+ - **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.
77
+ - **Schedule semantics** — derivation of service-date / stop-pattern / time-profile tables and semantic trip pairing between two feed versions (`semantics`, `pair-trips` commands).
78
+ - **CLI** — see below.
79
+
80
+ ## CLI
81
+
82
+ The package installs a `continuous-gtfs` command:
83
+
84
+ | Command | What it does |
85
+ | --- | --- |
86
+ | `continuous-gtfs schedule <pipeline-dir>` | Run a schedule pipeline on a GTFS zip, write the transformed zip |
87
+ | `continuous-gtfs realtime <pipeline-dir>` | Run a realtime pipeline on GTFS-RT protobuf file(s) |
88
+ | `continuous-gtfs dag <pipeline-dir>` | Show a pipeline's resolved step DAG |
89
+ | `continuous-gtfs diff <a.zip> <b.zip>` | Diff two GTFS zips table-by-table |
90
+ | `continuous-gtfs rt-compare <a.pb> <b.pb>` | Semantically compare two GTFS-RT protobuf feeds |
91
+ | `continuous-gtfs semantics <feed.zip>` | Derive schedule-semantics tables for a feed |
92
+ | `continuous-gtfs pair-trips <target> <candidate>` | Pair two feeds' trips into a `trip_pairs` table |
93
+
94
+ Each command supports `--help` for its full options.
95
+
96
+ ## Defining a pipeline
97
+
98
+ A pipeline is a directory:
99
+
100
+ ```
101
+ pipelines/
102
+ └── my_agency/
103
+ ├── __init__.py # FEED_TYPE = "schedule", INPUTS = {"schedule": "gtfs_schedule_zip"}
104
+ └── transforms.py # step definitions (any module name works; all are scanned)
105
+ ```
106
+
107
+ `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`](examples/cross-pipeline-trip-id)).
108
+
109
+ Start from [`examples/minimal-schedule`](examples/minimal-schedule) for the smallest working pipeline.
110
+
111
+ ## Testing your pipeline
112
+
113
+ ```python
114
+ from continuous_gtfs.testing import gtfs_df, schedule_context
115
+
116
+ from pipelines.my_agency.transforms import remove_inactive_calendars
117
+
118
+ def test_remove_inactive_calendars():
119
+ ctx = schedule_context(**{
120
+ "calendar.txt": gtfs_df("""
121
+ service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday
122
+ DEAD,0,0,0,0,0,0,0
123
+ LIVE,1,1,1,1,1,0,0
124
+ """)
125
+ })
126
+ remove_inactive_calendars.apply(ctx)
127
+ assert ctx.output["calendar.txt"]["service_id"].to_list() == ["LIVE"]
128
+ ```
129
+
130
+ ## Relationship to the Continuous GTFS platform
131
+
132
+ This framework is the open-source core of [Continuous GTFS](https://continuousgtfs.com), 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.
133
+
134
+ ## Contributing
135
+
136
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Run the test suite with `uv run pytest`.
137
+
138
+ ## License
139
+
140
+ Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
141
+ Copyright 2026 Jarvus Innovations.
@@ -0,0 +1,68 @@
1
+ [project]
2
+ name = "continuous-gtfs"
3
+ version = "0.1.0"
4
+ description = "Define, test, and run GTFS data pipelines as Python steps"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = [
8
+ "LICENSE",
9
+ "NOTICE",
10
+ ]
11
+ requires-python = ">=3.12"
12
+ keywords = [
13
+ "gtfs",
14
+ "gtfs-realtime",
15
+ "transit",
16
+ "pipeline",
17
+ "data-engineering",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Developers",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Scientific/Engineering :: GIS",
24
+ ]
25
+ dependencies = [
26
+ "polars>=1.0",
27
+ "protobuf>=7.35.1",
28
+ "gtfs-realtime-bindings>=1.0",
29
+ "gtfs-digester>=0.4.0",
30
+ "blake3>=1.0.8",
31
+ ]
32
+
33
+ [[project.authors]]
34
+ name = "Jarvus Innovations"
35
+
36
+ [project.urls]
37
+ Homepage = "https://continuousgtfs.com"
38
+ Repository = "https://github.com/continuousgtfs/continuous-gtfs"
39
+ Issues = "https://github.com/continuousgtfs/continuous-gtfs/issues"
40
+
41
+ [project.scripts]
42
+ continuous-gtfs = "continuous_gtfs.cli:main"
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "pytest>=8.0",
47
+ "gtfs-digester>=0.4.0",
48
+ "ruff>=0.15.20",
49
+ ]
50
+
51
+ [build-system]
52
+ requires = ["uv_build>=0.12.15,<0.13.0"]
53
+ build-backend = "uv_build"
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+
58
+ [tool.ruff]
59
+ line-length = 88
60
+
61
+ [tool.ruff.lint]
62
+ select = [
63
+ "E",
64
+ "F",
65
+ "I",
66
+ "B",
67
+ "UP",
68
+ ]
@@ -0,0 +1,53 @@
1
+ [project]
2
+ name = "continuous-gtfs"
3
+ version = "0.1.0"
4
+ description = "Define, test, and run GTFS data pipelines as Python steps"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE", "NOTICE"]
8
+ authors = [
9
+ { name = "Jarvus Innovations" },
10
+ ]
11
+ requires-python = ">=3.12"
12
+ keywords = ["gtfs", "gtfs-realtime", "transit", "pipeline", "data-engineering"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Topic :: Scientific/Engineering :: GIS",
18
+ ]
19
+ dependencies = [
20
+ "polars>=1.0",
21
+ "protobuf>=7.35.1",
22
+ "gtfs-realtime-bindings>=1.0",
23
+ "gtfs-digester>=0.4.0",
24
+ "blake3>=1.0.8",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://continuousgtfs.com"
29
+ Repository = "https://github.com/continuousgtfs/continuous-gtfs"
30
+ Issues = "https://github.com/continuousgtfs/continuous-gtfs/issues"
31
+
32
+ [project.scripts]
33
+ continuous-gtfs = "continuous_gtfs.cli:main"
34
+
35
+ [dependency-groups]
36
+ dev = [
37
+ "pytest>=8.0",
38
+ "gtfs-digester>=0.4.0",
39
+ "ruff>=0.15.20",
40
+ ]
41
+
42
+ [build-system]
43
+ requires = ["uv_build>=0.12.15,<0.13.0"]
44
+ build-backend = "uv_build"
45
+
46
+ [tool.pytest.ini_options]
47
+ testpaths = ["tests"]
48
+
49
+ [tool.ruff]
50
+ line-length = 88
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "I", "B", "UP"]
@@ -0,0 +1,24 @@
1
+ """Continuous GTFS transform framework."""
2
+
3
+ from .context import PipelineContext
4
+ from .executor import execute_pipeline
5
+ from .prep import PreparedRun, load_inputs, prepare_pipeline_run
6
+ from .results import ExecutionResult, StepResult
7
+ from .scanner import dag_edges, export_reactflow, resolve_dag, scan_pipeline
8
+ from .step import Step, step
9
+
10
+ __all__ = [
11
+ "Step",
12
+ "step",
13
+ "PipelineContext",
14
+ "StepResult",
15
+ "ExecutionResult",
16
+ "execute_pipeline",
17
+ "scan_pipeline",
18
+ "dag_edges",
19
+ "resolve_dag",
20
+ "export_reactflow",
21
+ "PreparedRun",
22
+ "prepare_pipeline_run",
23
+ "load_inputs",
24
+ ]