AI-ready Python API wrapper for Île de France mobilités open-data API
Project description
pyidfm — Île-de-France Mobilités API
AI-ready Python API wrapper for the Île-de-France Mobilités open-data API. It exposes next-schedule lookups, traffic disruption reports and traffic messages for the Paris / Île-de-France public transport network (Metro, RER, Transilien, Tram, Bus).
The package is designed both as a regular Python library and as a CLI that is easy to drive from an LLM agent.
Part of this codebase (notably the SIRI / Navitia request plumbing in
idfm.pyand the dataclasses inmodels.py) is derived from theidfm-apipackage, with heavy modifications focused on reliability and LLM-friendliness rather than raw feature completeness.
Installation
pip install pyidfm
Or, from a checkout of this repository:
pip install .
API key
Live endpoints (next schedules, traffic reports, messages) require a free API key from the IDFM PRIM platform: https://prim.iledefrance-mobilites.fr/.
Once you have a key, expose it via the IDFM_API_KEY environment variable
(every CLI command picks it up automatically) or pass it explicitly with the
--apikey option.
export IDFM_API_KEY="your-key-here"
Static datasets
Lines and stops are resolved from local snapshots of the IDFM open-data datasets. They are downloaded on first use, but you can refresh them if required.
pyidfm update-data
CLI usage
The CLI is exposed as pyidfm once installed. Top-level commands:
| Command | Description |
|---|---|
pyidfm update-data |
Download/refresh the local static datasets. |
pyidfm search lines |
List lines, optionally filtered by transport mode. |
pyidfm search stops |
List stops served by a given line. |
pyidfm traffic |
Next schedules at a stop (live). |
pyidfm line-report |
Traffic disruption reports for a line (live). |
pyidfm messages |
Traffic messages for a line or stop (live). |
All commands accept --json to emit machine-readable output, and the top-level
--debug flag for verbose logging.
Examples
Find the ID of the RER D:
pyidfm search lines --mode rail
List the stops on a line:
pyidfm search stops C01742
Get the next departures at a stop:
pyidfm traffic --stop-id "STIF:StopArea:SP:43135:"
Get current disruptions on a line:
pyidfm line-report C01742
Python usage
from pyidfm.idfm import IDFMApi
from pyidfm.dataset import Dataset
# Live data (PRIM API key required)
api = IDFMApi(apikey="your-key-here")
stops = api.get_stops("C01742")
for s in stops:
print(s.name, s.stop_id)
departures = api.get_traffic("STIF:StopArea:SP:43135:")
for d in departures:
print(d.schedule, d.destination_name, d.direction)
reports = api.get_line_reports("C01742")
for r in reports:
print(r.name, r.severity, r.effect)
Usage through LLMs
The CLI is the recommended entry point for LLM agents: every command supports
--json so output is straightforward to parse, and a typical flow is just
three calls — search lines → search stops → traffic (or line-report /
messages). See SKILL.md in this repository for the agent
skill packaging used during development.
License
MIT — see LICENCE.
The IDFM open-data datasets bundled at runtime are redistributed under the ODbL; the live PRIM API is covered by the Licence Mobilité.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyidfm-0.0.3.tar.gz.
File metadata
- Download URL: pyidfm-0.0.3.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
892b255ea523b9f45b68ec9a5d38c6d1af0939620e53d1918057f724ece0ceaa
|
|
| MD5 |
f0f2a347f38e0c12c6111fcc25c7f04e
|
|
| BLAKE2b-256 |
1f51add5b84f3f94babff5d431f6997c9da65244df86cce4111a62d3e0b846eb
|
Provenance
The following attestation bundles were made for pyidfm-0.0.3.tar.gz:
Publisher:
release.yml on RobinDavid/pyidfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyidfm-0.0.3.tar.gz -
Subject digest:
892b255ea523b9f45b68ec9a5d38c6d1af0939620e53d1918057f724ece0ceaa - Sigstore transparency entry: 1624426042
- Sigstore integration time:
-
Permalink:
RobinDavid/pyidfm@bc2980837a1e9d985bd9e65d923ce647dc7c200c -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/RobinDavid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bc2980837a1e9d985bd9e65d923ce647dc7c200c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyidfm-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pyidfm-0.0.3-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acff8b3768d1c989e437a7a361290b21bc189ff672b707edc1530b5a3922f7e7
|
|
| MD5 |
92ad839af2824bad39a3a583b233d521
|
|
| BLAKE2b-256 |
c571d700b22b342ad6bfa41105f2266ac93bc58994f3e845e1d59269d07b90c2
|
Provenance
The following attestation bundles were made for pyidfm-0.0.3-py3-none-any.whl:
Publisher:
release.yml on RobinDavid/pyidfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyidfm-0.0.3-py3-none-any.whl -
Subject digest:
acff8b3768d1c989e437a7a361290b21bc189ff672b707edc1530b5a3922f7e7 - Sigstore transparency entry: 1624426232
- Sigstore integration time:
-
Permalink:
RobinDavid/pyidfm@bc2980837a1e9d985bd9e65d923ce647dc7c200c -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/RobinDavid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bc2980837a1e9d985bd9e65d923ce647dc7c200c -
Trigger Event:
release
-
Statement type: