py-gtfs-loader
A Python library for loading and manipulating GTFS (General Transit Feed Specification) data with schema validation and type safety.
Features
- 📦 Load GTFS feeds from directories
- ✅ Schema validation with type checking
- 🔄 Modify and patch GTFS data
- 🚀 Support for standard GTFS and Transit's itinerary format
- 📝 CSV and GeoJSON file type support
- 🔗 Cross-referenced entities for easy data navigation
Installation
pip install py-gtfs-loader
Or using uv:
uv add py-gtfs-loader
Quick Start
Loading GTFS Data
import gtfs_loader
# Load a GTFS feed
gtfs = gtfs_loader.load('path/to/gtfs/directory')
# Access data by entity
stop = gtfs.stops['stop_id']
route = gtfs.routes['route_id']
trip = gtfs.trips['trip_id']
# Access grouped entities
stop_times = gtfs.stop_times['trip_id'] # Returns list of stop times for a trip
Modifying and Saving GTFS Data
# Modify data
gtfs.stops['stop_id'].stop_name = "New Stop Name"
# Save changes back to disk
gtfs_loader.patch(gtfs, 'path/to/input', 'path/to/output')
Loading Specific Files
# Load only specific files
gtfs = gtfs_loader.load('path/to/gtfs', files=['stops', 'routes', 'trips'])
Transit Itinerary Format
# Load Transit itinerary format (itinerary_cells.txt)
gtfs = gtfs_loader.load('path/to/gtfs', itineraries=True)
Development
This project uses uv for dependency management.
Setup
# Install dependencies
uv sync --all-extras --dev
# Run tests
uv run pytest .
# Run linting
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
Requirements
- Python ≥ 3.10
- Development dependencies: pytest, flake8
Project Structure
gtfs_loader/- Main package__init__.py- Load/patch functionsschema.py- GTFS entity definitionsschema_classes.py- Schema metadata systemtypes.py- Custom GTFS types (GTFSTime, GTFSDate, Entity)lat_lon.py- Geographic utilities
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Maintainers
- Jonathan Milot
- Jeremy Steele
Metadata
Release files for py-gtfs-loader 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_gtfs_loader-0.4.1.tar.gz | 14.7 kB | With provenance | Details for py_gtfs_loader-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_gtfs_loader-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for py_gtfs_loader-0.4.1-py3-none-any.whl |
Total release size: 29.4 kB
Release files / py_gtfs_loader-0.4.1.tar.gz
| Download URL | py_gtfs_loader-0.4.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ac5ff328d3318600d055adc627ed3978f81bc6ced51f17e510800850f32da09
|
|
BLAKE2b-256 checksum How to use checksums |
4da7880ddf7e46601e28159497e069402a4dc50c4882a67a17fdfa86dfb1f0cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 31, 2026.
Transparency logRelease files / py_gtfs_loader-0.4.1-py3-none-any.whl
| Download URL | py_gtfs_loader-0.4.1-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6cec61c5c8a40859bf8f1f8650c3a31d0d3427e058704c122f2ffd54fb2ab57
|
|
BLAKE2b-256 checksum How to use checksums |
0d2249a8a8017f16f26e267ce7810a6dd8fcc25ab25f25885033fc5d57cf2c8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 31, 2026.
Transparency logSecurity for py-gtfs-loader 0.4.1
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for py_gtfs_loader-0.4.1.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 31, 2026.
Transparency logA 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.