pitstop-cli 1.0.0__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.
- pitstop_cli-1.0.0/.github/workflows/ci.yml +41 -0
- pitstop_cli-1.0.0/.gitignore +12 -0
- pitstop_cli-1.0.0/CHANGELOG.md +273 -0
- pitstop_cli-1.0.0/LICENSE +21 -0
- pitstop_cli-1.0.0/PKG-INFO +170 -0
- pitstop_cli-1.0.0/README.md +119 -0
- pitstop_cli-1.0.0/pyproject.toml +53 -0
- pitstop_cli-1.0.0/skills/pitstop/SKILL.md +81 -0
- pitstop_cli-1.0.0/src/pitstop/__init__.py +3 -0
- pitstop_cli-1.0.0/src/pitstop/__main__.py +4 -0
- pitstop_cli-1.0.0/src/pitstop/chargers.py +281 -0
- pitstop_cli-1.0.0/src/pitstop/cli.py +418 -0
- pitstop_cli-1.0.0/src/pitstop/core.py +572 -0
- pitstop_cli-1.0.0/src/pitstop/cpo_tariffs.py +60 -0
- pitstop_cli-1.0.0/src/pitstop/geocoding.py +146 -0
- pitstop_cli-1.0.0/src/pitstop/mcp_server.py +264 -0
- pitstop_cli-1.0.0/src/pitstop/overpass.py +83 -0
- pitstop_cli-1.0.0/src/pitstop/version.py +1 -0
- pitstop_cli-1.0.0/tests/test_chargers.py +173 -0
- pitstop_cli-1.0.0/tests/test_core.py +375 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.10", "3.12"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python-version }}
|
|
19
|
+
- run: python -m pip install --upgrade pip
|
|
20
|
+
- run: pip install -e ".[dev]"
|
|
21
|
+
- run: pytest -q
|
|
22
|
+
|
|
23
|
+
mcp-import:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
- run: pip install -e ".[mcp]"
|
|
31
|
+
- run: python -c "import pitstop.mcp_server; print('mcp server imports OK')"
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
- run: pip install build
|
|
41
|
+
- run: python -m build
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project aims
|
|
5
|
+
to follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.0.0] - 2026-06-02
|
|
8
|
+
|
|
9
|
+
First public release. Nine months of iteration condensed:
|
|
10
|
+
|
|
11
|
+
- **Italian fuel prices** — MIMIT Osservaprezzi Carburanti, ~23.8k stations,
|
|
12
|
+
joined daily, four layers of data-quality defense (`--min-price` floor,
|
|
13
|
+
`--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule,
|
|
14
|
+
ISTAT-derived comune-coordinate validation). Cross-validated against
|
|
15
|
+
MIMIT's own published regional averages and spritpreise.it (South Tyrol)
|
|
16
|
+
— matches to within ~½ cent across all 21 regions.
|
|
17
|
+
- **EV charging** — OpenStreetMap via Overpass, with operator tariff-page
|
|
18
|
+
URLs attached per result (per-station €/kWh prices aren't in open data
|
|
19
|
+
yet; see v0.8.0 notes).
|
|
20
|
+
- **CLI + MCP server** — same core, two surfaces. Five MCP tools:
|
|
21
|
+
`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`,
|
|
22
|
+
`get_stats`.
|
|
23
|
+
- **Agent ergonomics** — multi-fuel queries, international comune names
|
|
24
|
+
(EN/FR/DE: Rome, Bozen, Mailand, Venise, …), navigation URLs,
|
|
25
|
+
GeoJSON output, structured Overpass errors.
|
|
26
|
+
- **MIT licensed**, Python ≥3.10, stdlib-only runtime (MCP server needs
|
|
27
|
+
the optional `[mcp]` extra). 38 tests, GitHub Actions CI.
|
|
28
|
+
|
|
29
|
+
### Added in 1.0.0 (vs 0.9.0)
|
|
30
|
+
- LICENSE (MIT).
|
|
31
|
+
- PyPI-ready packaging: classifiers, project URLs, license metadata.
|
|
32
|
+
- OpenClaw frontmatter on the agent skill (`metadata.openclaw.requires`
|
|
33
|
+
+ `install` hints for `uvx` and `pipx`) so the skill is publishable
|
|
34
|
+
to ClawHub-style registries.
|
|
35
|
+
- README intro rewritten for non-Italian audiences.
|
|
36
|
+
|
|
37
|
+
## [0.9.0] - 2026-06-02
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
- **Multi-fuel query support.** The `--fuel` flag now accepts a comma-separated
|
|
41
|
+
list of fuels (e.g. `--fuel "Benzina,Gasolio"`). This allows retrieving and
|
|
42
|
+
ranking multiple fuel types in a single request, which is much more efficient
|
|
43
|
+
for agentic interactions.
|
|
44
|
+
- **International Municipality Mapping.** Added a `BILINGUAL_MAP` in
|
|
45
|
+
`geocoding.py` that resolves common English, French, and German names for
|
|
46
|
+
major Italian cities (e.g. Rome/Rom/Naples/Mailand/Venise) to their Italian
|
|
47
|
+
equivalents in the dataset.
|
|
48
|
+
- **Improved Coordinate Resilience.** `query_stations` now prioritizes the
|
|
49
|
+
**calculated centroid** of all stations in a municipality (robust for
|
|
50
|
+
$N \ge 3$) over the external ISTAT reference coordinate. This makes the
|
|
51
|
+
`coordinate_suspect` flagging much more resilient to errors in the external
|
|
52
|
+
comune-coordinate file (e.g. the Bolzano center bug).
|
|
53
|
+
- **JSON Error Reporting for Overpass.** Fetch errors from the Overpass API
|
|
54
|
+
(EV chargers) are now captured and surfaced inside the JSON response envelope
|
|
55
|
+
under an `error` field. This allows callers to distinguish between "no
|
|
56
|
+
chargers found" and "service currently unavailable".
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
- `chargers.find_chargers` and `overpass.fetch_elements` now return a tuple
|
|
60
|
+
`(data, error)` to facilitate structured error reporting.
|
|
61
|
+
|
|
62
|
+
## [0.8.0] - 2026-06-01
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
- **EV operator tariff URLs.** Each charger result now carries a
|
|
66
|
+
`tariff_info_url` pointing to the operator's official tariff page (when the
|
|
67
|
+
operator is recognized). The CLI prints a footnote like
|
|
68
|
+
`5/5 stations have an operator tariff page`. New `cpo_tariffs.py` module
|
|
69
|
+
with a substring-matching registry covering the major Italian CPOs:
|
|
70
|
+
Alperia, Neogy, Enel X Way, Be Charge, Free To X, Ionity, Tesla,
|
|
71
|
+
Plenitude, Atlante, Repower, A2A, Edison, Acea, EVway, and others.
|
|
72
|
+
- MCP `find_chargers` tool description now instructs the agent to surface
|
|
73
|
+
`tariff_info_url` when the user asks about price instead of guessing.
|
|
74
|
+
|
|
75
|
+
### Why this isn't real per-kWh prices
|
|
76
|
+
The honest finding from a thorough investigation:
|
|
77
|
+
- **AFIR DATEX II** (since 14 Apr 2026) is a CPO→NAP *upload* channel — there
|
|
78
|
+
is no documented public consumer-query endpoint.
|
|
79
|
+
- **Italy's PUN** (piattaformaunicanazionale.it) is an ArcGIS-backed SPA with
|
|
80
|
+
no documented public REST API for tariffs.
|
|
81
|
+
- **Chargeprice** and **Eco-Movement** carry per-station tariffs but require
|
|
82
|
+
paid licenses.
|
|
83
|
+
- **OSM** has only `fee=yes/no` (already surfaced), not actual €/kWh.
|
|
84
|
+
|
|
85
|
+
So per-station tariffs are not openly machine-readable in Italy in mid-2026.
|
|
86
|
+
Surfacing the operator's own tariff page is the most useful + honest thing
|
|
87
|
+
the tool can do today. Revisit when AFIR data consumer-side matures.
|
|
88
|
+
|
|
89
|
+
## [0.7.0] - 2026-06-01
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
- **EV charging stations.** First step into the EV domain: a new `pitstop
|
|
93
|
+
chargers` CLI command and an MCP `find_chargers` tool backed by
|
|
94
|
+
OpenStreetMap via the **Overpass API** (open, no key required, ODbL-licensed
|
|
95
|
+
with attribution in output).
|
|
96
|
+
- Filter by `--operator`, `--socket` (plug-type substring), `--min-power` kW,
|
|
97
|
+
`--fast` (≥50 kW), `--ultra-fast` (≥150 kW), `--free`, `--public`. Center
|
|
98
|
+
the search on a comune (`--comune NAME`, resolved via the existing
|
|
99
|
+
comune-coords reference) or a coordinate (`--near "lat,lon"`).
|
|
100
|
+
- Per-charger output includes operator, plug types and counts, max kW, fee,
|
|
101
|
+
access, and distance.
|
|
102
|
+
- 7-day on-disk cache for Overpass results (charger metadata changes slowly).
|
|
103
|
+
|
|
104
|
+
### Why
|
|
105
|
+
EV charging was the genuinely-different next data domain on the roadmap.
|
|
106
|
+
Italy/EU don't have a single open per-station price feed yet (AFIR
|
|
107
|
+
NAP/DATEX II is maturing but uneven), so v0.7.0 focuses on **locations and
|
|
108
|
+
capabilities** — operator, plug types, max kW, fee, access — which is what
|
|
109
|
+
"where can I charge near X" needs. Pricing is the planned next layer.
|
|
110
|
+
|
|
111
|
+
### Notes
|
|
112
|
+
- Open Charge Map's API now requires a registered key (HTTP 403 without);
|
|
113
|
+
OSM Overpass is fully open and well-covered for EU chargers, so it's the
|
|
114
|
+
pragmatic choice for v0.7.0.
|
|
115
|
+
|
|
116
|
+
## [0.6.0] - 2026-05-30
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
- **Tukey IQR outlier rule** combined with the existing 15% deviation rule —
|
|
120
|
+
catches borderline misreports in tight markets that the percentage rule
|
|
121
|
+
alone misses. A price is now flagged `outlier` if it is more than 15% below
|
|
122
|
+
the (fuel, provincia) median **or** below the Tukey lower fence
|
|
123
|
+
(Q1 − 1.5·IQR).
|
|
124
|
+
- `--drop-outliers` CLI flag and `drop_outliers` MCP parameter that filters
|
|
125
|
+
any price flagged outlier. MCP `find_cheapest` defaults `drop_outliers=True`
|
|
126
|
+
for clean cheapest answers.
|
|
127
|
+
|
|
128
|
+
### Why
|
|
129
|
+
A user cross-checked v0.5.0's €1.787 "cheapest BZ Gasolio" (g.p. oil) against
|
|
130
|
+
[spritpreise.it](https://www.spritpreise.it/), a local South-Tyrol fuel
|
|
131
|
+
service. That station/price does not appear there and spritpreise's cheapest
|
|
132
|
+
is €1.989. Empirically only 1 of 250 BZ Gasolio prices in MIMIT falls below
|
|
133
|
+
€1.989 — the g.p. oil misreport. Its deviation is −14.9%, just under the 15%
|
|
134
|
+
percent rule. The Tukey fence (€1.949 for BZ Gasolio, IQR €0.080) catches it.
|
|
135
|
+
|
|
136
|
+
## [0.5.0] - 2026-05-30
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
- **Price-outlier detection.** Every price is annotated with `regional_median`
|
|
140
|
+
and `deviation_pct` against the median for its (fuel, provincia) — computed
|
|
141
|
+
from the dataset itself, no extra source. Prices more than 15% below their
|
|
142
|
+
regional median get an `outlier: true` flag. The CLI table marks outliers
|
|
143
|
+
with `?` and prints a footnote.
|
|
144
|
+
- `--max-deviation-pct N` on `pitstop stations` (and `max_deviation_pct` on the
|
|
145
|
+
MCP tools) to drop prices that fall too far below the local market — opt-in,
|
|
146
|
+
off by default to preserve fidelity.
|
|
147
|
+
|
|
148
|
+
### Why
|
|
149
|
+
Empirically, Q8 Verona at €1.638 (vs €2.06 VR-Gasolio median, −20.4%) and
|
|
150
|
+
ENI Rome at €1.639 (vs €2.07 RM-Gasolio median, −20.8%) are statistical
|
|
151
|
+
outliers — likely misreports. The signal cleanly separates them from real
|
|
152
|
+
discount stations (whose prices are typically ~5–7% below median).
|
|
153
|
+
|
|
154
|
+
## [0.4.0] - 2026-05-30
|
|
155
|
+
|
|
156
|
+
### Added
|
|
157
|
+
- **Second data source: Italian comune coordinates.** New `geocoding.py` module
|
|
158
|
+
fetches and caches an ISTAT-derived comune→(lat, lon) reference
|
|
159
|
+
(opendatasicilia/comuni-italiani) with 30-day cache and graceful fallback if
|
|
160
|
+
the upstream is unreachable. Achieves 97.5% comune-name match against MIMIT.
|
|
161
|
+
- Comune validation in `query_stations`:
|
|
162
|
+
- flags `coordinate_suspect` when a station's stored coord is more than 30 km
|
|
163
|
+
from its declared comune's **true** location — this catches single-station
|
|
164
|
+
comuni (the original Rasen case) that the self-contained centroid method
|
|
165
|
+
provably could not.
|
|
166
|
+
- in `--near`, also excludes stations whose declared comune is outside
|
|
167
|
+
`radius_km + 30 km` of the query point; "Agip Tankstelle Rasen" no longer
|
|
168
|
+
appears in `--near 46.498,11.354 --radius 6`.
|
|
169
|
+
- `--no-comune-validate` flag to skip the second source (offline/perf).
|
|
170
|
+
|
|
171
|
+
### Known limitations
|
|
172
|
+
- 2.5% of MIMIT comune strings don't match the reference (mostly garbage in the
|
|
173
|
+
comune field, recent comune mergers, minor spelling). The self-contained
|
|
174
|
+
centroid heuristic still applies to those.
|
|
175
|
+
- The upstream comune dataset has no explicit LICENSE in its repo, though the
|
|
176
|
+
underlying data is ISTAT-derived. `pitstop` runtime-fetches only and credits
|
|
177
|
+
the source — if pitstop ever goes public, prefer a Wikidata-bundled file.
|
|
178
|
+
|
|
179
|
+
## [0.3.0] - 2026-05-29
|
|
180
|
+
|
|
181
|
+
### Added
|
|
182
|
+
- `coordinate_suspect` flag on stations whose registry coordinate is outside the
|
|
183
|
+
Italy bounding box **or** more than 30 km from the median of their comune's
|
|
184
|
+
other stations. Flags ~1% of stations (211/23.8k). Surfaced in JSON output and
|
|
185
|
+
marked with `*` in the table. Advisory — not filtered by default.
|
|
186
|
+
- `--near` skips stations whose coordinates fall outside the Italy bounding box.
|
|
187
|
+
|
|
188
|
+
### Known limitations
|
|
189
|
+
- Single-station comuni (e.g. RASUN-ANTERSELVA, the original Rasen example)
|
|
190
|
+
**cannot** be validated by the comune-cluster method — there is no sibling
|
|
191
|
+
station to compare against. The robust fix for this class requires a second
|
|
192
|
+
data source such as an ISTAT comune-coordinates reference. Tracked as the next
|
|
193
|
+
step.
|
|
194
|
+
- A few comuni span large or split geographies (island groups, archipelagos), so
|
|
195
|
+
some flagged outliers are legitimately distant rather than mis-geocoded.
|
|
196
|
+
|
|
197
|
+
## [0.2.0] - 2026-05-29
|
|
198
|
+
|
|
199
|
+
### Added
|
|
200
|
+
- **Price freshness filtering.** `--fresh-within-days N` on `pitstop stations`
|
|
201
|
+
(and `max_age_days` on the MCP tools) drops prices whose `updated` timestamp is
|
|
202
|
+
older than N days. MCP `find_cheapest` defaults to 90 days so stale records
|
|
203
|
+
cannot win "cheapest".
|
|
204
|
+
- `UPDATED` column in the `pitstop stations` table so price recency is visible.
|
|
205
|
+
|
|
206
|
+
### Fixed
|
|
207
|
+
- A stale record could rank as cheapest: a 2023 "Gasolio Alpino" at €1.749 was
|
|
208
|
+
returned as the cheapest diesel near Bolzano even though that station's current
|
|
209
|
+
diesel is €2.115 (national self-service average ~€2.03 on 2026-05-29). The
|
|
210
|
+
freshness filter resolves this.
|
|
211
|
+
|
|
212
|
+
### Known limitations
|
|
213
|
+
- Some stations are mis-geocoded in the registry (e.g. a Val Pusteria station
|
|
214
|
+
placed ~5 km from Bolzano), so proximity results can include far-away stations.
|
|
215
|
+
Check each result's `comune`/`address`.
|
|
216
|
+
|
|
217
|
+
## [0.1.1] - 2026-05-29
|
|
218
|
+
|
|
219
|
+
### Fixed
|
|
220
|
+
- MCP `find_cheapest` now applies a **fuel-aware** default price floor instead of
|
|
221
|
+
a fixed `1.2`. The old default silently returned no results for cheaper fuels
|
|
222
|
+
like GPL (~€0.77). Petrol/diesel/methane keep the `1.2` placeholder floor; GPL
|
|
223
|
+
gets none. Pass `min_price >= 0` to override. Surfaced by an agent simulation.
|
|
224
|
+
|
|
225
|
+
## [0.1.0] - 2026-05-29
|
|
226
|
+
|
|
227
|
+
### Added
|
|
228
|
+
- `--min-price` floor on `pitstop stations` to drop placeholder/junk prices
|
|
229
|
+
(e.g. `1.000`) that otherwise pollute `--cheapest`.
|
|
230
|
+
- **MCP server** (`pitstop-mcp`, optional `[mcp]` extra) exposing `list_fuels`,
|
|
231
|
+
`find_stations`, and `find_cheapest` over the same core as agent tools.
|
|
232
|
+
- pytest test suite covering parsing, the registry+price join, geo distance,
|
|
233
|
+
and price filtering.
|
|
234
|
+
- GitHub Actions CI (tests on Python 3.10/3.12, MCP import check, wheel build).
|
|
235
|
+
|
|
236
|
+
### Changed
|
|
237
|
+
- Filtering and sorting moved into a shared `core.query_stations` /
|
|
238
|
+
`core.response_envelope` used by both the CLI and the MCP server.
|
|
239
|
+
|
|
240
|
+
## [0.0.1] - 2026-05-29
|
|
241
|
+
|
|
242
|
+
Initial release.
|
|
243
|
+
|
|
244
|
+
### Added
|
|
245
|
+
- `pitstop stations` — list and filter Italian fuel stations with their prices,
|
|
246
|
+
by `--comune`, `--provincia`, `--brand`, `--near "lat,lon"` + `--radius`,
|
|
247
|
+
`--fuel` (substring), `--self`/`--served`, with `--cheapest` and `--limit`.
|
|
248
|
+
- `pitstop fuels` — list the fuel-type names present in the dataset.
|
|
249
|
+
- `pitstop version` — print version metadata.
|
|
250
|
+
- JSON output (`--json`) with source/extraction-date provenance and a disclaimer.
|
|
251
|
+
- Local fetch + 24h cache of the MIMIT Osservaprezzi Carburanti station registry
|
|
252
|
+
and daily price file, joined on `idImpianto` (stdlib only, no dependencies).
|
|
253
|
+
- Agent skill at `skills/pitstop/SKILL.md`.
|
|
254
|
+
|
|
255
|
+
### Known limitations
|
|
256
|
+
- Daily data, not real-time; Italy only.
|
|
257
|
+
- Some operators report placeholder prices (e.g. `1.000`); `--cheapest` can
|
|
258
|
+
surface them. A sanity-floor is planned.
|
|
259
|
+
- `--fuel` is a substring match, so `Gasolio` also matches variants such as
|
|
260
|
+
`Gasolio Alpino`.
|
|
261
|
+
|
|
262
|
+
[1.0.0]: https://github.com/galjos/pitstop/releases/tag/v1.0.0
|
|
263
|
+
[0.9.0]: https://github.com/galjos/pitstop/releases/tag/v0.9.0
|
|
264
|
+
[0.8.0]: https://github.com/galjos/pitstop/releases/tag/v0.8.0
|
|
265
|
+
[0.7.0]: https://github.com/galjos/pitstop/releases/tag/v0.7.0
|
|
266
|
+
[0.6.0]: https://github.com/galjos/pitstop/releases/tag/v0.6.0
|
|
267
|
+
[0.5.0]: https://github.com/galjos/pitstop/releases/tag/v0.5.0
|
|
268
|
+
[0.4.0]: https://github.com/galjos/pitstop/releases/tag/v0.4.0
|
|
269
|
+
[0.3.0]: https://github.com/galjos/pitstop/releases/tag/v0.3.0
|
|
270
|
+
[0.2.0]: https://github.com/galjos/pitstop/releases/tag/v0.2.0
|
|
271
|
+
[0.1.1]: https://github.com/galjos/pitstop/releases/tag/v0.1.1
|
|
272
|
+
[0.1.0]: https://github.com/galjos/pitstop/releases/tag/v0.1.0
|
|
273
|
+
[0.0.1]: https://github.com/galjos/pitstop/releases/tag/v0.0.1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Josef M. Gallmetzer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pitstop-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: JSON-first CLI + MCP server for Italian fuel-station prices and EV charging — MIMIT, OpenStreetMap, ISTAT.
|
|
5
|
+
Project-URL: Homepage, https://github.com/galjos/pitstop
|
|
6
|
+
Project-URL: Repository, https://github.com/galjos/pitstop
|
|
7
|
+
Project-URL: Changelog, https://github.com/galjos/pitstop/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Issues, https://github.com/galjos/pitstop/issues
|
|
9
|
+
Author: Josef M. Gallmetzer
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 Josef M. Gallmetzer
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: agent,carburanti,charging,cli,ev,fuel,italy,llm,mcp,mimit,openstreetmap,prices
|
|
33
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
34
|
+
Classifier: Environment :: Console
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
37
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
38
|
+
Classifier: Operating System :: OS Independent
|
|
39
|
+
Classifier: Programming Language :: Python :: 3
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
44
|
+
Classifier: Topic :: Utilities
|
|
45
|
+
Requires-Python: >=3.10
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
48
|
+
Provides-Extra: mcp
|
|
49
|
+
Requires-Dist: mcp>=1.0; extra == 'mcp'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
# pitstop
|
|
53
|
+
|
|
54
|
+
A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
|
|
55
|
+
|
|
56
|
+
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap maps every EV charger in the country, but raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating between Italian comune names and the ones a user actually types. `pitstop` does all of that locally and returns a small, well-formed JSON envelope.
|
|
57
|
+
|
|
58
|
+
Built for questions like:
|
|
59
|
+
- *"What's the cheapest diesel near Rome right now?"* → `pitstop find_cheapest --fuel Gasolio --near 41.9,12.5`
|
|
60
|
+
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --comune Bozen --fast`
|
|
61
|
+
- *"Are these station prices statistically reliable?"* → every price carries a `regional_median`, `deviation_pct`, and `outlier` flag.
|
|
62
|
+
|
|
63
|
+
International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
|
|
64
|
+
|
|
65
|
+
## Disclaimer
|
|
66
|
+
|
|
67
|
+
Unofficial community project. Not affiliated with or endorsed by MIMIT. Fuel data belongs to MIMIT and is redistributed here under its open-data terms; `pitstop` always emits source and extraction-date provenance in its output.
|
|
68
|
+
|
|
69
|
+
## Data scope & freshness
|
|
70
|
+
|
|
71
|
+
- **Source:** MIMIT _Osservaprezzi Carburanti_ open data — a station registry (`anagrafica`, ~23.8k active stations) and a daily practiced-price file, joined on `idImpianto`.
|
|
72
|
+
- **Freshness:** prices reflect values reported by operators **as of ~08:00 the day before** the published extraction date. This is **daily, not real-time.**
|
|
73
|
+
- **Coverage:** Italy only (by design, for now).
|
|
74
|
+
- **Known caveats:**
|
|
75
|
+
- Some operators report placeholder values (e.g. `1.000`); use `--min-price` (e.g. `1.2`) to drop them.
|
|
76
|
+
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field.
|
|
77
|
+
- Some stations are **mis-geocoded** in the registry. As of v0.4.0 `pitstop` joins a second data source (ISTAT-derived comune coordinates from [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani), 97.5% match) to validate each station's coordinate against its declared comune's *true* location. Stations >30 km off are flagged `coordinate_suspect` (`*` in the table), and `--near` excludes stations whose declared comune is geographically too far from the query point — even single-station comuni like RASUN-ANTERSELVA. Pass `--no-comune-validate` to disable.
|
|
78
|
+
|
|
79
|
+
## Install
|
|
80
|
+
|
|
81
|
+
Requires Python ≥ 3.10. No third-party runtime dependencies.
|
|
82
|
+
|
|
83
|
+
From PyPI (the package is published as **`pitstop-cli`**; the CLI binary is `pitstop`):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pipx install pitstop-cli # or
|
|
87
|
+
uv tool install pitstop-cli # or just run on-demand:
|
|
88
|
+
uvx --from pitstop-cli pitstop --help
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For the MCP server (optional extra):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pipx install "pitstop-cli[mcp]"
|
|
95
|
+
pitstop-mcp # stdio MCP server
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Run from a source checkout during development:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
PYTHONPATH=src python3 -m pitstop --help
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Usage
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Cheapest *fresh* diesel in a municipality (skip placeholder + stale prices)
|
|
108
|
+
pitstop stations --comune ROMA --fuel Gasolio --cheapest --min-price 1.2 --fresh-within-days 90 --limit 5
|
|
109
|
+
|
|
110
|
+
# Self-service petrol within 5 km of a coordinate, as JSON
|
|
111
|
+
pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
|
|
112
|
+
|
|
113
|
+
# Discover the fuel-type names present in the data
|
|
114
|
+
pitstop fuels
|
|
115
|
+
|
|
116
|
+
# Fast EV chargers (≥50 kW) within 5 km of Bolzano
|
|
117
|
+
pitstop chargers --near 46.498,11.354 --radius 5 --fast --json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to any data command.
|
|
121
|
+
|
|
122
|
+
Every returned price carries `regional_median`, `deviation_pct`, and an `outlier` flag (true when >15% below the local median **or** below the Tukey lower fence Q1−1.5·IQR — the Tukey rule catches misreports in tight markets that the percent rule alone misses). Pass `--drop-outliers` to remove flagged prices entirely.
|
|
123
|
+
|
|
124
|
+
## MCP server
|
|
125
|
+
|
|
126
|
+
For agents that speak MCP, the same data is exposed as tools (`list_fuels`, `find_stations`, `find_cheapest`) over the shared core:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install "pitstop-cli[mcp]" # or: uv tool install "pitstop-cli[mcp]"
|
|
130
|
+
pitstop-mcp # stdio MCP server
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Example client config entry:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{ "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Development
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
pip install -e ".[dev]"
|
|
143
|
+
pytest -q
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Automation contract
|
|
147
|
+
|
|
148
|
+
- `stdout` is command output; `stderr` is diagnostics.
|
|
149
|
+
- `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `stations[]`, and `disclaimer`.
|
|
150
|
+
- Exit codes: `0` success, `1` runtime error, `2` usage error.
|
|
151
|
+
- Source files are cached (default 24h) under `$XDG_CACHE_HOME/pitstop`; use `--refresh` to bypass.
|
|
152
|
+
- Non-interactive; no hidden browser state or scraping.
|
|
153
|
+
|
|
154
|
+
## Status & roadmap
|
|
155
|
+
|
|
156
|
+
v0.9.0 — fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, Claude skill, tests, CI.
|
|
157
|
+
|
|
158
|
+
Planned, roughly in order:
|
|
159
|
+
- **EV charging** (locations via Open Charge Map; prices via the AFIR National Access Point / DATEX II as that data matures);
|
|
160
|
+
- additional countries behind a per-country source adapter (e.g. Germany Tankerkönig, France/Spain official feeds).
|
|
161
|
+
|
|
162
|
+
## Data sources & attributions
|
|
163
|
+
|
|
164
|
+
- Fuel stations and prices: **MIMIT Osservaprezzi Carburanti** open data.
|
|
165
|
+
- Comune coordinates (validation): **opendatasicilia/comuni-italiani** (ISTAT-derived).
|
|
166
|
+
- EV charging stations: **OpenStreetMap** via the Overpass API (© OpenStreetMap contributors, ODbL).
|
|
167
|
+
|
|
168
|
+
## Links
|
|
169
|
+
|
|
170
|
+
- MIMIT fuel open data: https://www.mimit.gov.it/it/open-data/elenco-dataset/carburanti-prezzi-praticati-e-anagrafica-degli-impianti
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# pitstop
|
|
2
|
+
|
|
3
|
+
A JSON-first CLI and MCP server for **Italian fuel-station prices** and **EV charging stations**, designed for AI agents, scripts, and humans.
|
|
4
|
+
|
|
5
|
+
Italy publishes per-station fuel prices daily (MIMIT *Osservaprezzi Carburanti* open data) and OpenStreetMap maps every EV charger in the country, but raw access means downloading multi-megabyte CSVs, joining files, sorting through misreports, and translating between Italian comune names and the ones a user actually types. `pitstop` does all of that locally and returns a small, well-formed JSON envelope.
|
|
6
|
+
|
|
7
|
+
Built for questions like:
|
|
8
|
+
- *"What's the cheapest diesel near Rome right now?"* → `pitstop find_cheapest --fuel Gasolio --near 41.9,12.5`
|
|
9
|
+
- *"Where can I fast-charge my EV in Bolzano?"* → `pitstop chargers --comune Bozen --fast`
|
|
10
|
+
- *"Are these station prices statistically reliable?"* → every price carries a `regional_median`, `deviation_pct`, and `outlier` flag.
|
|
11
|
+
|
|
12
|
+
International city names work out of the box (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, …).
|
|
13
|
+
|
|
14
|
+
## Disclaimer
|
|
15
|
+
|
|
16
|
+
Unofficial community project. Not affiliated with or endorsed by MIMIT. Fuel data belongs to MIMIT and is redistributed here under its open-data terms; `pitstop` always emits source and extraction-date provenance in its output.
|
|
17
|
+
|
|
18
|
+
## Data scope & freshness
|
|
19
|
+
|
|
20
|
+
- **Source:** MIMIT _Osservaprezzi Carburanti_ open data — a station registry (`anagrafica`, ~23.8k active stations) and a daily practiced-price file, joined on `idImpianto`.
|
|
21
|
+
- **Freshness:** prices reflect values reported by operators **as of ~08:00 the day before** the published extraction date. This is **daily, not real-time.**
|
|
22
|
+
- **Coverage:** Italy only (by design, for now).
|
|
23
|
+
- **Known caveats:**
|
|
24
|
+
- Some operators report placeholder values (e.g. `1.000`); use `--min-price` (e.g. `1.2`) to drop them.
|
|
25
|
+
- Some price records are **stale** (a few were last updated years ago); use `--fresh-within-days` and check the `UPDATED` column / `updated` field.
|
|
26
|
+
- Some stations are **mis-geocoded** in the registry. As of v0.4.0 `pitstop` joins a second data source (ISTAT-derived comune coordinates from [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani), 97.5% match) to validate each station's coordinate against its declared comune's *true* location. Stations >30 km off are flagged `coordinate_suspect` (`*` in the table), and `--near` excludes stations whose declared comune is geographically too far from the query point — even single-station comuni like RASUN-ANTERSELVA. Pass `--no-comune-validate` to disable.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
Requires Python ≥ 3.10. No third-party runtime dependencies.
|
|
31
|
+
|
|
32
|
+
From PyPI (the package is published as **`pitstop-cli`**; the CLI binary is `pitstop`):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pipx install pitstop-cli # or
|
|
36
|
+
uv tool install pitstop-cli # or just run on-demand:
|
|
37
|
+
uvx --from pitstop-cli pitstop --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For the MCP server (optional extra):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pipx install "pitstop-cli[mcp]"
|
|
44
|
+
pitstop-mcp # stdio MCP server
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Run from a source checkout during development:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
PYTHONPATH=src python3 -m pitstop --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Cheapest *fresh* diesel in a municipality (skip placeholder + stale prices)
|
|
57
|
+
pitstop stations --comune ROMA --fuel Gasolio --cheapest --min-price 1.2 --fresh-within-days 90 --limit 5
|
|
58
|
+
|
|
59
|
+
# Self-service petrol within 5 km of a coordinate, as JSON
|
|
60
|
+
pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
|
|
61
|
+
|
|
62
|
+
# Discover the fuel-type names present in the data
|
|
63
|
+
pitstop fuels
|
|
64
|
+
|
|
65
|
+
# Fast EV chargers (≥50 kW) within 5 km of Bolzano
|
|
66
|
+
pitstop chargers --near 46.498,11.354 --radius 5 --fast --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`stations` flags: `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius`, `--fuel` (substring, case-insensitive), `--self`, `--served`, `--cheapest` (needs `--fuel`), `--min-price` (drop values below a floor; e.g. `1.2` to skip placeholders), `--fresh-within-days` (drop stale prices), `--max-deviation-pct` (drop prices more than N% below their fuel's provincial median — catches misreports), `--no-comune-validate`, `--limit`, `--json`. Loading flags (`--refresh`, `--max-age`, `--timeout`) apply to any data command.
|
|
70
|
+
|
|
71
|
+
Every returned price carries `regional_median`, `deviation_pct`, and an `outlier` flag (true when >15% below the local median **or** below the Tukey lower fence Q1−1.5·IQR — the Tukey rule catches misreports in tight markets that the percent rule alone misses). Pass `--drop-outliers` to remove flagged prices entirely.
|
|
72
|
+
|
|
73
|
+
## MCP server
|
|
74
|
+
|
|
75
|
+
For agents that speak MCP, the same data is exposed as tools (`list_fuels`, `find_stations`, `find_cheapest`) over the shared core:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install "pitstop-cli[mcp]" # or: uv tool install "pitstop-cli[mcp]"
|
|
79
|
+
pitstop-mcp # stdio MCP server
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Example client config entry:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install -e ".[dev]"
|
|
92
|
+
pytest -q
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Automation contract
|
|
96
|
+
|
|
97
|
+
- `stdout` is command output; `stderr` is diagnostics.
|
|
98
|
+
- `--json` emits a stable object with `source`, `*_extraction_date`, `generated_at`, `query`, `count`, `stations[]`, and `disclaimer`.
|
|
99
|
+
- Exit codes: `0` success, `1` runtime error, `2` usage error.
|
|
100
|
+
- Source files are cached (default 24h) under `$XDG_CACHE_HOME/pitstop`; use `--refresh` to bypass.
|
|
101
|
+
- Non-interactive; no hidden browser state or scraping.
|
|
102
|
+
|
|
103
|
+
## Status & roadmap
|
|
104
|
+
|
|
105
|
+
v0.9.0 — fuel-price core (registry+price join, filters, proximity, cheapest, `--min-price` floor, `--fresh-within-days` freshness, combined 15% + Tukey IQR outlier rule, ISTAT comune-coordinate validation, JSON) + **EV charging stations via OSM Overpass** (operator, plug types, max kW, fee, access — `pitstop chargers`) + **operator tariff-page URLs** attached to each EV result. Includes **multi-fuel query support**, **international municipality mapping** (EN/FR/DE), **macro price statistics** (`pitstop stats`), and **navigation/GeoJSON support**. MCP server, Claude skill, tests, CI.
|
|
106
|
+
|
|
107
|
+
Planned, roughly in order:
|
|
108
|
+
- **EV charging** (locations via Open Charge Map; prices via the AFIR National Access Point / DATEX II as that data matures);
|
|
109
|
+
- additional countries behind a per-country source adapter (e.g. Germany Tankerkönig, France/Spain official feeds).
|
|
110
|
+
|
|
111
|
+
## Data sources & attributions
|
|
112
|
+
|
|
113
|
+
- Fuel stations and prices: **MIMIT Osservaprezzi Carburanti** open data.
|
|
114
|
+
- Comune coordinates (validation): **opendatasicilia/comuni-italiani** (ISTAT-derived).
|
|
115
|
+
- EV charging stations: **OpenStreetMap** via the Overpass API (© OpenStreetMap contributors, ODbL).
|
|
116
|
+
|
|
117
|
+
## Links
|
|
118
|
+
|
|
119
|
+
- MIMIT fuel open data: https://www.mimit.gov.it/it/open-data/elenco-dataset/carburanti-prezzi-praticati-e-anagrafica-degli-impianti
|