mapradar 0.4.0__tar.gz → 0.4.2__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.
@@ -2,6 +2,23 @@
2
2
 
3
3
  Format based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
+ ## [0.4.2] - 2026-06-15
6
+
7
+ ### Fixed
8
+ - Enabled `abi3-v39` for `pyo3` to build universal Python wheels for PyPI (compatible with Python 3.9+)
9
+
10
+ ---
11
+
12
+ ## [0.4.1] - 2026-06-15
13
+
14
+ ### Added
15
+ - International transit mode support for India and Indonesia (`auto`, `rickshaw`, `tuktuk`, `ojek`, `bajaj`, `becak`, `angkot`, `busway`, `metro`, `local_train`)
16
+
17
+ ### Fixed
18
+ - Fixed bug where `ServiceType::Pharmacy` was missing from parsing, which caused `--type pharmacy` queries to fallback to landmarks (`tourist_attraction`)
19
+
20
+ ---
21
+
5
22
  ## [0.4.0] - 2026-06-14
6
23
 
7
24
  ### BREAKING CHANGES
@@ -941,7 +941,7 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
941
941
 
942
942
  [[package]]
943
943
  name = "mapradar"
944
- version = "0.4.0"
944
+ version = "0.4.2"
945
945
  dependencies = [
946
946
  "clap",
947
947
  "colored",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "mapradar"
3
- version = "0.4.0"
3
+ version = "0.4.2"
4
4
  edition = "2024"
5
5
  authors = ["iamprecieee"]
6
6
  description = "Turn addresses into coordinates and find nearby amenities using Google Maps API"
@@ -45,7 +45,7 @@ path = "src/main.rs"
45
45
  [features]
46
46
  default = []
47
47
  python = ["dep:pyo3", "dep:pyo3-async-runtimes"]
48
- extension-module = ["python", "pyo3/extension-module"]
48
+ extension-module = ["python", "pyo3/extension-module", "pyo3/abi3-py39"]
49
49
 
50
50
  [dev-dependencies]
51
51
  tokio-test = "0.4.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapradar
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -9,6 +9,8 @@ Classifier: Programming Language :: Python :: 3.9
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
12
14
  Classifier: Programming Language :: Rust
13
15
  License-File: LICENSE
14
16
  Summary: Turn addresses into coordinates and find nearby amenities using Google Maps API
@@ -41,10 +43,9 @@ uv add mapradar
41
43
  **Rust**
42
44
  ```toml
43
45
  [dependencies]
44
- mapradar = { version = "0.3.0", default-features = false }
46
+ mapradar = "0.4.2"
45
47
  tokio = { version = "1", features = ["full"] }
46
48
  ```
47
- > **Note:** Use `default-features = false` for pure Rust (no Python bindings).
48
49
 
49
50
  **CLI Tool**
50
51
  ```bash
@@ -157,7 +158,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
157
158
  | `GOOGLE_MAPS_API_KEY` | None | Your Google Maps API key. Enable Geocoding API, Places API (New), and Routes API. |
158
159
  | `max_results` | 20 | Maximum number of places returned per category. |
159
160
  | `radius` | 5.0 | Search radius in kilometers. |
160
- | `--mode` | `drive` | Transit mode for distance calculation (`drive`, `okada`, `keke`, `danfo`, `brt`). |
161
+ | `--mode` | `drive` | Transit mode for distance calculation (e.g. `drive`, `okada`, `auto`, `ojek`, `danfo`, `angkot`). |
161
162
 
162
163
  ---
163
164
 
@@ -21,10 +21,9 @@ uv add mapradar
21
21
  **Rust**
22
22
  ```toml
23
23
  [dependencies]
24
- mapradar = { version = "0.3.0", default-features = false }
24
+ mapradar = "0.4.2"
25
25
  tokio = { version = "1", features = ["full"] }
26
26
  ```
27
- > **Note:** Use `default-features = false` for pure Rust (no Python bindings).
28
27
 
29
28
  **CLI Tool**
30
29
  ```bash
@@ -137,7 +136,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
137
136
  | `GOOGLE_MAPS_API_KEY` | None | Your Google Maps API key. Enable Geocoding API, Places API (New), and Routes API. |
138
137
  | `max_results` | 20 | Maximum number of places returned per category. |
139
138
  | `radius` | 5.0 | Search radius in kilometers. |
140
- | `--mode` | `drive` | Transit mode for distance calculation (`drive`, `okada`, `keke`, `danfo`, `brt`). |
139
+ | `--mode` | `drive` | Transit mode for distance calculation (e.g. `drive`, `okada`, `auto`, `ojek`, `danfo`, `angkot`). |
141
140
 
142
141
  ---
143
142
 
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "mapradar"
7
- version = "0.4.0"
7
+ version = "0.4.2"
8
8
  description = "Turn addresses into coordinates and find nearby amenities using Google Maps API"
9
9
  authors = [{ name = "iamprecieee" }]
10
10
  license = {file = "LICENSE"}
@@ -20,6 +20,8 @@ classifiers = [
20
20
  "Programming Language :: Python :: 3.10",
21
21
  "Programming Language :: Python :: 3.11",
22
22
  "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
23
25
  "Programming Language :: Rust",
24
26
  ]
25
27
 
@@ -50,7 +50,13 @@ impl GeoCache {
50
50
  }
51
51
 
52
52
  /// Generates cache key for nearby search requests.
53
- fn nearby_key(lat: f64, lng: f64, service_type: ServiceType, radius_meters: f64, max_results: usize) -> String {
53
+ fn nearby_key(
54
+ lat: f64,
55
+ lng: f64,
56
+ service_type: ServiceType,
57
+ radius_meters: f64,
58
+ max_results: usize,
59
+ ) -> String {
54
60
  format!(
55
61
  "{:.4},{:.4}:{:?}:{:.0}:{}",
56
62
  lat, lng, service_type, radius_meters, max_results
@@ -93,7 +99,13 @@ impl GeoCache {
93
99
  max_results: usize,
94
100
  ) -> Option<Vec<NearbyService>> {
95
101
  self.nearby
96
- .get(&Self::nearby_key(lat, lng, service_type, radius_meters, max_results))
102
+ .get(&Self::nearby_key(
103
+ lat,
104
+ lng,
105
+ service_type,
106
+ radius_meters,
107
+ max_results,
108
+ ))
97
109
  .await
98
110
  }
99
111
 
@@ -164,6 +164,7 @@ impl super::MapradarClient {
164
164
  ServiceType::TrainStation => "train_station",
165
165
  ServiceType::TaxiStand => "taxi_stand",
166
166
  ServiceType::Landmark => "tourist_attraction",
167
+ ServiceType::Pharmacy => "pharmacy",
167
168
  };
168
169
 
169
170
  let body = serde_json::json!({
@@ -247,7 +248,14 @@ impl super::MapradarClient {
247
248
  }
248
249
 
249
250
  self.cache
250
- .set_nearby(lat, lng, service_type, radius_meters, max_results, services.clone())
251
+ .set_nearby(
252
+ lat,
253
+ lng,
254
+ service_type,
255
+ radius_meters,
256
+ max_results,
257
+ services.clone(),
258
+ )
251
259
  .await;
252
260
  Ok(services)
253
261
  }
@@ -363,9 +371,24 @@ impl super::MapradarClient {
363
371
 
364
372
  let url = "https://routes.googleapis.com/directions/v2:computeRoutes";
365
373
 
366
- let travel_mode_api = travel_distance_params
374
+ let raw_mode = travel_distance_params
367
375
  .travel_mode
368
- .unwrap_or_else(|| "DRIVE".to_string());
376
+ .unwrap_or_else(|| "DRIVE".to_string())
377
+ .to_uppercase();
378
+
379
+ let travel_mode_api = match raw_mode.as_str() {
380
+ // Two-wheelers and three-wheelers
381
+ "OKADA" | "KEKE" | "MOTORCYCLE" | "AUTO" | "RICKSHAW" | "TUKTUK" | "OJEK" | "BAJAJ"
382
+ | "BECAK" => "TWO_WHEELER",
383
+ // Transit vehicles
384
+ "DANFO" | "BRT" | "ANGKOT" | "BUSWAY" | "METRO" | "LOCAL_TRAIN" => "TRANSIT",
385
+ "WALK" => "WALK",
386
+ "BICYCLE" => "BICYCLE",
387
+ "DRIVE" => "DRIVE",
388
+ "TRANSIT" => "TRANSIT",
389
+ "TWO_WHEELER" => "TWO_WHEELER",
390
+ _ => &raw_mode,
391
+ };
369
392
 
370
393
  let body = serde_json::json!({
371
394
  "origin": {
@@ -412,13 +435,14 @@ impl super::MapradarClient {
412
435
  .get("routes")
413
436
  .and_then(|route_list| route_list.as_array())
414
437
  && let Some(route) = routes.first()
415
- && let Some(distance) = route.get("distanceMeters").and_then(|dist_val| {
416
- dist_val
417
- .as_f64()
418
- .or_else(|| dist_val.as_u64().map(|unsigned_val| unsigned_val as f64))
419
- }) {
420
- return Ok(distance / 1000.0);
421
- }
438
+ && let Some(distance) = route.get("distanceMeters").and_then(|dist_val| {
439
+ dist_val
440
+ .as_f64()
441
+ .or_else(|| dist_val.as_u64().map(|unsigned_val| unsigned_val as f64))
442
+ })
443
+ {
444
+ return Ok(distance / 1000.0);
445
+ }
422
446
 
423
447
  Err(GeoError::Unknown(
424
448
  "Could not compute travel distance between these locations".to_string(),
@@ -123,6 +123,7 @@ async fn main() {
123
123
  "train-station" => ServiceType::TrainStation,
124
124
  "taxi-stand" => ServiceType::TaxiStand,
125
125
  "landmark" => ServiceType::Landmark,
126
+ "pharmacy" => ServiceType::Pharmacy,
126
127
  _ => ServiceType::Landmark, // Default fallback
127
128
  })
128
129
  .collect::<Vec<ServiceType>>();
@@ -88,6 +88,7 @@ pub enum ServiceType {
88
88
  TrainStation,
89
89
  TaxiStand,
90
90
  Landmark,
91
+ Pharmacy,
91
92
  }
92
93
 
93
94
  /// Represents a specific amenity found near a location.
@@ -255,7 +256,9 @@ impl JsonRpcResponse {
255
256
 
256
257
  #[getter]
257
258
  pub fn get_result(&self) -> Option<String> {
258
- self.result.as_ref().map(|v| serde_json::to_string(v).unwrap_or_default())
259
+ self.result
260
+ .as_ref()
261
+ .map(|v| serde_json::to_string(v).unwrap_or_default())
259
262
  }
260
263
 
261
264
  #[setter]
@@ -303,7 +306,7 @@ mod tests {
303
306
  let result_val = serde_json::to_value(&loc).unwrap();
304
307
  let rpc = JsonRpcResponse::new("test-123".to_string(), Some(result_val), None);
305
308
  let json_str = serde_json::to_string(&rpc).unwrap();
306
-
309
+
307
310
  // Assert that the result contains actual JSON and not stringified JSON (no double encoding)
308
311
  assert!(json_str.contains(r#""result":{"address":"123 Main St""#));
309
312
  // Ensure there's no double quoting: "result":"{\"address\":...}"
mapradar-0.4.2/uv.lock ADDED
@@ -0,0 +1,8 @@
1
+ version = 1
2
+ revision = 3
3
+ requires-python = ">=3.9"
4
+
5
+ [[package]]
6
+ name = "mapradar"
7
+ version = "0.4.2"
8
+ source = { editable = "." }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes