gtfslint-cli 0.1.2__tar.gz → 0.1.3__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 (50) hide show
  1. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/CHANGELOG.md +24 -0
  2. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/CITATION.cff +2 -2
  3. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/MANIFEST.in +1 -0
  4. gtfslint_cli-0.1.3/PKG-INFO +292 -0
  5. gtfslint_cli-0.1.3/README.md +247 -0
  6. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/pyproject.toml +17 -12
  7. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/__init__.py +1 -1
  8. gtfslint_cli-0.1.3/src/gtfslint_cli.egg-info/PKG-INFO +292 -0
  9. gtfslint_cli-0.1.2/PKG-INFO +0 -381
  10. gtfslint_cli-0.1.2/README.md +0 -337
  11. gtfslint_cli-0.1.2/src/gtfslint_cli.egg-info/PKG-INFO +0 -381
  12. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/LICENSE +0 -0
  13. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/benchmarks/synthetic_feed.py +0 -0
  14. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/setup.cfg +0 -0
  15. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/__main__.py +0 -0
  16. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/api.py +0 -0
  17. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/cli.py +0 -0
  18. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/config.py +0 -0
  19. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/fieldtypes.py +0 -0
  20. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/notices.py +0 -0
  21. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/py.typed +0 -0
  22. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/reader.py +0 -0
  23. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/report.py +0 -0
  24. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/spec.py +0 -0
  25. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/stats.py +0 -0
  26. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint/validator.py +0 -0
  27. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint_cli.egg-info/SOURCES.txt +0 -0
  28. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint_cli.egg-info/dependency_links.txt +0 -0
  29. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint_cli.egg-info/entry_points.txt +0 -0
  30. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint_cli.egg-info/requires.txt +0 -0
  31. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/src/gtfslint_cli.egg-info/top_level.txt +0 -0
  32. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/__init__.py +0 -0
  33. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/conftest.py +0 -0
  34. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/agency.txt +0 -0
  35. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/calendar.txt +0 -0
  36. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/calendar_dates.txt +0 -0
  37. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/fare_attributes.txt +0 -0
  38. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/fare_rules.txt +0 -0
  39. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/feed_info.txt +0 -0
  40. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/frequencies.txt +0 -0
  41. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/routes.txt +0 -0
  42. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/shapes.txt +0 -0
  43. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/stop_times.txt +0 -0
  44. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/stops.txt +0 -0
  45. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/transfers.txt +0 -0
  46. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/data/valid_feed/trips.txt +0 -0
  47. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/test_reading.py +0 -0
  48. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/test_report_cli.py +0 -0
  49. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/test_rules.py +0 -0
  50. {gtfslint_cli-0.1.2 → gtfslint_cli-0.1.3}/tests/test_stats_and_config.py +0 -0
@@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.1.3] - 2026-12-02
8
+ ### Added
9
+ - `gtfslint-folder` pre-commit hook for feeds kept as a folder of `.txt` files; the folder
10
+ is given in `args`. The existing `gtfslint` hook still checks every committed `.zip` feed.
11
+ - GitLab CI/CD component `templates/gtfslint.yml` (inputs `feed`, `fail_on`, `args`,
12
+ `version`, `job_name`, `stage`, `image`): the job fails through the exit code and keeps
13
+ the HTML, JSON and Markdown reports as artifacts, linked from merge requests.
14
+ - Usage guide `docs/guide.md`: eight tasks with real output on a demo feed, the formulas
15
+ behind the checks and metrics (service dates, haversine distance, travel speed, stop
16
+ spacing grid, WCAG contrast, expiry, block overlaps, frequencies, headways,
17
+ vehicle-hours) in KaTeX, the rule catalogue and troubleshooting.
18
+ - `docs/assets/hero.svg`, a recorded `gtfslint check` session, regenerated by
19
+ `docs/assets/make_assets.py`.
20
+
21
+ ### Changed
22
+ - Releases are signed with PEP 740 attestations from the GitLab pipeline (Trusted Publishing identity), so PyPI shows verified provenance for every file.
23
+ - The PyPI "Documentation" link opens the package page on geophilo.com.
24
+ - README rewritten around a runnable quickstart with its real output, the hero figure, and
25
+ pre-commit, GitLab CI/CD and GitHub Actions sections; the full rule table moved to the
26
+ guide. The icon links to the package page on geophilo.com.
27
+ - PyPI metadata: description names GitLab pipelines and the rule count, hyphenated search
28
+ keywords, `Natural Language :: English` classifier.
29
+ - `MANIFEST.in` prunes `docs/`, so the figures stay out of the sdist.
30
+
7
31
  ## [0.1.2] - 2026-11-15
8
32
  ### Changed
9
33
  - Project home moved to GitLab (https://gitlab.com/geophilo1/gtfslint_sdk): package URLs,
@@ -6,8 +6,8 @@ authors:
6
6
  email: "geospacephilo@gmail.com"
7
7
  orcid: "https://orcid.org/0009-0005-6000-2934"
8
8
  title: "gtfslint"
9
- version: "0.1.2"
10
- date-released: "2026-11-15"
9
+ version: "0.1.3"
10
+ date-released: "2026-12-02"
11
11
  doi: "10.5281/zenodo.24063363"
12
12
  license: "MIT"
13
13
  repository-code: "https://gitlab.com/geophilo1/gtfslint_sdk"
@@ -7,3 +7,4 @@ include src/gtfslint/py.typed
7
7
  recursive-include src/gtfslint *.py
8
8
  recursive-include tests *.py *.txt
9
9
  recursive-include benchmarks *.py
10
+ prune docs
@@ -0,0 +1,292 @@
1
+ Metadata-Version: 2.4
2
+ Name: gtfslint-cli
3
+ Version: 0.1.3
4
+ Summary: Pure-Python GTFS Schedule validator and feed quality report for CI, pre-commit and GitLab pipelines: 63 coded rules, headway and service-span metrics, JSON, Markdown, HTML and GitHub output.
5
+ Author-email: Yusuf Eminoğlu <geospacephilo@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://gitlab.com/geophilo1/gtfslint_sdk
8
+ Project-URL: Repository, https://gitlab.com/geophilo1/gtfslint_sdk
9
+ Project-URL: Documentation, https://geophilo.com/sdks/gtfslint-cli/
10
+ Project-URL: Issues, https://gitlab.com/geophilo1/gtfslint_sdk/-/work_items
11
+ Project-URL: Changelog, https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CHANGELOG.md
12
+ Project-URL: SDK dashboard, https://geophilo.com/sdk-dashboard/
13
+ Project-URL: DOI, https://doi.org/10.5281/zenodo.24063363
14
+ Keywords: gtfs,gtfs-schedule,gtfs-validator,gtfs-lint,transit-feed,public-transport,timetable,linter,validator,data-quality,pre-commit,gitlab-ci,continuous-integration,headway,service-span,transit-data,mobility-data,transport-planning
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Environment :: Console
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Operating System :: OS Independent
25
+ Classifier: Topic :: Scientific/Engineering :: GIS
26
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Topic :: Software Development :: Testing
29
+ Classifier: Intended Audience :: Developers
30
+ Classifier: Intended Audience :: Science/Research
31
+ Classifier: Intended Audience :: Other Audience
32
+ Classifier: Natural Language :: English
33
+ Classifier: Typing :: Typed
34
+ Requires-Python: >=3.9
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
38
+ Requires-Dist: tzdata; sys_platform == "win32"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
41
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
44
+ Dynamic: license-file
45
+
46
+ <p align="center">
47
+ <a href="https://geophilo.com/sdks/gtfslint-cli/"><img src="https://geophilo.com/assets/sdk_icons/gtfslint_sdk.svg" width="120" height="120" alt="gtfslint-cli icon"></a>
48
+ </p>
49
+
50
+ # gtfslint
51
+
52
+ [![PyPI](https://img.shields.io/pypi/v/gtfslint-cli.svg)](https://pypi.org/project/gtfslint-cli/)
53
+ [![Python versions](https://img.shields.io/pypi/pyversions/gtfslint-cli.svg)](https://pypi.org/project/gtfslint-cli/)
54
+ [![Pipeline](https://gitlab.com/geophilo1/gtfslint_sdk/badges/main/pipeline.svg)](https://gitlab.com/geophilo1/gtfslint_sdk/-/pipelines)
55
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/LICENSE)
56
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24063363.svg)](https://doi.org/10.5281/zenodo.24063363)
57
+ [![Downloads](https://static.pepy.tech/badge/gtfslint-cli/month)](https://pepy.tech/project/gtfslint-cli)
58
+
59
+ **A pure-Python GTFS Schedule validator for transit data teams and CI pipelines: 63 coded rules with exact file, line and field locations, a pre-commit hook and a GitLab CI/CD component, and no Java to install.**
60
+
61
+ <p align="center"><img src="https://gitlab.com/geophilo1/gtfslint_sdk/-/raw/main/docs/assets/hero.svg" width="820" alt="Terminal session: gtfslint check on a six-file demo feed prints 3 errors (route colour 0E749, a trip on the missing route R2, an arrival before the previous departure), 3 warnings (no feed_info.txt, stops CAN and BAS 5003.6 km apart, stop ALS never served) and 1 info (unknown column wheelchair_boardng), then echo shows exit code 1."></p>
62
+
63
+ ## Why gtfslint?
64
+
65
+ - **No Java, no compiled code.** Pure Python on the standard library (`csv`, `zipfile`): it
66
+ installs wherever Python 3.9 to 3.13 runs, from notebooks to slim CI images. It does not
67
+ replace the canonical Java validator; it catches most broken feeds where Python fits.
68
+ - **63 rules with stable codes.** Every notice gives a code (GL001 to GL704), a severity,
69
+ the file, line and field, and a link to the
70
+ [GTFS Schedule reference](https://gtfs.org/documentation/schedule/reference/). 54 rules
71
+ carry the name of the matching
72
+ [MobilityData GTFS Validator](https://github.com/MobilityData/gtfs-validator) notice.
73
+ - **Made for CI.** Exit codes 0, 1 and 2 with `--fail-on`, pre-commit hooks for zipped and
74
+ folder feeds, a GitLab CI/CD component, GitHub Actions annotations, and self-contained
75
+ HTML, JSON and Markdown reports.
76
+ - **Fast on large feeds.** `stop_times.txt` and `shapes.txt` are streamed. A zipped
77
+ synthetic feed with 1,000,000 stop_times rows validates in 6.7 s on a Windows laptop
78
+ (`benchmarks/synthetic_feed.py`, Python 3.12).
79
+ - **More than validity.** `gtfslint stats` reports the service span, trips per day,
80
+ headways per route and direction, vehicle-hours and field completeness.
81
+ - **Tested.** 178 tests run in CI on Python 3.9, 3.11 and 3.13, with 94 % statement and
82
+ branch coverage; ruff and mypy are clean.
83
+
84
+ ## Installation
85
+
86
+ ```bash
87
+ pip install gtfslint-cli
88
+ ```
89
+
90
+ The PyPI name is `gtfslint-cli`; the import name and the command are `gtfslint`. Python 3.9
91
+ or newer. The only dependencies are `tomli` on Python 3.10 and older and `tzdata` on Windows.
92
+
93
+ ## Quickstart
94
+
95
+ This builds a six-file feed with seven deliberate mistakes and validates it:
96
+
97
+ ```python
98
+ from pathlib import Path
99
+
100
+ import gtfslint
101
+
102
+ feed = Path("demo-feed")
103
+ feed.mkdir(exist_ok=True)
104
+ files = {
105
+ "agency.txt": "agency_id,agency_name,agency_url,agency_timezone\n"
106
+ "DT,Demo Transit,https://transit.example.org,Europe/Istanbul\n",
107
+ "stops.txt": "stop_id,stop_name,stop_lat,stop_lon,wheelchair_boardng\n"
108
+ "KON,Konak,38.41885,27.12872,1\nCAN,Cankaya,38.42340,27.13450,1\n"
109
+ "BAS,Basmane,83.42210,27.14460,1\nALS,Alsancak,38.43820,27.14260,1\n",
110
+ "routes.txt": "route_id,agency_id,route_short_name,route_long_name,route_type,route_color\n"
111
+ "R1,DT,12,Konak - Basmane,3,0E749\n",
112
+ "trips.txt": "route_id,service_id,trip_id,direction_id\nR1,WK,T1,0\nR2,WK,T2,1\n",
113
+ "stop_times.txt": "trip_id,arrival_time,departure_time,stop_id,stop_sequence\n"
114
+ "T1,07:00:00,07:00:00,KON,1\nT1,07:04:00,07:04:00,CAN,2\nT1,07:02:00,07:02:00,BAS,3\n"
115
+ "T2,07:30:00,07:30:00,CAN,1\nT2,07:34:00,07:34:00,KON,2\n",
116
+ "calendar.txt": "service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,"
117
+ "start_date,end_date\nWK,1,1,1,1,1,0,0,20260101,20271231\n",
118
+ }
119
+ for name, text in files.items():
120
+ (feed / name).write_text(text, encoding="utf-8")
121
+
122
+ report = gtfslint.validate(feed, reference_date="2026-11-26")
123
+ print(report.to_text())
124
+ ```
125
+
126
+ ```text
127
+ routes.txt:2 [route_color]: GL101 error invalid_color: route_color '0E749' is not a six-digit hex color
128
+ trips.txt:3 [route_id]: GL201 error foreign_key_violation: route_id 'R2' not found in routes.txt
129
+ stop_times.txt:4 [arrival_time]: GL402 error stop_time_with_arrival_before_previous_departure_time: arrival 07:02:00 is before the previous departure
130
+ feed_info.txt: GL016 warning missing_recommended_file: feed_info.txt is missing (recommended)
131
+ stop_times.txt:4 [stop_id]: GL503 warning stops_too_far: stops 'CAN' and 'BAS' of trip 'T1' are 5003.6 km apart
132
+ stops.txt:5 [stop_id]: GL601 warning stop_without_stop_time: stop 'ALS' is not served by any trip
133
+ stops.txt:1 [wheelchair_boardng]: GL010 info unknown_column: unknown column 'wheelchair_boardng' in stops.txt
134
+ FAILED: 3 error(s), 3 warning(s), 1 info in demo-feed
135
+ ```
136
+
137
+ `gtfslint check demo-feed --reference-date 2026-11-26` prints the same report and exits
138
+ with code 1. The [usage guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md)
139
+ fixes the seven problems one by one.
140
+
141
+ ## Features
142
+
143
+ - **Validation:** `gtfslint.validate(path, select=..., ignore=..., reference_date=...)`
144
+ reads a `.zip` archive or a folder and returns a `Report`. Rules are selected by code
145
+ (`GL201`), prefix (`GL2`) or name (`foreign_key_violation`).
146
+
147
+ | Codes | What they check |
148
+ |---|---|
149
+ | GL001-GL016 | files, columns, rows, CSV parsing, duplicate keys, required fields |
150
+ | GL101-GL116 | field types and ranges, colours, URLs, time zones, language and currency codes, route colour contrast |
151
+ | GL201-GL204 | foreign keys and the station hierarchy |
152
+ | GL301-GL304 | calendars: date ranges, services never active or expired |
153
+ | GL401-GL409 | stop times: order, timing, travel speed between stops |
154
+ | GL501-GL504 | shapes and stop spacing |
155
+ | GL601-GL606 | stops, stations, routes, shapes, trips and services that nothing uses |
156
+ | GL701-GL704 | overlapping block trips, `feed_info.txt` dates and expiry |
157
+
158
+ - **Reports:** `Report.to_text()`, `to_json()`, `to_markdown()`, `to_html()` and
159
+ `to_github()`; `Report.write(path)` picks the format from the suffix;
160
+ `Report.exit_code(fail_on="warning")` applies a failure threshold.
161
+ - **Service metrics:** `gtfslint.stats(path, date=None)` returns a `FeedStats` with counts,
162
+ route types, service span, trips per date (`frequencies.txt` expanded), the busiest date,
163
+ headways per route and direction (`RouteHeadway`), vehicle-hours, bounding box and the
164
+ completeness of the accessibility and bicycle fields.
165
+ - **Catalogue:** `gtfslint.RULES` maps every code to a `Rule` with its description,
166
+ reference link and MobilityData notice; `gtfslint rules` prints it.
167
+
168
+ ## Command line
169
+
170
+ ```text
171
+ $ gtfslint --help
172
+ usage: gtfslint [-h] [--version] {check,stats,rules} ...
173
+
174
+ Fast GTFS Schedule validator and quality report.
175
+
176
+ positional arguments:
177
+ {check,stats,rules}
178
+ check validate one or more feeds (.zip or folder)
179
+ stats print quality metrics of a feed
180
+ rules list every rule
181
+
182
+ options:
183
+ -h, --help show this help message and exit
184
+ --version show program's version number and exit
185
+ ```
186
+
187
+ | `check` option | Meaning |
188
+ |---|---|
189
+ | `-f, --format` | `text` (default), `json`, `markdown`, `html`, `github` |
190
+ | `-o, --output FILE` | write the `--format` output to a file instead of stdout |
191
+ | `--json / --markdown / --html FILE` | also write reports in those formats |
192
+ | `--select`, `--ignore` | comma-separated rule codes, prefixes (`GL4`) or names (`invalid_url`) |
193
+ | `--fail-on` | lowest severity that fails: `error` (default), `warning`, `info`, `never` |
194
+ | `--reference-date` | date for the expiry rules (default: today) |
195
+ | `-q, --quiet` | print only the summary line |
196
+
197
+ Exit codes: **0** when no notice reaches `--fail-on`, **1** when one does, **2** for usage
198
+ errors, invalid configuration or an unreadable feed. Settings can live in `pyproject.toml`:
199
+
200
+ ```toml
201
+ [tool.gtfslint]
202
+ ignore = ["GL401", "GL606"] # codes, prefixes or names
203
+ fail-on = "warning" # error | warning | info | never
204
+ reference-date = "2026-11-26" # fixed date for reproducible builds
205
+ speed-limits-kmh = { 3 = 120 } # GL408 limit per basic route_type
206
+ ```
207
+
208
+ ## Use with pre-commit
209
+
210
+ ```yaml
211
+ repos:
212
+ - repo: https://gitlab.com/geophilo1/gtfslint_sdk
213
+ rev: v0.1.3
214
+ hooks:
215
+ - id: gtfslint # every committed .zip feed
216
+ - id: gtfslint-folder # a feed stored as a folder
217
+ args: [gtfs/]
218
+ files: ^gtfs/
219
+ ```
220
+
221
+ `gtfslint-folder` is new in 0.1.3; it checks the folder in `args` when a file in it changes.
222
+
223
+ ## Use in GitLab CI/CD
224
+
225
+ The repository is a GitLab CI/CD component. The job installs `gtfslint-cli`, checks the
226
+ feed, fails through the exit code and keeps the HTML, JSON and Markdown reports as
227
+ artifacts, linked from merge requests as "GTFS validation report".
228
+
229
+ ```yaml
230
+ include:
231
+ - component: gitlab.com/geophilo1/gtfslint_sdk/gtfslint@v0.1.3
232
+ inputs:
233
+ feed: gtfs/ # .zip archive or folder
234
+ fail_on: warning # error, warning, info or never
235
+ args: --reference-date 2026-11-26
236
+ ```
237
+
238
+ Other inputs: `version`, `job_name`, `stage` and `image`; the
239
+ [guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md) lists them all.
240
+ On GitHub Actions, `gtfslint check gtfs/ --format github` turns the notices into
241
+ annotations on the feed's files and lines.
242
+
243
+ ## Documentation
244
+
245
+ - [Usage guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md):
246
+ tasks with real output, the formulas behind the checks and metrics, the full rule
247
+ catalogue and troubleshooting.
248
+ - [Package page on geophilo.com](https://geophilo.com/sdks/gtfslint-cli/)
249
+ - [Changelog](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CHANGELOG.md)
250
+
251
+ | API | What it does |
252
+ |---|---|
253
+ | `validate(path, ...)` | Validate a feed and return a `Report` |
254
+ | `stats(path, date=None)` | Quality metrics as a `FeedStats` |
255
+ | `Report` | Counts, notices, `exit_code()`, `render()`, `write()` and the five output formats |
256
+ | `Notice`, `Rule`, `Severity`, `RULES` | One violation, one rule, the severities, the catalogue |
257
+ | `FeedStats`, `RouteHeadway` | Service metrics and per-route headways |
258
+ | `Config`, `load_config()` | Settings and the `[tool.gtfslint]` reader |
259
+ | `FeedError` | Raised when the feed path is missing or not a readable zip |
260
+
261
+ Development: `pip install -e ".[dev]"`, then `python -m pytest`, `python -m ruff check src
262
+ tests` and `python -m mypy`. The tests break the valid feed in `tests/data/valid_feed`
263
+ once per rule.
264
+
265
+ ## Related packages
266
+
267
+ - [transitfreq](https://pypi.org/project/transitfreq/): frequency, headway, span-of-service
268
+ and quality-of-service analysis of the same `.zip` or folder feed, once gtfslint has
269
+ passed it.
270
+ - [mockgeo](https://pypi.org/project/mockgeo/): synthetic test data, including GTFS feeds
271
+ (`mockgeo gtfs -o feed.zip`) to exercise a gtfslint gate in your own tests.
272
+
273
+ All packages: [Geophilo SDK dashboard](https://geophilo.com/sdk-dashboard/).
274
+
275
+ ## Citation
276
+
277
+ ```text
278
+ @software{eminoglu_gtfslint,
279
+ author = {Eminoğlu, Yusuf},
280
+ title = {gtfslint},
281
+ year = {2026},
282
+ version = {0.1.3},
283
+ doi = {10.5281/zenodo.24063363},
284
+ url = {https://doi.org/10.5281/zenodo.24063363}
285
+ }
286
+ ```
287
+
288
+ Machine-readable metadata: [CITATION.cff](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CITATION.cff).
289
+
290
+ ## License
291
+
292
+ MIT © Yusuf Eminoğlu. See [LICENSE](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/LICENSE).
@@ -0,0 +1,247 @@
1
+ <p align="center">
2
+ <a href="https://geophilo.com/sdks/gtfslint-cli/"><img src="https://geophilo.com/assets/sdk_icons/gtfslint_sdk.svg" width="120" height="120" alt="gtfslint-cli icon"></a>
3
+ </p>
4
+
5
+ # gtfslint
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/gtfslint-cli.svg)](https://pypi.org/project/gtfslint-cli/)
8
+ [![Python versions](https://img.shields.io/pypi/pyversions/gtfslint-cli.svg)](https://pypi.org/project/gtfslint-cli/)
9
+ [![Pipeline](https://gitlab.com/geophilo1/gtfslint_sdk/badges/main/pipeline.svg)](https://gitlab.com/geophilo1/gtfslint_sdk/-/pipelines)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/LICENSE)
11
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24063363.svg)](https://doi.org/10.5281/zenodo.24063363)
12
+ [![Downloads](https://static.pepy.tech/badge/gtfslint-cli/month)](https://pepy.tech/project/gtfslint-cli)
13
+
14
+ **A pure-Python GTFS Schedule validator for transit data teams and CI pipelines: 63 coded rules with exact file, line and field locations, a pre-commit hook and a GitLab CI/CD component, and no Java to install.**
15
+
16
+ <p align="center"><img src="https://gitlab.com/geophilo1/gtfslint_sdk/-/raw/main/docs/assets/hero.svg" width="820" alt="Terminal session: gtfslint check on a six-file demo feed prints 3 errors (route colour 0E749, a trip on the missing route R2, an arrival before the previous departure), 3 warnings (no feed_info.txt, stops CAN and BAS 5003.6 km apart, stop ALS never served) and 1 info (unknown column wheelchair_boardng), then echo shows exit code 1."></p>
17
+
18
+ ## Why gtfslint?
19
+
20
+ - **No Java, no compiled code.** Pure Python on the standard library (`csv`, `zipfile`): it
21
+ installs wherever Python 3.9 to 3.13 runs, from notebooks to slim CI images. It does not
22
+ replace the canonical Java validator; it catches most broken feeds where Python fits.
23
+ - **63 rules with stable codes.** Every notice gives a code (GL001 to GL704), a severity,
24
+ the file, line and field, and a link to the
25
+ [GTFS Schedule reference](https://gtfs.org/documentation/schedule/reference/). 54 rules
26
+ carry the name of the matching
27
+ [MobilityData GTFS Validator](https://github.com/MobilityData/gtfs-validator) notice.
28
+ - **Made for CI.** Exit codes 0, 1 and 2 with `--fail-on`, pre-commit hooks for zipped and
29
+ folder feeds, a GitLab CI/CD component, GitHub Actions annotations, and self-contained
30
+ HTML, JSON and Markdown reports.
31
+ - **Fast on large feeds.** `stop_times.txt` and `shapes.txt` are streamed. A zipped
32
+ synthetic feed with 1,000,000 stop_times rows validates in 6.7 s on a Windows laptop
33
+ (`benchmarks/synthetic_feed.py`, Python 3.12).
34
+ - **More than validity.** `gtfslint stats` reports the service span, trips per day,
35
+ headways per route and direction, vehicle-hours and field completeness.
36
+ - **Tested.** 178 tests run in CI on Python 3.9, 3.11 and 3.13, with 94 % statement and
37
+ branch coverage; ruff and mypy are clean.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install gtfslint-cli
43
+ ```
44
+
45
+ The PyPI name is `gtfslint-cli`; the import name and the command are `gtfslint`. Python 3.9
46
+ or newer. The only dependencies are `tomli` on Python 3.10 and older and `tzdata` on Windows.
47
+
48
+ ## Quickstart
49
+
50
+ This builds a six-file feed with seven deliberate mistakes and validates it:
51
+
52
+ ```python
53
+ from pathlib import Path
54
+
55
+ import gtfslint
56
+
57
+ feed = Path("demo-feed")
58
+ feed.mkdir(exist_ok=True)
59
+ files = {
60
+ "agency.txt": "agency_id,agency_name,agency_url,agency_timezone\n"
61
+ "DT,Demo Transit,https://transit.example.org,Europe/Istanbul\n",
62
+ "stops.txt": "stop_id,stop_name,stop_lat,stop_lon,wheelchair_boardng\n"
63
+ "KON,Konak,38.41885,27.12872,1\nCAN,Cankaya,38.42340,27.13450,1\n"
64
+ "BAS,Basmane,83.42210,27.14460,1\nALS,Alsancak,38.43820,27.14260,1\n",
65
+ "routes.txt": "route_id,agency_id,route_short_name,route_long_name,route_type,route_color\n"
66
+ "R1,DT,12,Konak - Basmane,3,0E749\n",
67
+ "trips.txt": "route_id,service_id,trip_id,direction_id\nR1,WK,T1,0\nR2,WK,T2,1\n",
68
+ "stop_times.txt": "trip_id,arrival_time,departure_time,stop_id,stop_sequence\n"
69
+ "T1,07:00:00,07:00:00,KON,1\nT1,07:04:00,07:04:00,CAN,2\nT1,07:02:00,07:02:00,BAS,3\n"
70
+ "T2,07:30:00,07:30:00,CAN,1\nT2,07:34:00,07:34:00,KON,2\n",
71
+ "calendar.txt": "service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,"
72
+ "start_date,end_date\nWK,1,1,1,1,1,0,0,20260101,20271231\n",
73
+ }
74
+ for name, text in files.items():
75
+ (feed / name).write_text(text, encoding="utf-8")
76
+
77
+ report = gtfslint.validate(feed, reference_date="2026-11-26")
78
+ print(report.to_text())
79
+ ```
80
+
81
+ ```text
82
+ routes.txt:2 [route_color]: GL101 error invalid_color: route_color '0E749' is not a six-digit hex color
83
+ trips.txt:3 [route_id]: GL201 error foreign_key_violation: route_id 'R2' not found in routes.txt
84
+ stop_times.txt:4 [arrival_time]: GL402 error stop_time_with_arrival_before_previous_departure_time: arrival 07:02:00 is before the previous departure
85
+ feed_info.txt: GL016 warning missing_recommended_file: feed_info.txt is missing (recommended)
86
+ stop_times.txt:4 [stop_id]: GL503 warning stops_too_far: stops 'CAN' and 'BAS' of trip 'T1' are 5003.6 km apart
87
+ stops.txt:5 [stop_id]: GL601 warning stop_without_stop_time: stop 'ALS' is not served by any trip
88
+ stops.txt:1 [wheelchair_boardng]: GL010 info unknown_column: unknown column 'wheelchair_boardng' in stops.txt
89
+ FAILED: 3 error(s), 3 warning(s), 1 info in demo-feed
90
+ ```
91
+
92
+ `gtfslint check demo-feed --reference-date 2026-11-26` prints the same report and exits
93
+ with code 1. The [usage guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md)
94
+ fixes the seven problems one by one.
95
+
96
+ ## Features
97
+
98
+ - **Validation:** `gtfslint.validate(path, select=..., ignore=..., reference_date=...)`
99
+ reads a `.zip` archive or a folder and returns a `Report`. Rules are selected by code
100
+ (`GL201`), prefix (`GL2`) or name (`foreign_key_violation`).
101
+
102
+ | Codes | What they check |
103
+ |---|---|
104
+ | GL001-GL016 | files, columns, rows, CSV parsing, duplicate keys, required fields |
105
+ | GL101-GL116 | field types and ranges, colours, URLs, time zones, language and currency codes, route colour contrast |
106
+ | GL201-GL204 | foreign keys and the station hierarchy |
107
+ | GL301-GL304 | calendars: date ranges, services never active or expired |
108
+ | GL401-GL409 | stop times: order, timing, travel speed between stops |
109
+ | GL501-GL504 | shapes and stop spacing |
110
+ | GL601-GL606 | stops, stations, routes, shapes, trips and services that nothing uses |
111
+ | GL701-GL704 | overlapping block trips, `feed_info.txt` dates and expiry |
112
+
113
+ - **Reports:** `Report.to_text()`, `to_json()`, `to_markdown()`, `to_html()` and
114
+ `to_github()`; `Report.write(path)` picks the format from the suffix;
115
+ `Report.exit_code(fail_on="warning")` applies a failure threshold.
116
+ - **Service metrics:** `gtfslint.stats(path, date=None)` returns a `FeedStats` with counts,
117
+ route types, service span, trips per date (`frequencies.txt` expanded), the busiest date,
118
+ headways per route and direction (`RouteHeadway`), vehicle-hours, bounding box and the
119
+ completeness of the accessibility and bicycle fields.
120
+ - **Catalogue:** `gtfslint.RULES` maps every code to a `Rule` with its description,
121
+ reference link and MobilityData notice; `gtfslint rules` prints it.
122
+
123
+ ## Command line
124
+
125
+ ```text
126
+ $ gtfslint --help
127
+ usage: gtfslint [-h] [--version] {check,stats,rules} ...
128
+
129
+ Fast GTFS Schedule validator and quality report.
130
+
131
+ positional arguments:
132
+ {check,stats,rules}
133
+ check validate one or more feeds (.zip or folder)
134
+ stats print quality metrics of a feed
135
+ rules list every rule
136
+
137
+ options:
138
+ -h, --help show this help message and exit
139
+ --version show program's version number and exit
140
+ ```
141
+
142
+ | `check` option | Meaning |
143
+ |---|---|
144
+ | `-f, --format` | `text` (default), `json`, `markdown`, `html`, `github` |
145
+ | `-o, --output FILE` | write the `--format` output to a file instead of stdout |
146
+ | `--json / --markdown / --html FILE` | also write reports in those formats |
147
+ | `--select`, `--ignore` | comma-separated rule codes, prefixes (`GL4`) or names (`invalid_url`) |
148
+ | `--fail-on` | lowest severity that fails: `error` (default), `warning`, `info`, `never` |
149
+ | `--reference-date` | date for the expiry rules (default: today) |
150
+ | `-q, --quiet` | print only the summary line |
151
+
152
+ Exit codes: **0** when no notice reaches `--fail-on`, **1** when one does, **2** for usage
153
+ errors, invalid configuration or an unreadable feed. Settings can live in `pyproject.toml`:
154
+
155
+ ```toml
156
+ [tool.gtfslint]
157
+ ignore = ["GL401", "GL606"] # codes, prefixes or names
158
+ fail-on = "warning" # error | warning | info | never
159
+ reference-date = "2026-11-26" # fixed date for reproducible builds
160
+ speed-limits-kmh = { 3 = 120 } # GL408 limit per basic route_type
161
+ ```
162
+
163
+ ## Use with pre-commit
164
+
165
+ ```yaml
166
+ repos:
167
+ - repo: https://gitlab.com/geophilo1/gtfslint_sdk
168
+ rev: v0.1.3
169
+ hooks:
170
+ - id: gtfslint # every committed .zip feed
171
+ - id: gtfslint-folder # a feed stored as a folder
172
+ args: [gtfs/]
173
+ files: ^gtfs/
174
+ ```
175
+
176
+ `gtfslint-folder` is new in 0.1.3; it checks the folder in `args` when a file in it changes.
177
+
178
+ ## Use in GitLab CI/CD
179
+
180
+ The repository is a GitLab CI/CD component. The job installs `gtfslint-cli`, checks the
181
+ feed, fails through the exit code and keeps the HTML, JSON and Markdown reports as
182
+ artifacts, linked from merge requests as "GTFS validation report".
183
+
184
+ ```yaml
185
+ include:
186
+ - component: gitlab.com/geophilo1/gtfslint_sdk/gtfslint@v0.1.3
187
+ inputs:
188
+ feed: gtfs/ # .zip archive or folder
189
+ fail_on: warning # error, warning, info or never
190
+ args: --reference-date 2026-11-26
191
+ ```
192
+
193
+ Other inputs: `version`, `job_name`, `stage` and `image`; the
194
+ [guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md) lists them all.
195
+ On GitHub Actions, `gtfslint check gtfs/ --format github` turns the notices into
196
+ annotations on the feed's files and lines.
197
+
198
+ ## Documentation
199
+
200
+ - [Usage guide](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/docs/guide.md):
201
+ tasks with real output, the formulas behind the checks and metrics, the full rule
202
+ catalogue and troubleshooting.
203
+ - [Package page on geophilo.com](https://geophilo.com/sdks/gtfslint-cli/)
204
+ - [Changelog](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CHANGELOG.md)
205
+
206
+ | API | What it does |
207
+ |---|---|
208
+ | `validate(path, ...)` | Validate a feed and return a `Report` |
209
+ | `stats(path, date=None)` | Quality metrics as a `FeedStats` |
210
+ | `Report` | Counts, notices, `exit_code()`, `render()`, `write()` and the five output formats |
211
+ | `Notice`, `Rule`, `Severity`, `RULES` | One violation, one rule, the severities, the catalogue |
212
+ | `FeedStats`, `RouteHeadway` | Service metrics and per-route headways |
213
+ | `Config`, `load_config()` | Settings and the `[tool.gtfslint]` reader |
214
+ | `FeedError` | Raised when the feed path is missing or not a readable zip |
215
+
216
+ Development: `pip install -e ".[dev]"`, then `python -m pytest`, `python -m ruff check src
217
+ tests` and `python -m mypy`. The tests break the valid feed in `tests/data/valid_feed`
218
+ once per rule.
219
+
220
+ ## Related packages
221
+
222
+ - [transitfreq](https://pypi.org/project/transitfreq/): frequency, headway, span-of-service
223
+ and quality-of-service analysis of the same `.zip` or folder feed, once gtfslint has
224
+ passed it.
225
+ - [mockgeo](https://pypi.org/project/mockgeo/): synthetic test data, including GTFS feeds
226
+ (`mockgeo gtfs -o feed.zip`) to exercise a gtfslint gate in your own tests.
227
+
228
+ All packages: [Geophilo SDK dashboard](https://geophilo.com/sdk-dashboard/).
229
+
230
+ ## Citation
231
+
232
+ ```text
233
+ @software{eminoglu_gtfslint,
234
+ author = {Eminoğlu, Yusuf},
235
+ title = {gtfslint},
236
+ year = {2026},
237
+ version = {0.1.3},
238
+ doi = {10.5281/zenodo.24063363},
239
+ url = {https://doi.org/10.5281/zenodo.24063363}
240
+ }
241
+ ```
242
+
243
+ Machine-readable metadata: [CITATION.cff](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CITATION.cff).
244
+
245
+ ## License
246
+
247
+ MIT © Yusuf Eminoğlu. See [LICENSE](https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/LICENSE).
@@ -4,26 +4,30 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gtfslint-cli"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  authors = [
9
9
  { name = "Yusuf Eminoğlu", email = "geospacephilo@gmail.com" }
10
10
  ]
11
- description = "Pure-Python GTFS Schedule validator and feed quality report for CI and pre-commit: coded rules, headway and service-span metrics, JSON/Markdown/HTML/GitHub output."
11
+ description = "Pure-Python GTFS Schedule validator and feed quality report for CI, pre-commit and GitLab pipelines: 63 coded rules, headway and service-span metrics, JSON, Markdown, HTML and GitHub output."
12
12
  keywords = [
13
13
  "gtfs",
14
- "gtfs schedule",
15
- "gtfs validator",
16
- "transit feed",
17
- "public transport",
14
+ "gtfs-schedule",
15
+ "gtfs-validator",
16
+ "gtfs-lint",
17
+ "transit-feed",
18
+ "public-transport",
18
19
  "timetable",
19
20
  "linter",
20
- "data quality",
21
+ "validator",
22
+ "data-quality",
21
23
  "pre-commit",
22
- "continuous integration",
24
+ "gitlab-ci",
25
+ "continuous-integration",
23
26
  "headway",
24
- "transit data",
25
- "mobility data",
26
- "transport planning",
27
+ "service-span",
28
+ "transit-data",
29
+ "mobility-data",
30
+ "transport-planning",
27
31
  ]
28
32
  readme = "README.md"
29
33
  license = "MIT"
@@ -47,6 +51,7 @@ classifiers = [
47
51
  "Intended Audience :: Developers",
48
52
  "Intended Audience :: Science/Research",
49
53
  "Intended Audience :: Other Audience",
54
+ "Natural Language :: English",
50
55
  "Typing :: Typed",
51
56
  ]
52
57
  dependencies = [
@@ -68,7 +73,7 @@ gtfslint = "gtfslint.cli:main"
68
73
  [project.urls]
69
74
  Homepage = "https://gitlab.com/geophilo1/gtfslint_sdk"
70
75
  Repository = "https://gitlab.com/geophilo1/gtfslint_sdk"
71
- Documentation = "https://gitlab.com/geophilo1/gtfslint_sdk#readme"
76
+ Documentation = "https://geophilo.com/sdks/gtfslint-cli/"
72
77
  Issues = "https://gitlab.com/geophilo1/gtfslint_sdk/-/work_items"
73
78
  Changelog = "https://gitlab.com/geophilo1/gtfslint_sdk/-/blob/main/CHANGELOG.md"
74
79
  "SDK dashboard" = "https://geophilo.com/sdk-dashboard/"
@@ -13,7 +13,7 @@ from .reader import FeedError
13
13
  from .report import Report
14
14
  from .stats import FeedStats, RouteHeadway
15
15
 
16
- __version__ = "0.1.2"
16
+ __version__ = "0.1.3"
17
17
 
18
18
  __all__ = [
19
19
  "RULES",