pitstop-cli 1.2.0__tar.gz → 1.4.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.
Files changed (43) hide show
  1. pitstop_cli-1.4.0/.github/dependabot.yml +31 -0
  2. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/.github/workflows/ci.yml +23 -13
  3. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/.github/workflows/release.yml +48 -5
  4. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/.github/workflows/upstream-smoke.yml +88 -6
  5. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/.gitignore +0 -1
  6. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/CHANGELOG.md +43 -0
  7. pitstop_cli-1.4.0/PKG-INFO +155 -0
  8. pitstop_cli-1.4.0/README.md +103 -0
  9. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/pyproject.toml +6 -5
  10. pitstop_cli-1.4.0/scripts/geo-acceptance.sh +136 -0
  11. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/scripts/smoke-installed.py +28 -5
  12. pitstop_cli-1.4.0/skills/pitstop/SKILL.md +66 -0
  13. pitstop_cli-1.4.0/src/pitstop/cache.py +63 -0
  14. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/chargers.py +36 -15
  15. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/cli.py +83 -11
  16. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/core.py +19 -8
  17. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/geocoding.py +6 -4
  18. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/mcp_server.py +51 -50
  19. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/overpass.py +50 -38
  20. pitstop_cli-1.4.0/src/pitstop/version.py +1 -0
  21. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/tests/test_chargers.py +45 -0
  22. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/tests/test_core.py +33 -0
  23. pitstop_cli-1.4.0/tests/test_retry.py +61 -0
  24. pitstop_cli-1.4.0/uv.lock +1029 -0
  25. pitstop_cli-1.2.0/PKG-INFO +0 -193
  26. pitstop_cli-1.2.0/README.md +0 -141
  27. pitstop_cli-1.2.0/skills/pitstop/SKILL.md +0 -93
  28. pitstop_cli-1.2.0/src/pitstop/cache.py +0 -36
  29. pitstop_cli-1.2.0/src/pitstop/version.py +0 -1
  30. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/LICENSE +0 -0
  31. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/evals/agent/README.md +0 -0
  32. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/evals/agent/recipes.json +0 -0
  33. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/evals/agent/results/.gitkeep +0 -0
  34. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/evals/agent/tasks.json +0 -0
  35. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/scripts/run-agent-evals.sh +0 -0
  36. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/__init__.py +0 -0
  37. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/__main__.py +0 -0
  38. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/cpo_tariffs.py +0 -0
  39. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/results.py +0 -0
  40. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/src/pitstop/validation.py +0 -0
  41. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/tests/test_geocoding.py +0 -0
  42. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/tests/test_query_reuse.py +0 -0
  43. {pitstop_cli-1.2.0 → pitstop_cli-1.4.0}/tests/test_validation.py +0 -0
@@ -0,0 +1,31 @@
1
+ version: 2
2
+
3
+ # The MCP SDK and pydantic move fast enough to break an install between two
4
+ # scheduled canary runs: pydantic 2.12 dropped a private symbol mcp 1.12 imports.
5
+ # Weekly PRs surface that as a reviewable change instead of a red run two months
6
+ # later. They also keep the repository active, which is what stops GitHub from
7
+ # disabling the scheduled workflows in this private repo after 60 idle days.
8
+ updates:
9
+ - package-ecosystem: pip
10
+ directory: "/"
11
+ schedule:
12
+ interval: weekly
13
+ day: monday
14
+ open-pull-requests-limit: 5
15
+ commit-message:
16
+ prefix: "deps"
17
+ groups:
18
+ # One PR per ecosystem for the routine churn; majors stay separate so they
19
+ # get read on their own.
20
+ minor-and-patch:
21
+ patterns: ["*"]
22
+ update-types: ["minor", "patch"]
23
+
24
+ - package-ecosystem: github-actions
25
+ directory: "/"
26
+ schedule:
27
+ interval: weekly
28
+ day: monday
29
+ open-pull-requests-limit: 3
30
+ commit-message:
31
+ prefix: "ci"
@@ -12,34 +12,44 @@ jobs:
12
12
  matrix:
13
13
  python-version: ["3.10", "3.12"]
14
14
  steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-python@v5
15
+ - uses: actions/checkout@v7
16
+ - uses: astral-sh/setup-uv@v10.4.0
17
17
  with:
18
18
  python-version: ${{ matrix.python-version }}
19
- - run: python -m pip install --upgrade pip
20
- - run: pip install -e ".[dev]"
21
- - run: pytest -q
19
+ # The test matrix installs the locked set, so green means a reproducible
20
+ # dependency state; Dependabot PRs are where a bump gets reviewed. The mcp
21
+ # floor job below stays on pip because it deliberately overrides mcp.
22
+ - run: uv sync --locked --extra dev
23
+ - run: uv run pytest -q
22
24
 
23
25
  mcp-protocol:
24
26
  runs-on: ubuntu-latest
25
27
  strategy:
26
28
  matrix:
27
- mcp-requirement: ["mcp==1.12.0", "mcp<2"]
29
+ mcp-requirement: ["mcp==1.12.0", "mcp>=2"]
30
+ include:
31
+ # mcp 1.12 imports pydantic's private eval_type_backport, which pydantic
32
+ # 2.12 removed, so `import mcp` fails outright on a current pydantic.
33
+ # Pin the newest pydantic the minimum SDK can import: this job exists to
34
+ # test our floor, not to rediscover mcp 1.12's own incompatibility.
35
+ - mcp-requirement: "mcp==1.12.0"
36
+ pydantic-constraint: "pydantic<2.12"
28
37
  steps:
29
- - uses: actions/checkout@v4
30
- - uses: actions/setup-python@v5
38
+ - uses: actions/checkout@v7
39
+ - uses: actions/setup-python@v7
31
40
  with:
32
41
  python-version: "3.12"
33
- - run: pip install ".[mcp]" "$MCP_REQUIREMENT"
42
+ - run: pip install ".[mcp]" "$MCP_REQUIREMENT" $PYDANTIC_CONSTRAINT
34
43
  env:
35
44
  MCP_REQUIREMENT: ${{ matrix.mcp-requirement }}
45
+ PYDANTIC_CONSTRAINT: ${{ matrix.pydantic-constraint }}
36
46
  - run: python scripts/smoke-installed.py
37
47
 
38
48
  build:
39
49
  runs-on: ubuntu-latest
40
50
  steps:
41
- - uses: actions/checkout@v4
42
- - uses: actions/setup-python@v5
51
+ - uses: actions/checkout@v7
52
+ - uses: actions/setup-python@v7
43
53
  with:
44
54
  python-version: "3.12"
45
55
  - run: pip install build
@@ -53,8 +63,8 @@ jobs:
53
63
  agent-evals:
54
64
  runs-on: ubuntu-latest
55
65
  steps:
56
- - uses: actions/checkout@v4
57
- - uses: actions/setup-python@v5
66
+ - uses: actions/checkout@v7
67
+ - uses: actions/setup-python@v7
58
68
  with:
59
69
  python-version: "3.12"
60
70
  - run: pip install -e .
@@ -11,6 +11,14 @@ on:
11
11
  required: true
12
12
  type: string
13
13
 
14
+ # One release per tag at a time. Pushing a tag twice used to start two runs; the
15
+ # second could not resolve the tag and published an invisible untagged draft
16
+ # (v1.3.0, 2026-09-22). Serialise instead of cancelling, so a publish in flight
17
+ # is never cut in half.
18
+ concurrency:
19
+ group: release-${{ github.event.inputs.version || github.ref_name }}
20
+ cancel-in-progress: false
21
+
14
22
  permissions:
15
23
  contents: write
16
24
  id-token: write
@@ -23,11 +31,11 @@ jobs:
23
31
  name: Build distributions
24
32
  runs-on: ubuntu-latest
25
33
  steps:
26
- - uses: actions/checkout@v4
34
+ - uses: actions/checkout@v7
27
35
  with:
28
36
  ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.version) || github.ref }}
29
37
 
30
- - uses: actions/setup-python@v5
38
+ - uses: actions/setup-python@v7
31
39
  with:
32
40
  python-version: "3.12"
33
41
 
@@ -63,7 +71,17 @@ jobs:
63
71
  runs-on: ubuntu-latest
64
72
  needs: build
65
73
  steps:
66
- - uses: actions/download-artifact@v4
74
+ # gh resolves the release tag from the local repository. Without a checkout
75
+ # it cannot, and `gh release create` then publishes an *untagged draft*:
76
+ # invisible to the releases list and to /releases/tags/<tag>, so the tag
77
+ # looks released while users see the previous version. v1.3.0 shipped that
78
+ # way on 2026-09-22. Checking out the tag keeps the release attached to it.
79
+ - uses: actions/checkout@v7
80
+ with:
81
+ ref: refs/tags/${{ env.RELEASE_TAG }}
82
+ fetch-depth: 0
83
+
84
+ - uses: actions/download-artifact@v8
67
85
  with:
68
86
  name: pitstop-cli-dist
69
87
  path: dist
@@ -77,10 +95,13 @@ jobs:
77
95
  GH_TOKEN: ${{ github.token }}
78
96
  run: |
79
97
  if gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
98
+ # --draft=false also rescues a release left as a draft by an earlier
99
+ # run, which is otherwise invisible to users forever.
80
100
  gh release edit "$VERSION" \
81
101
  --repo "$GITHUB_REPOSITORY" \
82
102
  --title "$VERSION" \
83
- --notes "Automated pitstop-cli release for $VERSION."
103
+ --notes "Automated pitstop-cli release for $VERSION." \
104
+ --draft=false
84
105
  gh release upload "$VERSION" dist/* \
85
106
  --repo "$GITHUB_REPOSITORY" \
86
107
  --clobber
@@ -92,13 +113,35 @@ jobs:
92
113
  --verify-tag
93
114
  fi
94
115
 
116
+ - name: Verify the release is published on its tag
117
+ env:
118
+ GH_TOKEN: ${{ github.token }}
119
+ run: |
120
+ gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" \
121
+ --json tagName,isDraft,url,assets > release.json
122
+ python3 - <<'PY'
123
+ import json
124
+ import os
125
+
126
+ with open("release.json", encoding="utf-8") as fh:
127
+ release = json.load(fh)
128
+
129
+ # A draft or an "untagged-" attachment means the tag was never resolved:
130
+ # the release exists, but no user and no tag URL can reach it.
131
+ assert release["tagName"] == os.environ["VERSION"], release
132
+ assert not release["isDraft"], f"release is still a draft: {release['url']}"
133
+ assert "untagged-" not in release["url"], f"release is not attached to a tag: {release['url']}"
134
+ assert len(release["assets"]) >= 2, release["assets"]
135
+ print(f"published {release['tagName']} with {len(release['assets'])} asset(s): {release['url']}")
136
+ PY
137
+
95
138
  publish-pypi:
96
139
  name: Publish PyPI package
97
140
  runs-on: ubuntu-latest
98
141
  needs: build
99
142
  environment: pypi
100
143
  steps:
101
- - uses: actions/download-artifact@v4
144
+ - uses: actions/download-artifact@v8
102
145
  with:
103
146
  name: pitstop-cli-dist
104
147
  path: dist
@@ -1,10 +1,13 @@
1
1
  name: Upstream smoke
2
2
 
3
3
  # Weekly canary over the live upstreams. A red run must mean "pitstop is broken",
4
- # so nothing the maintainer cannot act on may turn it red. MIMIT failures are
5
- # therefore hard failures; Overpass is a free community endpoint where transient
6
- # 5xx is normal operation, so it is retried and then downgraded to a warning —
7
- # but pitstop's *handling* of that failure is still asserted on every run.
4
+ # so nothing the maintainer cannot act on may turn it red. MIMIT *data* failures
5
+ # are therefore hard failures; MIMIT being unreachable from the runner at all is
6
+ # not a pitstop defect, so it is probed up front, reported as a warning with the
7
+ # data assertions skipped, and pitstop's honest failure envelope is asserted
8
+ # instead. Overpass is a free community endpoint where transient 5xx is normal
9
+ # operation, so it is retried and then downgraded to a warning — but pitstop's
10
+ # *handling* of that failure is still asserted on every run.
8
11
 
9
12
  on:
10
13
  schedule:
@@ -20,9 +23,9 @@ jobs:
20
23
  runs-on: ubuntu-latest
21
24
  timeout-minutes: 15
22
25
  steps:
23
- - uses: actions/checkout@v4
26
+ - uses: actions/checkout@v7
24
27
 
25
- - uses: actions/setup-python@v5
28
+ - uses: actions/setup-python@v7
26
29
  with:
27
30
  python-version: "3.12"
28
31
 
@@ -30,7 +33,49 @@ jobs:
30
33
 
31
34
  - run: pip install -e ".[mcp]"
32
35
 
36
+ - name: Probe MIMIT reachability
37
+ run: |
38
+ # Two 20 s attempts instead of pitstop's bounded-retry ladder: a blocked
39
+ # or blackholed route must not eat the job budget (seven consecutive
40
+ # runs spent 7 minutes here from 2026-10-12 on). The probe decides
41
+ # whether the data assertions run; if the probe succeeds and pitstop
42
+ # still cannot fetch, that is a pitstop failure and the job goes red.
43
+ if curl -fsS --max-time 20 --retry 1 --retry-delay 5 \
44
+ -o /dev/null \
45
+ https://www.mimit.gov.it/images/exportCSV/prezzo_alle_8.csv; then
46
+ echo "MIMIT_REACHABLE=true" >> "$GITHUB_ENV"
47
+ echo "MIMIT answered the probe from this runner."
48
+ else
49
+ echo "MIMIT_REACHABLE=false" >> "$GITHUB_ENV"
50
+ echo "::warning title=MIMIT unreachable from this runner::curl could not download the MIMIT price CSV (2 attempts, 20 s each). The MIMIT data assertions are skipped and pitstop's failure envelope is asserted instead; this is runner egress or an upstream outage, not a pitstop defect."
51
+ {
52
+ echo "### MIMIT unreachable from this runner"
53
+ echo
54
+ echo "The canary could not download \`prezzo_alle_8.csv\` (2 attempts, 20 s each)."
55
+ echo "MIMIT fuel-price, freshness, schema and statistics assertions were **skipped**, so this run does not certify MIMIT behaviour."
56
+ echo "pitstop's failure envelope was still asserted. Re-run later or from another network to restore coverage."
57
+ } >> "$GITHUB_STEP_SUMMARY"
58
+ fi
59
+
60
+ - name: Check MIMIT outage handling
61
+ if: env.MIMIT_REACHABLE != 'true'
62
+ run: |
63
+ # Degraded upstream, but pitstop must still fail honestly: a non-zero
64
+ # exit and a transport error on stderr, never a fabricated empty answer.
65
+ set +e
66
+ pitstop stations --comune ROMA --fuel Gasolio --limit 1 --timeout 10 \
67
+ --json > degraded.json 2> degraded.err
68
+ rc=$?
69
+ set -e
70
+ test "$rc" -ne 0 || { echo "pitstop exited 0 with MIMIT unreachable"; cat degraded.json; exit 1; }
71
+ grep -q "could not fetch source data" degraded.err \
72
+ || { echo "unexpected stderr from pitstop:"; cat degraded.err; exit 1; }
73
+ test ! -s degraded.json \
74
+ || { echo "pitstop wrote a payload it could not source:"; cat degraded.json; exit 1; }
75
+ echo "pitstop failed honestly while MIMIT was unreachable (exit $rc)"
76
+
33
77
  - name: Check fuel prices
78
+ if: env.MIMIT_REACHABLE == 'true'
34
79
  run: |
35
80
  pitstop stations --comune ROMA --fuel Gasolio --cheapest --min-price 1.2 --fresh-within-days 120 --drop-outliers --limit 3 --json > fuel.json
36
81
  python - <<'PY'
@@ -47,6 +92,7 @@ jobs:
47
92
  PY
48
93
 
49
94
  - name: Check MIMIT feed freshness
95
+ if: env.MIMIT_REACHABLE == 'true'
50
96
  run: |
51
97
  pitstop stations --comune ROMA --fuel Gasolio --limit 1 --json > freshness.json
52
98
  python - <<'PY'
@@ -91,6 +137,7 @@ jobs:
91
137
  PY
92
138
 
93
139
  - name: Check MIMIT dataset schema
140
+ if: env.MIMIT_REACHABLE == 'true'
94
141
  run: |
95
142
  pitstop stations --limit 0 --json > all.json
96
143
  python - <<'PY'
@@ -190,6 +237,7 @@ jobs:
190
237
  PY
191
238
 
192
239
  - name: Check price statistics
240
+ if: env.MIMIT_REACHABLE == 'true'
193
241
  run: |
194
242
  pitstop stats --fuel Gasolio --json > stats.json
195
243
  python - <<'PY'
@@ -280,6 +328,40 @@ jobs:
280
328
  exit "$rc"
281
329
 
282
330
  - name: Run live agent smoke evals
331
+ if: env.MIMIT_REACHABLE == 'true'
283
332
  run: scripts/run-agent-evals.sh
284
333
  env:
285
334
  PITSTOP_EVAL_BIN: pitstop
335
+
336
+ - name: Run geo acceptance
337
+ run: scripts/geo-acceptance.sh
338
+ env:
339
+ PITSTOP_GEO_BIN: pitstop
340
+
341
+ - name: Check CPO tariff links (non-blocking)
342
+ run: |
343
+ python - <<'PY'
344
+ import urllib.error
345
+ import urllib.request
346
+ from pitstop import cpo_tariffs
347
+ from pitstop.version import __version__
348
+
349
+ headers = {"User-Agent": f"pitstop/{__version__} (https://github.com/galjos/pitstop-cli)"}
350
+ broken = []
351
+ for url in sorted(set(cpo_tariffs.TARIFF_URLS.values())):
352
+ req = urllib.request.Request(url, headers=headers, method="HEAD")
353
+ try:
354
+ with urllib.request.urlopen(req, timeout=15):
355
+ pass
356
+ except urllib.error.HTTPError as e:
357
+ if e.code in (403, 405):
358
+ continue # bot protection or HEAD disallowed; not a 404
359
+ if e.code == 404 or e.code == 410:
360
+ broken.append(f"{e.code} {url}")
361
+ except (urllib.error.URLError, OSError):
362
+ pass
363
+ if broken:
364
+ print("::warning title=Broken CPO tariff URLs::" + ", ".join(broken))
365
+ else:
366
+ print("OK: no 404/410 CPO tariff URLs detected")
367
+ PY
@@ -11,4 +11,3 @@ venv/
11
11
  .mypy_cache/
12
12
  .coverage
13
13
  .DS_Store
14
- uv.lock
@@ -4,6 +4,49 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project aims
5
5
  to follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.4.0] - 2026-11-29
8
+
9
+ ### Added
10
+
11
+ - `--exact-fuel` / `exact_fuel` flag to match fuel names exactly instead of substring
12
+ (excludes blends like `Gasolio Premium` when comparing `Gasolio`).
13
+ - `pitstop doctor` command (`--no-network`, `--json`, `--timeout`) to inspect cache
14
+ health and upstream reachability.
15
+ - CLI aliases matching MCP parameter names (`--radius-km`, `--max-age-days`,
16
+ `--min-power-kw`, `--free-only`, `--public-only`).
17
+ - `provincia`, `brand`, `served_only`, and `exact_fuel` parameters on MCP
18
+ `find_cheapest`.
19
+ - Overpass mirror fallback (`overpass.kumi.systems`) and `PITSTOP_OVERPASS_URL`
20
+ override.
21
+ - Weekly non-blocking CPO tariff URL 404/410 check in the upstream smoke workflow.
22
+
23
+ ### Fixed
24
+
25
+ - `--cheapest --near` now breaks equal-price ties by `distance_km` (then municipality
26
+ and name) instead of keeping arbitrary insertion order.
27
+ - Combined `--socket` + `--min-power` / `--fast` now checks power on the matching
28
+ socket instead of the station maximum.
29
+ - Charger parser skips `socket:<type>=0` / `no` tags and reads standalone
30
+ `socket:<type>:output` tags; removed unused `_DC_FAST_TYPES`.
31
+ - Versioned `User-Agent` across MIMIT and comune-reference downloads.
32
+ - Tightened `SKILL.md`, `README.md`, and MCP tool descriptions.
33
+
34
+ ## [1.3.0] - 2026-09-22
35
+
36
+ ### Added
37
+
38
+ - MCP server works with SDK 1.12+ and 2.x through a version shim; the `mcp<2`
39
+ pin is lifted and CI covers both majors.
40
+ - Weekly geographic acceptance checks for municipality centers and duplicate
41
+ names, with upstream outages reported distinctly from location failures.
42
+ - Bounded retries with backoff for MIMIT, comune-reference, and Overpass
43
+ downloads.
44
+
45
+ ### Fixed
46
+
47
+ - Skill documents every flag, the multi-fuel `--cheapest` rule, and the
48
+ CLI-to-MCP parameter name map.
49
+
7
50
  ## [1.2.0] - 2026-09-10
8
51
 
9
52
  ### Added
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.5
2
+ Name: pitstop-cli
3
+ Version: 1.4.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-cli
6
+ Project-URL: Repository, https://github.com/galjos/pitstop-cli
7
+ Project-URL: Changelog, https://github.com/galjos/pitstop-cli/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/galjos/pitstop-cli/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: mcp>=1.12; extra == 'dev'
48
+ Requires-Dist: pytest>=7; extra == 'dev'
49
+ Provides-Extra: mcp
50
+ Requires-Dist: mcp>=1.12; extra == 'mcp'
51
+ Description-Content-Type: text/markdown
52
+
53
+ # pitstop
54
+
55
+ [![CI](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml)
56
+ [![Release](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml)
57
+ [![Upstream smoke](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml)
58
+
59
+ JSON-first CLI and MCP server for Italian fuel-station prices (MIMIT *Osservaprezzi Carburanti*) and EV charging stations (OpenStreetMap Overpass). Downloads and caches the upstream CSVs/queries locally, joins them, screens outlier prices and suspect coordinates, and outputs JSON, GeoJSON, or a table.
60
+
61
+ Unofficial community project, not affiliated with or endorsed by MIMIT. Every output includes source and extraction-date provenance.
62
+
63
+ ## Install
64
+
65
+ Requires Python ≥ 3.10. Zero third-party runtime dependencies. Package name on PyPI: `pitstop-cli`; binary: `pitstop`.
66
+
67
+ ```bash
68
+ pipx install pitstop-cli
69
+ uv tool install pitstop-cli
70
+ uvx --from pitstop-cli pitstop --help
71
+ ```
72
+
73
+ With the optional MCP server (`pitstop-mcp`):
74
+
75
+ ```bash
76
+ pipx install "pitstop-cli[mcp]"
77
+ pitstop-mcp
78
+ ```
79
+
80
+ From a source checkout:
81
+
82
+ ```bash
83
+ PYTHONPATH=src python3 -m pitstop --help
84
+ ```
85
+
86
+ ## Usage
87
+
88
+ ```bash
89
+ # Check cache and upstream reachability
90
+ pitstop doctor
91
+
92
+ # Discover exact fuel names in the dataset
93
+ pitstop fuels
94
+
95
+ # Cheapest fresh ordinary diesel in a municipality
96
+ pitstop stations --comune Rome --fuel Gasolio --exact-fuel --cheapest --min-price 1.2 --fresh-within-days 90 --drop-outliers --limit 5
97
+
98
+ # Self-service petrol within 5 km of a coordinate, as JSON
99
+ pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
100
+
101
+ # Fast public CCS chargers (≥50 kW) near Bolzano
102
+ pitstop chargers --comune Bozen --radius 5 --socket ccs --fast --public --json
103
+
104
+ # Disambiguate duplicate municipality names
105
+ pitstop places Livo --json
106
+ pitstop chargers --comune Livo --provincia TN --json
107
+ pitstop chargers --comune-id 021008 --radius 5 --fast --json
108
+ ```
109
+
110
+ International city names (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, etc.) resolve automatically. Distances and radii are straight-line, not driving distances.
111
+
112
+ ### Flags & Caching
113
+
114
+ - **`stations`:** `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius` (`--radius-km`), `--fuel` (comma-separated substring; add `--exact-fuel` for exact match), `--self`/`--served`, `--cheapest` (needs `--fuel`; ties broken by distance), `--min-price`, `--fresh-within-days` (`--max-age-days`), `--max-deviation-pct`, `--drop-outliers`, `--no-comune-validate`, `--limit` (`0` = all), `--json`/`--geojson`.
115
+ - **`chargers`:** `--near`, `--comune`, `--provincia`, `--comune-id`, `--radius` (`--radius-km`), `--operator`, `--socket`, `--min-power` (`--min-power-kw`; checked against the matching socket when `--socket` is set), `--fast` (≥50 kW), `--ultra-fast` (≥150 kW), `--free` (`--free-only`), `--public` (`--public-only`), `--limit`, `--json`/`--geojson`.
116
+ - **Caching:** Stored under `$XDG_CACHE_HOME/pitstop` (default `~/.cache/pitstop`). Default TTLs: 24h (MIMIT), 7d (Overpass), 30d (municipality reference). Override with `--refresh`, `--max-age` (`0` = any age), and `--timeout`. Overpass falls back to a mirror on failure and respects `PITSTOP_OVERPASS_URL`.
117
+
118
+ ## Data Scope & Quality
119
+
120
+ - **Fuel freshness:** Daily data as of ~08:00 the day before `price_extraction_date`, Italy only. Not real-time.
121
+ - **Placeholders & staleness:** Operators sometimes publish placeholder values (e.g. `1.000`) or years-old updates. Use `--min-price` (e.g. `1.2`, skip for `GPL`) and `--fresh-within-days` (also excludes missing, unparseable, and future timestamps).
122
+ - **Outlier screening:** Every price carries `median_basis`. A `screened` price includes `regional_median`, `deviation_pct`, and optional `outlier: true` when >15% below its `(fuel, provincia)` median or below the Tukey lower fence (Q1−1.5·IQR). Pass `--drop-outliers` to remove them. An `unscreened` price sits in a bucket with too few samples for a median, so no outlier check ran on it (marked `~` in tables). Check the JSON `quality` block for counts.
123
+ - **Coordinates:** Mis-geocoded stations (>30 km from cluster centroid or [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani)) are flagged `coordinate_suspect` (`*` in tables) and filtered from `--near`. Pass `--no-comune-validate` to disable the reference cross-check.
124
+ - **EV chargers:** Resolved from OSM via Overpass; municipality lookups use the ISTAT-linked OSM `admin_centre` node and emit `location` provenance/warnings. Ambiguous names require `--provincia` or `--comune-id`. `pitstop` parses OSM's `fee` yes/no flag and never returns per-kWh prices; recognized operators include a `tariff_info_url`.
125
+
126
+ ## MCP Server
127
+
128
+ Exposes six read-only tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `find_places`, `get_stats`) returning structured JSON alongside text, reusing parsed fuel files and statistics until the cache changes.
129
+
130
+ ```json
131
+ { "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
132
+ ```
133
+
134
+ ## Automation Contract
135
+
136
+ - `stdout` is data; `stderr` is diagnostics. Non-interactive.
137
+ - Exit codes: `0` success, `1` runtime error, `2` usage error.
138
+ - JSON envelopes include `source`, extraction/generation dates, `query`, `count`, `coverage` (`fetched_count`, `matched_count`, `returned_count`, `truncated`), `freshness` (`fetched_at`, `age_seconds`, and charger `cache_status`), `quality` (fuel), `location` (municipality chargers), `error` (degraded Overpass), and `disclaimer`. GeoJSON places these under `metadata`.
139
+ - Agent skill: [skills/pitstop/SKILL.md](skills/pitstop/SKILL.md). Command recipes: [evals/agent/recipes.json](evals/agent/recipes.json).
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ pip install -e ".[dev]"
145
+ pytest -q
146
+ python scripts/smoke-installed.py
147
+ ```
148
+
149
+ Current line: `v1.4.x` (see [CHANGELOG.md](CHANGELOG.md)).
150
+
151
+ ## Data Sources
152
+
153
+ - Fuel stations & prices: **MIMIT Osservaprezzi Carburanti** ([open data](https://www.mimit.gov.it/it/open-data/elenco-dataset/carburanti-prezzi-praticati-e-anagrafica-degli-impianti)).
154
+ - Municipality reference: **opendatasicilia/comuni-italiani** (ISTAT-derived).
155
+ - EV chargers: **OpenStreetMap** via Overpass API (© OpenStreetMap contributors, ODbL).
@@ -0,0 +1,103 @@
1
+ # pitstop
2
+
3
+ [![CI](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/ci.yml)
4
+ [![Release](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/release.yml)
5
+ [![Upstream smoke](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml/badge.svg)](https://github.com/galjos/pitstop-cli/actions/workflows/upstream-smoke.yml)
6
+
7
+ JSON-first CLI and MCP server for Italian fuel-station prices (MIMIT *Osservaprezzi Carburanti*) and EV charging stations (OpenStreetMap Overpass). Downloads and caches the upstream CSVs/queries locally, joins them, screens outlier prices and suspect coordinates, and outputs JSON, GeoJSON, or a table.
8
+
9
+ Unofficial community project, not affiliated with or endorsed by MIMIT. Every output includes source and extraction-date provenance.
10
+
11
+ ## Install
12
+
13
+ Requires Python ≥ 3.10. Zero third-party runtime dependencies. Package name on PyPI: `pitstop-cli`; binary: `pitstop`.
14
+
15
+ ```bash
16
+ pipx install pitstop-cli
17
+ uv tool install pitstop-cli
18
+ uvx --from pitstop-cli pitstop --help
19
+ ```
20
+
21
+ With the optional MCP server (`pitstop-mcp`):
22
+
23
+ ```bash
24
+ pipx install "pitstop-cli[mcp]"
25
+ pitstop-mcp
26
+ ```
27
+
28
+ From a source checkout:
29
+
30
+ ```bash
31
+ PYTHONPATH=src python3 -m pitstop --help
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ # Check cache and upstream reachability
38
+ pitstop doctor
39
+
40
+ # Discover exact fuel names in the dataset
41
+ pitstop fuels
42
+
43
+ # Cheapest fresh ordinary diesel in a municipality
44
+ pitstop stations --comune Rome --fuel Gasolio --exact-fuel --cheapest --min-price 1.2 --fresh-within-days 90 --drop-outliers --limit 5
45
+
46
+ # Self-service petrol within 5 km of a coordinate, as JSON
47
+ pitstop stations --near 46.498,11.354 --radius 5 --fuel Benzina --self --json
48
+
49
+ # Fast public CCS chargers (≥50 kW) near Bolzano
50
+ pitstop chargers --comune Bozen --radius 5 --socket ccs --fast --public --json
51
+
52
+ # Disambiguate duplicate municipality names
53
+ pitstop places Livo --json
54
+ pitstop chargers --comune Livo --provincia TN --json
55
+ pitstop chargers --comune-id 021008 --radius 5 --fast --json
56
+ ```
57
+
58
+ International city names (`Rome`, `Milan`, `Bozen`, `Mailand`, `Venise`, etc.) resolve automatically. Distances and radii are straight-line, not driving distances.
59
+
60
+ ### Flags & Caching
61
+
62
+ - **`stations`:** `--comune`, `--provincia`, `--brand`, `--near "lat,lon"`, `--radius` (`--radius-km`), `--fuel` (comma-separated substring; add `--exact-fuel` for exact match), `--self`/`--served`, `--cheapest` (needs `--fuel`; ties broken by distance), `--min-price`, `--fresh-within-days` (`--max-age-days`), `--max-deviation-pct`, `--drop-outliers`, `--no-comune-validate`, `--limit` (`0` = all), `--json`/`--geojson`.
63
+ - **`chargers`:** `--near`, `--comune`, `--provincia`, `--comune-id`, `--radius` (`--radius-km`), `--operator`, `--socket`, `--min-power` (`--min-power-kw`; checked against the matching socket when `--socket` is set), `--fast` (≥50 kW), `--ultra-fast` (≥150 kW), `--free` (`--free-only`), `--public` (`--public-only`), `--limit`, `--json`/`--geojson`.
64
+ - **Caching:** Stored under `$XDG_CACHE_HOME/pitstop` (default `~/.cache/pitstop`). Default TTLs: 24h (MIMIT), 7d (Overpass), 30d (municipality reference). Override with `--refresh`, `--max-age` (`0` = any age), and `--timeout`. Overpass falls back to a mirror on failure and respects `PITSTOP_OVERPASS_URL`.
65
+
66
+ ## Data Scope & Quality
67
+
68
+ - **Fuel freshness:** Daily data as of ~08:00 the day before `price_extraction_date`, Italy only. Not real-time.
69
+ - **Placeholders & staleness:** Operators sometimes publish placeholder values (e.g. `1.000`) or years-old updates. Use `--min-price` (e.g. `1.2`, skip for `GPL`) and `--fresh-within-days` (also excludes missing, unparseable, and future timestamps).
70
+ - **Outlier screening:** Every price carries `median_basis`. A `screened` price includes `regional_median`, `deviation_pct`, and optional `outlier: true` when >15% below its `(fuel, provincia)` median or below the Tukey lower fence (Q1−1.5·IQR). Pass `--drop-outliers` to remove them. An `unscreened` price sits in a bucket with too few samples for a median, so no outlier check ran on it (marked `~` in tables). Check the JSON `quality` block for counts.
71
+ - **Coordinates:** Mis-geocoded stations (>30 km from cluster centroid or [opendatasicilia/comuni-italiani](https://github.com/opendatasicilia/comuni-italiani)) are flagged `coordinate_suspect` (`*` in tables) and filtered from `--near`. Pass `--no-comune-validate` to disable the reference cross-check.
72
+ - **EV chargers:** Resolved from OSM via Overpass; municipality lookups use the ISTAT-linked OSM `admin_centre` node and emit `location` provenance/warnings. Ambiguous names require `--provincia` or `--comune-id`. `pitstop` parses OSM's `fee` yes/no flag and never returns per-kWh prices; recognized operators include a `tariff_info_url`.
73
+
74
+ ## MCP Server
75
+
76
+ Exposes six read-only tools (`list_fuels`, `find_stations`, `find_cheapest`, `find_chargers`, `find_places`, `get_stats`) returning structured JSON alongside text, reusing parsed fuel files and statistics until the cache changes.
77
+
78
+ ```json
79
+ { "mcpServers": { "pitstop": { "command": "pitstop-mcp" } } }
80
+ ```
81
+
82
+ ## Automation Contract
83
+
84
+ - `stdout` is data; `stderr` is diagnostics. Non-interactive.
85
+ - Exit codes: `0` success, `1` runtime error, `2` usage error.
86
+ - JSON envelopes include `source`, extraction/generation dates, `query`, `count`, `coverage` (`fetched_count`, `matched_count`, `returned_count`, `truncated`), `freshness` (`fetched_at`, `age_seconds`, and charger `cache_status`), `quality` (fuel), `location` (municipality chargers), `error` (degraded Overpass), and `disclaimer`. GeoJSON places these under `metadata`.
87
+ - Agent skill: [skills/pitstop/SKILL.md](skills/pitstop/SKILL.md). Command recipes: [evals/agent/recipes.json](evals/agent/recipes.json).
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ pip install -e ".[dev]"
93
+ pytest -q
94
+ python scripts/smoke-installed.py
95
+ ```
96
+
97
+ Current line: `v1.4.x` (see [CHANGELOG.md](CHANGELOG.md)).
98
+
99
+ ## Data Sources
100
+
101
+ - Fuel stations & prices: **MIMIT Osservaprezzi Carburanti** ([open data](https://www.mimit.gov.it/it/open-data/elenco-dataset/carburanti-prezzi-praticati-e-anagrafica-degli-impianti)).
102
+ - Municipality reference: **opendatasicilia/comuni-italiani** (ISTAT-derived).
103
+ - EV chargers: **OpenStreetMap** via Overpass API (© OpenStreetMap contributors, ODbL).