Skip to main content

transitio

AOI-driven OSM and GTFS acquisition, validation and repair — companion to pyrosm and cafein. transitio moves the raw ingredients of routing — OSM extracts and GTFS timetables — from the open data ecosystem to your area of interest, validated and repaired, ready for cafein to brew into routing results.

Status: early development. Acquisition (Mobility Database catalog + OSM extracts), GTFS validation, repair and cropping are in place, tied together by the one-call transitio.fetch pipeline.

The feed index that transitio.index reads is built in a separate repository, transitio-dev/transitio-index.

Quick example

import transitio

# One call: OSM extract + validated GTFS feeds for an area of interest.
result = transitio.fetch(helsinki_polygon)        # any shapely geometry,
                                                   # bbox tuple or place name
result.osm_pbf     # cropped OSM extract (path)
result.feeds       # downloaded, cropped and validated GTFS feeds (paths)
result.reports     # per-feed merged validation reports
result.skipped     # (feed id, reason) for anything left out

net = result.to_cafein()   # routable cafein.TransportNetwork
osm = result.to_pyrosm()   # pyrosm.OSM reader over the extract

fetch accepts when="2026-09-01" to pick the dataset versions covering a service day (needs a free Mobility Database API token, passed as refresh_token= or via the MOBILITY_API_REFRESH_TOKEN environment variable), modes=["rail", "tram"] to keep only feeds serving given modes, and repair=True to repair feeds before use. With a token, GTFS downloads are catalogued dataset versions verified against catalog checksums; without one, the latest hosted zips are fetched as-is — unverified moving targets.

Inferring missing route shapes

Many feeds ship without shapes.txt, leaving every consumer to draw straight lines between stops. infer_shapes fills that gap from an OSM extract — matching OSM route relations where they exist, map matching over tram, rail and bus-drivable networks where they do not — and writes a feed carrying real alignments:

report = transitio.infer_shapes(
    "feed.zip", "shaped.zip", pbf, strictness="strict"
)
report["written"]     # shapes written
report["shapes"]      # per shape: method, matched OSM relation, score
report["skipped"]     # per refused pattern: the stage that refused it

How much inference is acceptable is yours to choose. "strict" (the default) writes only unambiguous matches; "relaxed" and "permissive" trade certainty for coverage, which is the trade worth making where a feed has no shapes at all and the alternative is a straight line. Every shape is validated against the pattern's own stops before it is written — each stop must lie on the alignment, in order — so no level writes a shape the feed's own data contradicts.

On the Helsinki tram fixture with the feed's shapes withheld, the levels measured (scripts/validate_shapes.py):

level shapes written median length error worst offset
strict 35/80 0.9% 42 m
relaxed 40/80 0.9% 34 m
permissive 43/80 0.9% 184 m

Helsinki's OSM data is unusually good; expect a worse trade where it is not, and keep the report.

Lower-level access

Each pipeline stage is available on its own:

db = transitio.MobilityDatabase()

feeds = db.search_feeds(aoi=helsinki_polygon)
dataset = db.dataset_for(feeds[0], when="2026-09-01")
path = db.download(dataset)                        # cached, checksum-verified
report = db.validation_report(dataset)             # hosted canonical-validator report

pbf = transitio.fetch_pbf(helsinki_polygon)       # cropped OSM extract
validation = transitio.validate_feed(path)        # canonical-code notices
transitio.repair_feed(path, "repaired.zip")       # gtfstidy-contract repair
transitio.crop_feed(path, "cropped.zip", aoi=helsinki_polygon)

Documentation

The Sphinx site lives in docs/. Building it needs transitio itself installed (autodoc imports the real package) plus the Sphinx toolchain:

pip install . -r docs/requirements.txt
sphinx-build -b html docs docs/_build/html

The hosted version lives at https://transitio.readthedocs.io.

Installation

pip install transitio

Binary wheels cover Linux, macOS and Windows. Building from source instead requires a Rust toolchain (pip install .).

License

MIT

Release files for transitio 0.12.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 transitio 0.12.0
File Size Uploaded
transitio-0.12.0.tar.gz 228.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for transitio 0.12.0
File
transitio-0.12.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
transitio-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
transitio-0.12.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
transitio-0.12.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
transitio-0.12.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 7.5 MB

Release files / transitio-0.12.0.tar.gz

Download URL transitio-0.12.0.tar.gz
Size 228.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6753f2afb19684e15c12d69a22768563ef5c42b42b6ea9b8adf8505311702859
BLAKE2b-256 checksum
How to use checksums
14f56a93e8f92090818115bcaa3a84ee9e79482aced4e463042352f3e4208691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / transitio-0.12.0-cp310-abi3-win_amd64.whl

Download URL transitio-0.12.0-cp310-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5b1f47369206c22f182c877b6654785f0eb0bba470e645e12ad1de26260b578c
BLAKE2b-256 checksum
How to use checksums
73a3d53f228578c37f3ca41c3a94c84d4be2a2666a3770eef0d26bcad5a7a538
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / transitio-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL transitio-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b3712d58948fa0dcb657cd86cdfb938328503b4a7b2acbeba167ffd0b98d401f
BLAKE2b-256 checksum
How to use checksums
f32ca47ea0e0b4314d09aace6606f4cd288d160cf9f4147042a58c01a52682c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / transitio-0.12.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL transitio-0.12.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.5 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
018e6f6908fb70071964e29f6177eac5b5a82103990f20fc97cd878c7b94a470
BLAKE2b-256 checksum
How to use checksums
4910a1d33d9d6da7c47e83eae042a0d055af58b48b5aa6193681bb8cbb45962c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / transitio-0.12.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL transitio-0.12.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7e9c96831d2ee782b1f048b862698f9d640f6f3d846075c885a23573a17ea0a4
BLAKE2b-256 checksum
How to use checksums
52b32aea8a1ea96ca24875f801e16e6e8892af789e2121595d4ca6f85b5b38cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / transitio-0.12.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL transitio-0.12.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f5f41a68e68383e0baba099462fc779f8e7ac99f267bc5a9747c607a39f60002
BLAKE2b-256 checksum
How to use checksums
84534f6c198614094758cad968b6d33e8a0b41db3caaba84308ddd7e1187cb78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

6 release files

This release

0.12.0 This release

6 release files

0.9.0

6 release files

0.8.0

6 release files

0.7.0

6 release files

0.6.0

6 release files

0.5.0

6 release files

0.4.0

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.0

6 release files

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