renfe-cli 5.1.0__tar.gz → 5.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.
@@ -0,0 +1,256 @@
1
+ # This file is autogenerated by maturin v1.3.2
2
+ # To update, run
3
+ #
4
+ # maturin generate-ci github
5
+ #
6
+ name: CICD
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - main
12
+ tags:
13
+ - '*'
14
+ pull_request:
15
+ branches: [ main ]
16
+ workflow_dispatch:
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ env:
22
+ CARGO_TERM_COLOR: always
23
+
24
+ jobs:
25
+
26
+ test:
27
+ name: Tests
28
+ strategy:
29
+ matrix:
30
+ os: [ubuntu-latest, macos-latest, windows-latest]
31
+ runs-on: ${{ matrix.os }}
32
+ steps:
33
+ - uses: actions/checkout@v3
34
+ - uses: actions-rs/toolchain@v1
35
+ with:
36
+ profile: minimal
37
+ toolchain: stable
38
+ override: true
39
+ - uses: actions-rs/cargo@v1
40
+ with:
41
+ command: test
42
+
43
+ fmt:
44
+ name: Rustfmt
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - uses: actions/checkout@v3
48
+ - uses: actions-rs/toolchain@v1
49
+ with:
50
+ profile: minimal
51
+ toolchain: stable
52
+ override: true
53
+ - run: rustup component add rustfmt
54
+ - uses: actions-rs/cargo@v1
55
+ with:
56
+ command: fmt
57
+ args: --all -- --check
58
+
59
+ clippy:
60
+ name: Build Clippy
61
+ runs-on: ubuntu-latest
62
+ strategy:
63
+ matrix:
64
+ rust:
65
+ - stable
66
+ - 1.72.0
67
+ steps:
68
+ - uses: actions/checkout@v3
69
+ - uses: actions-rs/toolchain@v1
70
+ with:
71
+ profile: minimal
72
+ toolchain: ${{ matrix.rust }}
73
+ override: true
74
+ - run: rustup component add clippy
75
+ - uses: actions-rs/cargo@v1
76
+ with:
77
+ command: clippy
78
+ args: -- -D warnings
79
+
80
+ linux:
81
+ runs-on: ${{ matrix.platform.runner }}
82
+ strategy:
83
+ matrix:
84
+ platform:
85
+ - runner: ubuntu-latest
86
+ target: x86_64
87
+ - runner: ubuntu-latest
88
+ target: x86
89
+ # skipping until ring update/fix compile issue: include/ring-core/asm_base.h:73:2: error: #error "ARM assembler must define __ARM_ARCH"
90
+ # - runner: ubuntu-latest
91
+ # target: aarch64
92
+ - runner: ubuntu-latest
93
+ target: armv7
94
+ - runner: ubuntu-latest
95
+ target: s390x
96
+ - runner: ubuntu-latest
97
+ target: ppc64le
98
+ steps:
99
+ - uses: actions/checkout@v4
100
+ - uses: actions/setup-python@v5
101
+ with:
102
+ python-version: 3.x
103
+ - name: Build wheels
104
+ uses: PyO3/maturin-action@v1
105
+ with:
106
+ target: ${{ matrix.platform.target }}
107
+ args: --release --out dist
108
+ sccache: 'true'
109
+ manylinux: auto
110
+ - name: Upload wheels
111
+ uses: actions/upload-artifact@v4
112
+ with:
113
+ name: wheels-linux-${{ matrix.platform.target }}
114
+ path: dist
115
+
116
+ musllinux:
117
+ runs-on: ${{ matrix.platform.runner }}
118
+ strategy:
119
+ matrix:
120
+ platform:
121
+ - runner: ubuntu-latest
122
+ target: x86_64
123
+ - runner: ubuntu-latest
124
+ target: x86
125
+ # skipping until ring update/fix compile issue: include/ring-core/asm_base.h:73:2: error: #error "ARM assembler must define __ARM_ARCH"
126
+ # - runner: ubuntu-latest
127
+ # target: aarch64
128
+ - runner: ubuntu-latest
129
+ target: armv7
130
+ steps:
131
+ - uses: actions/checkout@v4
132
+ - uses: actions/setup-python@v5
133
+ with:
134
+ python-version: 3.x
135
+ - name: Build wheels
136
+ uses: PyO3/maturin-action@v1
137
+ with:
138
+ target: ${{ matrix.platform.target }}
139
+ args: --release --out dist
140
+ sccache: 'true'
141
+ manylinux: musllinux_1_2
142
+ - name: Upload wheels
143
+ uses: actions/upload-artifact@v4
144
+ with:
145
+ name: wheels-musllinux-${{ matrix.platform.target }}
146
+ path: dist
147
+
148
+ windows:
149
+ runs-on: ${{ matrix.platform.runner }}
150
+ strategy:
151
+ matrix:
152
+ platform:
153
+ - runner: windows-latest
154
+ target: x64
155
+ - runner: windows-latest
156
+ target: x86
157
+ steps:
158
+ - uses: actions/checkout@v4
159
+ - uses: actions/setup-python@v5
160
+ with:
161
+ python-version: 3.x
162
+ architecture: ${{ matrix.platform.target }}
163
+ - name: Build wheels
164
+ uses: PyO3/maturin-action@v1
165
+ with:
166
+ target: ${{ matrix.platform.target }}
167
+ args: --release --out dist
168
+ sccache: 'true'
169
+ - name: Upload wheels
170
+ uses: actions/upload-artifact@v4
171
+ with:
172
+ name: wheels-windows-${{ matrix.platform.target }}
173
+ path: dist
174
+
175
+ macos:
176
+ runs-on: ${{ matrix.platform.runner }}
177
+ strategy:
178
+ matrix:
179
+ platform:
180
+ - runner: macos-12
181
+ target: x86_64
182
+ - runner: macos-14
183
+ target: aarch64
184
+ steps:
185
+ - uses: actions/checkout@v4
186
+ - uses: actions/setup-python@v5
187
+ with:
188
+ python-version: 3.x
189
+ - name: Build wheels
190
+ uses: PyO3/maturin-action@v1
191
+ with:
192
+ target: ${{ matrix.platform.target }}
193
+ args: --release --out dist
194
+ sccache: 'true'
195
+ - name: Upload wheels
196
+ uses: actions/upload-artifact@v4
197
+ with:
198
+ name: wheels-macos-${{ matrix.platform.target }}
199
+ path: dist
200
+
201
+ sdist:
202
+ runs-on: ubuntu-latest
203
+ steps:
204
+ - uses: actions/checkout@v4
205
+ - name: Build sdist
206
+ uses: PyO3/maturin-action@v1
207
+ with:
208
+ command: sdist
209
+ args: --out dist
210
+ - name: Upload sdist
211
+ uses: actions/upload-artifact@v4
212
+ with:
213
+ name: wheels-sdist
214
+ path: dist
215
+
216
+ release:
217
+ name: Release (PyPI)
218
+ runs-on: ubuntu-latest
219
+ if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
220
+ needs: [linux, musllinux, windows, macos, sdist]
221
+ permissions:
222
+ # Use to sign the release artifacts
223
+ id-token: write
224
+ # Used to upload release artifacts
225
+ contents: write
226
+ # Used to generate artifact attestation
227
+ attestations: write
228
+ steps:
229
+ - uses: actions/download-artifact@v4
230
+ - name: Generate artifact attestation
231
+ uses: actions/attest-build-provenance@v1
232
+ with:
233
+ subject-path: 'wheels-*/*'
234
+ - name: Publish to PyPI
235
+ if: "startsWith(github.ref, 'refs/tags/')"
236
+ uses: PyO3/maturin-action@v1
237
+ env:
238
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
239
+ with:
240
+ command: upload
241
+ args: --non-interactive --skip-existing wheels-*/*
242
+
243
+ publish:
244
+ name: Publish (crates.io)
245
+ if: startsWith(github.ref, 'refs/tags/')
246
+ needs: [release]
247
+ runs-on: ubuntu-latest
248
+ steps:
249
+ - uses: actions/checkout@v3
250
+ - uses: actions-rs/toolchain@v1
251
+ with:
252
+ profile: minimal
253
+ toolchain: stable
254
+ override: true
255
+ - name: Publish
256
+ run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.2.0 (2024-10-03)
4
+
5
+ * Publish Rust crate binary via crates.io [#202](https://github.com/gerardcl/renfe-cli/issues/202)
6
+
3
7
  ## v5.1.0 (2024-10-02)
4
8
 
5
9
  * Enable Renfe Cercanías GTFS dataset [#200](https://github.com/gerardcl/renfe-cli/issues/200)
@@ -925,7 +925,7 @@ dependencies = [
925
925
 
926
926
  [[package]]
927
927
  name = "renfe-cli"
928
- version = "5.1.0"
928
+ version = "5.2.0"
929
929
  dependencies = [
930
930
  "chrono",
931
931
  "getopts",
@@ -1,19 +1,21 @@
1
1
  [package]
2
2
  name = "renfe-cli"
3
- version = "5.1.0"
3
+ version = "5.2.0"
4
4
  edition = "2021"
5
+ authors = ["Gerard C.L. <gerardcl@gmail.com>"]
5
6
  license = "BSD-3-Clause"
6
7
  description = "CLI for searching Renfe train timetables in the Spanish country"
7
8
  readme = "README.md"
8
9
  homepage = "https://github.com/gerardcl/renfe-cli"
9
10
  repository = "https://github.com/gerardcl/renfe-cli"
10
- keywords = ["cli", "timetables", "schedules", "trains", "renfe", "spain"]
11
+ keywords = ["cli", "timetables", "trains", "renfe", "spain"]
11
12
  categories = ["command-line-utilities"]
12
13
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13
14
 
14
15
  [lib]
15
16
  name = "renfe_cli"
16
- crate-type = ["cdylib"]
17
+ # https://doc.rust-lang.org/reference/linkage.html
18
+ crate-type = ["cdylib", "lib"]
17
19
 
18
20
  [dependencies]
19
21
  pyo3 = { version = "0.22", features = ["abi3-py37"] }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: renfe-cli
3
- Version: 5.1.0
3
+ Version: 5.2.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -19,10 +19,11 @@ License-File: LICENSE
19
19
  Summary: Get faster Renfe Spanish Trains timetables in your terminal.
20
20
  Keywords: timetables,schedules,trains,renfe,cli,rust,python,pyo3,maturin
21
21
  Home-Page: https://github.com/gerardcl/renfe-cli
22
+ Author: Gerard C.L. <gerardcl@gmail.com>
22
23
  Author-email: Gerard Castillo Lasheras <gerardcl@gmail.com>
23
24
  Maintainer-email: Gerard Castillo Lasheras <gerardcl@gmail.com>
24
25
  License: BSD-3-Clause
25
- Requires-Python: >=3.7
26
+ Requires-Python: >=3.8
26
27
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
27
28
  Project-URL: Homepage, https://github.com/gerardcl/renfe-cli
28
29
  Project-URL: Documentation, https://github.com/gerardcl/renfe-cli
@@ -34,13 +35,15 @@ Project-URL: Changelog, https://github.com/gerardcl/renfe-cli/blob/master/CHANGE
34
35
 
35
36
  # Renfe Timetables CLI
36
37
 
37
- Get faster Renfe trains timetables in your terminal, with Python3.7+ support.
38
+ Get faster Renfe trains timetables in your terminal, with Python3.8+ support.
38
39
  No longer need to open the browser! Just keep using your terminal 😀
39
40
 
40
41
  It supports both [Horarios de alta velocidad, larga distancia y media distancia](https://data.renfe.com/dataset/horarios-de-alta-velocidad-larga-distancia-y-media-distancia) (default option, as in the web) and [Renfe Cercanías](https://data.renfe.com/dataset/horarios-cercanias) GTFS datasets.
41
42
 
42
43
  `renfe-cli` is written in [Rust](https://www.rust-lang.org/) (since v4.0.0) and published to [pypi.org](https://pypi.org/project/renfe-cli/) as a Python package (CLI and library).
43
44
 
45
+ It is provided as a Python package due to historical reasons, but was ported to Rust to showcase Rust's interoperability and performance improvements that can offer to the Python ecosystem. Nevertheless, one can optionally use the built [renfe-cli](https://crates.io/crates/renfe-cli) crate that is publised to crates.io.
46
+
44
47
  See the [changelog](https://github.com/gerardcl/renfe-cli/blob/master/CHANGELOG.md).
45
48
 
46
49
  **NOTE** since I am more often using Rodalies trains I have created [rodalies-cli](https://github.com/gerardcl/rodalies-cli). I hope you like it too!
@@ -49,12 +52,22 @@ See the [changelog](https://github.com/gerardcl/renfe-cli/blob/master/CHANGELOG.
49
52
 
50
53
  ## Installation
51
54
 
55
+ ### Python package
56
+
52
57
  Install Python CLI package [renfe-cli](https://pypi.org/project/renfe-cli/)
53
58
 
54
59
  ```bash
55
60
  pip install renfe-cli --upgrade
56
61
  ```
57
62
 
63
+ ### Rust crate (optional)
64
+
65
+ Install the Rust crate [renfe-cli](https://crates.io/crates/renfe-cli)
66
+
67
+ ```bash
68
+ cargo install renfe-cli
69
+ ```
70
+
58
71
  ## Usage (CLI)
59
72
 
60
73
  The CLI uses the official and latest Renfe's GTFS dataset, from [Horarios de alta velocidad, larga distancia y media distancia](https://data.renfe.com/dataset/horarios-de-alta-velocidad-larga-distancia-y-media-distancia), by default. Optionally, one can enable searching over [Renfe Cercanías GTFS dataset](https://data.renfe.com/dataset/horarios-cercanias) (expect longer load time in this case).
@@ -2,13 +2,15 @@
2
2
 
3
3
  # Renfe Timetables CLI
4
4
 
5
- Get faster Renfe trains timetables in your terminal, with Python3.7+ support.
5
+ Get faster Renfe trains timetables in your terminal, with Python3.8+ support.
6
6
  No longer need to open the browser! Just keep using your terminal 😀
7
7
 
8
8
  It supports both [Horarios de alta velocidad, larga distancia y media distancia](https://data.renfe.com/dataset/horarios-de-alta-velocidad-larga-distancia-y-media-distancia) (default option, as in the web) and [Renfe Cercanías](https://data.renfe.com/dataset/horarios-cercanias) GTFS datasets.
9
9
 
10
10
  `renfe-cli` is written in [Rust](https://www.rust-lang.org/) (since v4.0.0) and published to [pypi.org](https://pypi.org/project/renfe-cli/) as a Python package (CLI and library).
11
11
 
12
+ It is provided as a Python package due to historical reasons, but was ported to Rust to showcase Rust's interoperability and performance improvements that can offer to the Python ecosystem. Nevertheless, one can optionally use the built [renfe-cli](https://crates.io/crates/renfe-cli) crate that is publised to crates.io.
13
+
12
14
  See the [changelog](https://github.com/gerardcl/renfe-cli/blob/master/CHANGELOG.md).
13
15
 
14
16
  **NOTE** since I am more often using Rodalies trains I have created [rodalies-cli](https://github.com/gerardcl/rodalies-cli). I hope you like it too!
@@ -17,12 +19,22 @@ See the [changelog](https://github.com/gerardcl/renfe-cli/blob/master/CHANGELOG.
17
19
 
18
20
  ## Installation
19
21
 
22
+ ### Python package
23
+
20
24
  Install Python CLI package [renfe-cli](https://pypi.org/project/renfe-cli/)
21
25
 
22
26
  ```bash
23
27
  pip install renfe-cli --upgrade
24
28
  ```
25
29
 
30
+ ### Rust crate (optional)
31
+
32
+ Install the Rust crate [renfe-cli](https://crates.io/crates/renfe-cli)
33
+
34
+ ```bash
35
+ cargo install renfe-cli
36
+ ```
37
+
26
38
  ## Usage (CLI)
27
39
 
28
40
  The CLI uses the official and latest Renfe's GTFS dataset, from [Horarios de alta velocidad, larga distancia y media distancia](https://data.renfe.com/dataset/horarios-de-alta-velocidad-larga-distancia-y-media-distancia), by default. Optionally, one can enable searching over [Renfe Cercanías GTFS dataset](https://data.renfe.com/dataset/horarios-cercanias) (expect longer load time in this case).
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "renfe-cli"
7
- requires-python = ">=3.7"
7
+ requires-python = ">=3.8"
8
8
  authors = [
9
9
  {name = "Gerard Castillo Lasheras", email = "gerardcl@gmail.com"},
10
10
  ]
@@ -1,9 +1,10 @@
1
+ pub mod cli;
2
+ pub mod renfe;
3
+
1
4
  use pyo3::prelude::*;
2
5
 
3
- mod renfe;
4
- use renfe::{Renfe, Schedule, Station};
5
- mod cli;
6
6
  use cli::main;
7
+ use renfe::{Renfe, Schedule, Station};
7
8
 
8
9
  /// A Python module implemented in Rust. The name of this function must match
9
10
  /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to
@@ -0,0 +1,10 @@
1
+ use renfe_cli::cli;
2
+
3
+ fn main() -> Result<(), pyo3::PyErr> {
4
+ // Initialize the Python interpreter required
5
+ pyo3::prepare_freethreaded_python();
6
+
7
+ cli::main()?;
8
+
9
+ Ok(())
10
+ }
@@ -1,8 +1,7 @@
1
- use std::io::Read;
2
-
3
1
  use chrono::{Datelike, NaiveDate, NaiveTime, TimeDelta, Timelike};
4
2
  use gtfs_structures::Gtfs;
5
3
  use pyo3::{exceptions::PyValueError, pyclass, pymethods, PyResult};
4
+ use std::io::Read;
6
5
 
7
6
  #[pyclass]
8
7
  pub struct Renfe {
@@ -1,175 +0,0 @@
1
- # This file is autogenerated by maturin v1.3.2
2
- # To update, run
3
- #
4
- # maturin generate-ci github
5
- #
6
- name: CICD
7
-
8
- on:
9
- push:
10
- branches:
11
- - 'main'
12
- tags:
13
- - '*'
14
- pull_request:
15
- branches: [ main ]
16
- workflow_dispatch:
17
-
18
- permissions:
19
- contents: read
20
-
21
- jobs:
22
-
23
- test:
24
- name: Tests
25
- strategy:
26
- matrix:
27
- os: [ubuntu-latest, macos-latest, windows-latest]
28
- runs-on: ${{ matrix.os }}
29
- steps:
30
- - uses: actions/checkout@v3
31
- - uses: actions-rs/toolchain@v1
32
- with:
33
- profile: minimal
34
- toolchain: stable
35
- override: true
36
- - uses: actions-rs/cargo@v1
37
- with:
38
- command: test
39
-
40
- fmt:
41
- name: Rustfmt
42
- runs-on: ubuntu-latest
43
- steps:
44
- - uses: actions/checkout@v3
45
- - uses: actions-rs/toolchain@v1
46
- with:
47
- profile: minimal
48
- toolchain: stable
49
- override: true
50
- - run: rustup component add rustfmt
51
- - uses: actions-rs/cargo@v1
52
- with:
53
- command: fmt
54
- args: --all -- --check
55
-
56
- clippy:
57
- name: Build Clippy
58
- runs-on: ubuntu-latest
59
- strategy:
60
- matrix:
61
- rust:
62
- - stable
63
- - 1.72.0
64
- steps:
65
- - uses: actions/checkout@v3
66
- - uses: actions-rs/toolchain@v1
67
- with:
68
- profile: minimal
69
- toolchain: ${{ matrix.rust }}
70
- override: true
71
- - run: rustup component add clippy
72
- - uses: actions-rs/cargo@v1
73
- with:
74
- command: clippy
75
- args: -- -D warnings
76
-
77
- linux:
78
- runs-on: ubuntu-latest
79
- strategy:
80
- matrix:
81
- target: [x86_64, x86, armv7, s390x, ppc64le]
82
- steps:
83
- - uses: actions/checkout@v3
84
- - uses: actions/setup-python@v4
85
- with:
86
- python-version: '3.10'
87
- - name: Build wheels
88
- uses: PyO3/maturin-action@v1
89
- with:
90
- target: ${{ matrix.target }}
91
- args: --release --out dist --find-interpreter
92
- sccache: 'true'
93
- manylinux: auto
94
- - name: Upload wheels
95
- uses: actions/upload-artifact@v3
96
- with:
97
- name: wheels
98
- path: dist
99
-
100
- windows:
101
- runs-on: windows-latest
102
- strategy:
103
- matrix:
104
- target: [x64, x86]
105
- steps:
106
- - uses: actions/checkout@v3
107
- - uses: actions/setup-python@v4
108
- with:
109
- python-version: '3.10'
110
- architecture: ${{ matrix.target }}
111
- - name: Build wheels
112
- uses: PyO3/maturin-action@v1
113
- with:
114
- target: ${{ matrix.target }}
115
- args: --release --out dist --find-interpreter
116
- sccache: 'true'
117
- - name: Upload wheels
118
- uses: actions/upload-artifact@v3
119
- with:
120
- name: wheels
121
- path: dist
122
-
123
- macos:
124
- runs-on: macos-latest
125
- strategy:
126
- matrix:
127
- target: [x86_64, aarch64]
128
- steps:
129
- - uses: actions/checkout@v3
130
- - uses: actions/setup-python@v4
131
- with:
132
- python-version: '3.10'
133
- - name: Build wheels
134
- uses: PyO3/maturin-action@v1
135
- with:
136
- target: ${{ matrix.target }}
137
- args: --release --out dist --find-interpreter
138
- sccache: 'true'
139
- - name: Upload wheels
140
- uses: actions/upload-artifact@v3
141
- with:
142
- name: wheels
143
- path: dist
144
-
145
- sdist:
146
- runs-on: ubuntu-latest
147
- steps:
148
- - uses: actions/checkout@v3
149
- - name: Build sdist
150
- uses: PyO3/maturin-action@v1
151
- with:
152
- command: sdist
153
- args: --out dist
154
- - name: Upload sdist
155
- uses: actions/upload-artifact@v3
156
- with:
157
- name: wheels
158
- path: dist
159
-
160
- release:
161
- name: Release
162
- runs-on: ubuntu-latest
163
- if: "startsWith(github.ref, 'refs/tags/')"
164
- needs: [linux, windows, macos, sdist]
165
- steps:
166
- - uses: actions/download-artifact@v3
167
- with:
168
- name: wheels
169
- - name: Publish to PyPI
170
- uses: PyO3/maturin-action@v1
171
- env:
172
- MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
173
- with:
174
- command: upload
175
- args: --non-interactive --skip-existing *
File without changes
File without changes
File without changes
File without changes