renfe-cli 6.0.0__tar.gz → 6.2.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.
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v6.2.0 (2026-09-13)
4
+
5
+ * Allow selecting a station when a name matches multiple stations [#211](https://github.com/gerardcl/renfe-cli/issues/211)
6
+
7
+ ## v6.1.0 (2026-09-12)
8
+
9
+ * Add GTFS data caching [#209](https://github.com/gerardcl/renfe-cli/issues/209)
10
+ * Add transfer infos [#208](https://github.com/gerardcl/renfe-cli/issues/208)
11
+
3
12
  ## v6.0.0 (2026-09-08)
4
13
 
5
14
  * General maintenance and improvements on GTFS data handling and algorithms [#206](https://github.com/gerardcl/renfe-cli/issues/206)
@@ -58,6 +58,15 @@ version = "0.22.1"
58
58
  source = "registry+https://github.com/rust-lang/crates.io-index"
59
59
  checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
60
60
 
61
+ [[package]]
62
+ name = "bincode"
63
+ version = "1.3.3"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
66
+ dependencies = [
67
+ "serde",
68
+ ]
69
+
61
70
  [[package]]
62
71
  name = "bitflags"
63
72
  version = "1.3.2"
@@ -306,6 +315,27 @@ dependencies = [
306
315
  "digest",
307
316
  ]
308
317
 
318
+ [[package]]
319
+ name = "directories"
320
+ version = "6.0.0"
321
+ source = "registry+https://github.com/rust-lang/crates.io-index"
322
+ checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
323
+ dependencies = [
324
+ "dirs-sys",
325
+ ]
326
+
327
+ [[package]]
328
+ name = "dirs-sys"
329
+ version = "0.5.0"
330
+ source = "registry+https://github.com/rust-lang/crates.io-index"
331
+ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
332
+ dependencies = [
333
+ "libc",
334
+ "option-ext",
335
+ "redox_users",
336
+ "windows-sys 0.61.2",
337
+ ]
338
+
309
339
  [[package]]
310
340
  name = "displaydoc"
311
341
  version = "0.2.7"
@@ -878,6 +908,15 @@ version = "0.2.189"
878
908
  source = "registry+https://github.com/rust-lang/crates.io-index"
879
909
  checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
880
910
 
911
+ [[package]]
912
+ name = "libredox"
913
+ version = "0.1.23"
914
+ source = "registry+https://github.com/rust-lang/crates.io-index"
915
+ checksum = "8d8f1ea3f21fd3405dcaf6c9b5c1630af9afc422d9073ea39c5f6d6c772e08ed"
916
+ dependencies = [
917
+ "libc",
918
+ ]
919
+
881
920
  [[package]]
882
921
  name = "litemap"
883
922
  version = "0.8.3"
@@ -934,6 +973,12 @@ version = "0.2.1"
934
973
  source = "registry+https://github.com/rust-lang/crates.io-index"
935
974
  checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
936
975
 
976
+ [[package]]
977
+ name = "option-ext"
978
+ version = "0.2.0"
979
+ source = "registry+https://github.com/rust-lang/crates.io-index"
980
+ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
981
+
937
982
  [[package]]
938
983
  name = "percent-encoding"
939
984
  version = "2.3.2"
@@ -1140,16 +1185,30 @@ dependencies = [
1140
1185
  "rand_core",
1141
1186
  ]
1142
1187
 
1188
+ [[package]]
1189
+ name = "redox_users"
1190
+ version = "0.5.2"
1191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1192
+ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
1193
+ dependencies = [
1194
+ "getrandom 0.2.17",
1195
+ "libredox",
1196
+ "thiserror",
1197
+ ]
1198
+
1143
1199
  [[package]]
1144
1200
  name = "renfe-cli"
1145
- version = "6.0.0"
1201
+ version = "6.2.0"
1146
1202
  dependencies = [
1203
+ "bincode",
1147
1204
  "chrono",
1205
+ "directories",
1148
1206
  "getopts",
1149
1207
  "gtfs-structures",
1150
1208
  "jiff",
1151
1209
  "pyo3",
1152
1210
  "reqwest",
1211
+ "serde",
1153
1212
  ]
1154
1213
 
1155
1214
  [[package]]
@@ -1368,6 +1427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1368
1427
  checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
1369
1428
  dependencies = [
1370
1429
  "serde_core",
1430
+ "serde_derive",
1371
1431
  ]
1372
1432
 
1373
1433
  [[package]]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "renfe-cli"
3
- version = "6.0.0"
3
+ version = "6.2.0"
4
4
  edition = "2024"
5
5
  rust-version = "1.98"
6
6
  authors = ["Gerard C.L. <gerardcl@gmail.com>"]
@@ -23,5 +23,8 @@ pyo3 = { version = "0.29", features = ["abi3-py310"] }
23
23
  getopts = "0.2.24"
24
24
  chrono = "0.4.45"
25
25
  gtfs-structures = { version = "0.50", default-features = false }
26
- jiff = "0.2.35"
26
+ jiff = { version = "0.2.35", features = ["serde"] }
27
27
  reqwest = { version = "0.13", default-features = false, features = ["blocking", "rustls"] }
28
+ serde = { version = "1.0", features = ["derive"] }
29
+ bincode = "1.3"
30
+ directories = "6.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: renfe-cli
3
- Version: 6.0.0
3
+ Version: 6.2.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: 3.10
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -97,8 +97,6 @@ Let's show an example of minimal inputs (origin and destination stations) with s
97
97
  ```bash
98
98
  $ renfe-cli -f girona -t "puerta de atocha" -d 30
99
99
  Loading default GTFS data from Renfe web - Alta velocidad, Larga distancia y Media distancia
100
- Provided input 'girona' does a match with 'Estación de tren Girona'
101
- Provided input 'puerta de atocha' does a match with 'Estación de tren Madrid-Puerta de Atocha'
102
100
  Today is: 2024-9-29
103
101
  Searching timetable for date: 2024-9-30
104
102
  Origin station: Estación de tren Girona
@@ -126,8 +124,6 @@ Let's show an example using Renfe Cercanías GTFS dataset:
126
124
  ```bash
127
125
  $ renfe-cli -f chamartín -t "tres cantos" -c
128
126
  Loading Cercanías GTFS data from Renfe web - long load time
129
- Provided input 'chamartín' does a match with 'Station { name: "Estación de tren Madrid-Chamartín-Clara Campoamor", id: "17000" }'
130
- Provided input 'tres cantos' does a match with 'Station { name: "Estación de tren Tres Cantos (apt)", id: "17004" }'
131
127
  Today is: 2024-10-2
132
128
  Searching timetable for date: 2024-10-2
133
129
  Origin station: Estación de tren Madrid-Chamartín-Clara Campoamor
@@ -153,6 +149,48 @@ Destination station: Estación de tren Tres Cantos (apt)
153
149
  ===========================================================
154
150
  ```
155
151
 
152
+ ### Selecting a station
153
+
154
+ Station names are matched case-insensitively and may be abbreviated. If the
155
+ provided text matches more than one station, the CLI sorts the matches by name
156
+ and asks which station to use. Select it by entering its 1-based ordinal number:
157
+
158
+ ```text
159
+ $ renfe-cli -f madrid -t girona
160
+ Multiple stations match 'madrid':
161
+ 1. Estación de tren Madrid - Atocha Cercanias
162
+ 2. Estación de tren Madrid-Chamartin
163
+ 3. Estación de tren Madrid-Nuevos Ministerios
164
+ 4. Estación de tren Madrid-Principe Pio
165
+ 5. Estación de tren Madrid-Puerta de Atocha
166
+ 6. Estación de tren Madrid-Ramon Y Cajal
167
+ 7. Estación de tren Madrid-Recoletos
168
+ Select a station [1-7]: 5
169
+ ```
170
+
171
+ Invalid numbers are rejected and the CLI asks again. If the provided text does
172
+ not match any station, it reports the input without presenting a selection:
173
+
174
+ ```text
175
+ ValueError: Provided input 'unknown' does not match any station name
176
+ ```
177
+
178
+ Journeys with connections include the details of every transfer directly
179
+ below the timetable row. The arrival and departure are the times at which the
180
+ transfer starts and ends; the duration is the total time available to change
181
+ trains. Transfers between different stops show both station names:
182
+
183
+ ```text
184
+ Transfer 1 at Madrid-Chamartín: arrive 10:05, depart 10:20 (00:15)
185
+ Transfer 2 at Madrid-Atocha → Madrid-Puerta de Atocha: arrive 10:45, depart 11:10 (00:25)
186
+ ```
187
+
188
+ Downloaded feeds are converted to routing data and cached in the operating
189
+ system's user cache directory. On later runs, `renfe-cli` sends Renfe the
190
+ stored HTTP `ETag`; when the feed has not changed, Renfe returns `304 Not
191
+ Modified` and the processed data is loaded directly from the local cache.
192
+ Set `RENFE_CLI_CACHE_DIR` to use a custom cache location.
193
+
156
194
  ## Usage (Library)
157
195
 
158
196
  `renfe-cli` can be imported as a python package into your project, offering utilities when willing to deal with the Renfe search web site.
@@ -179,13 +217,10 @@ GTFS data:
179
217
  Shapes: 0
180
218
  Fare attributes: 0
181
219
  Feed info: 0
182
- >>> renfe.filter_station("madrid")
183
- Traceback (most recent call last):
184
- File "<stdin>", line 1, in <module>
185
- ValueError: Provided input 'madrid' does match with '[Station { name: "Estación de tren Madrid-Puerta de Atocha", id: "60000" }, Station { name: "Estación de tren Madrid - Atocha Cercanias", id: "18000" }, Station { name: "Estación de tren Madrid-Principe Pio", id: "10000" }, Station { name: "Estación de tren Madrid-Ramon Y Cajal", id: "97201" }, Station { name: "Estación de tren Madrid-Nuevos Ministerios", id: "18002" }, Station { name: "Estación de tren Madrid-Chamartin", id: "17000" }, Station { name: "Estación de tren Madrid-Recoletos", id: "18001" }]' -> There must be ONLY one match
186
- >>> renfe.filter_station("girona")
187
- Provided input 'girona' does a match with 'Station { name: "Estación de tren Girona", id: "79300" }'
188
- <builtins.Station object at 0x77f04173d070>
220
+ >>> len(renfe.stations_match("madrid"))
221
+ 7
222
+ >>> len(renfe.stations_match("girona"))
223
+ 1
189
224
  >>> renfe.print_timetable()
190
225
 
191
226
  No schedules available...won't print timetable.
@@ -61,8 +61,6 @@ Let's show an example of minimal inputs (origin and destination stations) with s
61
61
  ```bash
62
62
  $ renfe-cli -f girona -t "puerta de atocha" -d 30
63
63
  Loading default GTFS data from Renfe web - Alta velocidad, Larga distancia y Media distancia
64
- Provided input 'girona' does a match with 'Estación de tren Girona'
65
- Provided input 'puerta de atocha' does a match with 'Estación de tren Madrid-Puerta de Atocha'
66
64
  Today is: 2024-9-29
67
65
  Searching timetable for date: 2024-9-30
68
66
  Origin station: Estación de tren Girona
@@ -90,8 +88,6 @@ Let's show an example using Renfe Cercanías GTFS dataset:
90
88
  ```bash
91
89
  $ renfe-cli -f chamartín -t "tres cantos" -c
92
90
  Loading Cercanías GTFS data from Renfe web - long load time
93
- Provided input 'chamartín' does a match with 'Station { name: "Estación de tren Madrid-Chamartín-Clara Campoamor", id: "17000" }'
94
- Provided input 'tres cantos' does a match with 'Station { name: "Estación de tren Tres Cantos (apt)", id: "17004" }'
95
91
  Today is: 2024-10-2
96
92
  Searching timetable for date: 2024-10-2
97
93
  Origin station: Estación de tren Madrid-Chamartín-Clara Campoamor
@@ -117,6 +113,48 @@ Destination station: Estación de tren Tres Cantos (apt)
117
113
  ===========================================================
118
114
  ```
119
115
 
116
+ ### Selecting a station
117
+
118
+ Station names are matched case-insensitively and may be abbreviated. If the
119
+ provided text matches more than one station, the CLI sorts the matches by name
120
+ and asks which station to use. Select it by entering its 1-based ordinal number:
121
+
122
+ ```text
123
+ $ renfe-cli -f madrid -t girona
124
+ Multiple stations match 'madrid':
125
+ 1. Estación de tren Madrid - Atocha Cercanias
126
+ 2. Estación de tren Madrid-Chamartin
127
+ 3. Estación de tren Madrid-Nuevos Ministerios
128
+ 4. Estación de tren Madrid-Principe Pio
129
+ 5. Estación de tren Madrid-Puerta de Atocha
130
+ 6. Estación de tren Madrid-Ramon Y Cajal
131
+ 7. Estación de tren Madrid-Recoletos
132
+ Select a station [1-7]: 5
133
+ ```
134
+
135
+ Invalid numbers are rejected and the CLI asks again. If the provided text does
136
+ not match any station, it reports the input without presenting a selection:
137
+
138
+ ```text
139
+ ValueError: Provided input 'unknown' does not match any station name
140
+ ```
141
+
142
+ Journeys with connections include the details of every transfer directly
143
+ below the timetable row. The arrival and departure are the times at which the
144
+ transfer starts and ends; the duration is the total time available to change
145
+ trains. Transfers between different stops show both station names:
146
+
147
+ ```text
148
+ Transfer 1 at Madrid-Chamartín: arrive 10:05, depart 10:20 (00:15)
149
+ Transfer 2 at Madrid-Atocha → Madrid-Puerta de Atocha: arrive 10:45, depart 11:10 (00:25)
150
+ ```
151
+
152
+ Downloaded feeds are converted to routing data and cached in the operating
153
+ system's user cache directory. On later runs, `renfe-cli` sends Renfe the
154
+ stored HTTP `ETag`; when the feed has not changed, Renfe returns `304 Not
155
+ Modified` and the processed data is loaded directly from the local cache.
156
+ Set `RENFE_CLI_CACHE_DIR` to use a custom cache location.
157
+
120
158
  ## Usage (Library)
121
159
 
122
160
  `renfe-cli` can be imported as a python package into your project, offering utilities when willing to deal with the Renfe search web site.
@@ -143,13 +181,10 @@ GTFS data:
143
181
  Shapes: 0
144
182
  Fare attributes: 0
145
183
  Feed info: 0
146
- >>> renfe.filter_station("madrid")
147
- Traceback (most recent call last):
148
- File "<stdin>", line 1, in <module>
149
- ValueError: Provided input 'madrid' does match with '[Station { name: "Estación de tren Madrid-Puerta de Atocha", id: "60000" }, Station { name: "Estación de tren Madrid - Atocha Cercanias", id: "18000" }, Station { name: "Estación de tren Madrid-Principe Pio", id: "10000" }, Station { name: "Estación de tren Madrid-Ramon Y Cajal", id: "97201" }, Station { name: "Estación de tren Madrid-Nuevos Ministerios", id: "18002" }, Station { name: "Estación de tren Madrid-Chamartin", id: "17000" }, Station { name: "Estación de tren Madrid-Recoletos", id: "18001" }]' -> There must be ONLY one match
150
- >>> renfe.filter_station("girona")
151
- Provided input 'girona' does a match with 'Station { name: "Estación de tren Girona", id: "79300" }'
152
- <builtins.Station object at 0x77f04173d070>
184
+ >>> len(renfe.stations_match("madrid"))
185
+ 7
186
+ >>> len(renfe.stations_match("girona"))
187
+ 1
153
188
  >>> renfe.print_timetable()
154
189
 
155
190
  No schedules available...won't print timetable.