Skip to main content

pyosmptparser

Python bindings for osmptparser, a fast, parallel parser that reads public transport (PTv2) relations from an OpenStreetMap .pbf extract, reconnects broken/disconnected ways with some tolerance and returns each route as an ordered geometry plus its stops.

pypi package: https://pypi.org/project/pyosmptparser/

Install

pip install pyosmptparser

Prebuilt wheels are published for Linux (glibc >= 2.28 and musl, x86_64 and aarch64), macOS (Intel and Apple Silicon) and Windows, for any CPython >= 3.9 (abi3). Other platforms build from the sdist, which needs a Rust toolchain.

Usage

import pyosmptparser

p = pyosmptparser.Parser.new_ptv2('ecuador-latest.osm.pbf')   # all PTv2 route relations
pts = p.get_public_transports(150)                            # join ways with gaps up to 150 m

for pt in pts:
    pt.id            # osm relation id
    pt.tags          # dict of osm tags, e.g. pt.tags['name']
    pt.info          # dict of osm metadata: version, timestamp (epoch seconds), changeset, uid, user
    pt.geometry      # list of linestrings, each a list of (lon, lat); 1 linestring when fully joined
    pt.stops         # list of Node(id, lon, lat, tags) in relation member order
    pt.status.code   # 0 ok, 101 sorted, 102 joined, 103 joined+sorted, 501 broken
    pt.status.detail

Other constructors:

pyosmptparser.Parser.new_aa('file.pbf')                       # administrative boundary relations
pyosmptparser.Parser('file.pbf', 'route=bus,trolleybus')      # any osmptparser tag filter
pyosmptparser.Parser.new_ptv2('file.pbf', num_threads=4)      # default: all cpus

A missing or unreadable file raises FileNotFoundError / OSError. Set OSMSM_VERBOSE=1 to get the parser's progress log on stderr.

See test_pyosmptparser.py for a complete example.

Develop

Needs a stable Rust toolchain (https://rustup.rs) and Python >= 3.9.

git clone git@github.com:cualbondi/pyosmptparser.git
cd pyosmptparser
python3 -m venv .venv
source .venv/bin/activate
pip install maturin pytest

# build the extension into the venv and run the tests
maturin develop --release
pytest

# rust lint, same as CI
cargo fmt -- --check && cargo clippy --all-targets -- -D warnings

# build a wheel + sdist into dist/
maturin build --release --sdist --out dist

To use a local checkout of the Rust library, point the dependency at it in Cargo.toml (osmptparser = { path = "../osmptparser" }).

Release

  1. Bump version in Cargo.toml (and osmptparser there if the Rust library was released), update CHANGELOG.md, commit.
  2. Tag and push: git tag v3.0.0 && git push origin master v3.0.0.
  3. The CI workflow builds all wheels and the sdist, runs the tests, and publishes to PyPI through trusted publishing (one-time setup on PyPI: owner cualbondi, repository pyosmptparser, workflow CI.yml, environment pypi).

Manual alternative: maturin publish with a PyPI token (MATURIN_PYPI_TOKEN).

Metadata

Release files for pyosmptparser 3.0.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 pyosmptparser 3.0.0
File Size Uploaded
pyosmptparser-3.0.0.tar.gz 79.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyosmptparser 3.0.0
File
pyosmptparser-3.0.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
pyosmptparser-3.0.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pyosmptparser-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.7 MB

Release files / pyosmptparser-3.0.0.tar.gz

Download URL pyosmptparser-3.0.0.tar.gz
Size 79.8 kB
Tags Source
SHA-256 checksum
How to use checksums
18374eb9e6e7ddb2e42d93e2ddf5ebd56341f443a87a55f65960d6e4beaa0acd
BLAKE2b-256 checksum
How to use checksums
45b0db0e2304d226cc643a0cb9f4e77b8721709e1b31ddb14b2ac992c3a9a4a0
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-win_amd64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-win_amd64.whl
Size 349.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3173961dab9567c7c48937c1c9a9a408746b5507074a99efb1d7beee06f398bc
BLAKE2b-256 checksum
How to use checksums
f2ad4d5c5d3758b1dc44b9d725d1836b544569d19329e6ecdc7c248ea5b914b3
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 722.4 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c15cc0bc7f9feafdc7e08da56cc60346d48546a87eefd7453ffcbf916a1a78cb
BLAKE2b-256 checksum
How to use checksums
8ed6c8c4ed12d820212d2ac8b53ba5fda87e61cbf9a0e6590f1f6e90345cf837
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 684.1 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
1625de8af37d14f805ae14ec6630423040fff4ae6f97a45a677b5f3e2b07cfae
BLAKE2b-256 checksum
How to use checksums
1594da57025ec87e6c097c86a85dae926b4c85b0b7ad4e0662eeeef13f377d54
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 520.3 kB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
e254bfee5d6d6fadf013c97be3042fb4ddd3760ba7756df225c50093e7a76a42
BLAKE2b-256 checksum
How to use checksums
5e4f9b6787299c369fa9a659834267331f0e5d7a9df6114cfebbbf35accab2ae
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 505.6 kB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
4b95306fc5047b1cb1cdba0098e2d6701e6027d9450ea7ef3e180d9c76976ec8
BLAKE2b-256 checksum
How to use checksums
fa1f94b2802a463b1ef7cd11415c8ffe04f2626827ac64cdfd06ffa1b252e5a9
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-macosx_11_0_arm64.whl
Size 436.3 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6f7142e033ddcb02b30a0764274ae09802426235df0a0d495f2e391ce95962ec
BLAKE2b-256 checksum
How to use checksums
a7992edcd06a2d8d3ea30d8b98065c735ad5e06e96f3344b3747a272a916cf0c
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 Oct 10, 2026.

Transparency log

Release files / pyosmptparser-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyosmptparser-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 449.2 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
19e04423ee33b9acb6a79bcafdcf3a623cb96a10b9ed963c826323c7e0cf2302
BLAKE2b-256 checksum
How to use checksums
b448d6544a76c1d9c9b7e4729107fdcc39b619407f91741caaf35ca596e5511c
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 Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.0 This release

8 release files

2.2.0

2 release files

1.2.2

2 release files

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.0.1

1 release file

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