Skip to content

Commit db142fa

Browse files
my1e5jvdd
andauthored
feat: add support for Python 3.14 (#89)
* feat: add support for Python 3.14 Co-authored by: Dimitris Iliopoulos <[email protected]> * fix: ruff lint errors and update ruff config in pyproject.toml * Update .github/workflows/ci-tsdownsample.yml --------- Co-authored-by: Jeroen Van Der Donckt <[email protected]>
1 parent 7e2f14a commit db142fa

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

.github/workflows/ci-tsdownsample.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
matrix:
4747
os: ['windows-latest', 'macOS-latest', 'ubuntu-latest']
4848
rust: ['nightly'] # ['stable', 'beta']
49-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', "3.13"]
49+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
5050

5151
env:
5252
PYTHON: ${{ matrix.python-version }}
@@ -155,7 +155,7 @@ jobs:
155155
target: ${{ matrix.target }}
156156
manylinux: ${{ matrix.manylinux || 'auto' }}
157157
container: ${{ matrix.container }}
158-
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13' }}
158+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 3.14' }}
159159

160160
- run: ${{ matrix.ls || 'ls -lh' }} dist/
161161

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ license = "MIT"
99

1010
[dependencies]
1111
downsample_rs = { path = "downsample_rs", features = ["half"]}
12-
pyo3 = { version = "0.22", features = ["extension-module"] }
13-
numpy = { version = "0.22", features = ["half"] }
12+
pyo3 = { version = "0.26", features = ["extension-module"] }
13+
numpy = { version = "0.26", features = ["half"] }
1414
half = { version = "2.3.1", default-features = false }
1515
paste = { version = "1.0.14", default-features = false }
1616

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
'Programming Language :: Python :: 3.11',
2323
'Programming Language :: Python :: 3.12',
2424
'Programming Language :: Python :: 3.13',
25+
'Programming Language :: Python :: 3.14',
2526
'Operating System :: POSIX',
2627
'Operating System :: MacOS :: MacOS X',
2728
'Operating System :: Microsoft :: Windows'
@@ -39,8 +40,10 @@ module-name = "tsdownsample._rust._tsdownsample_rs" # The path to place the comp
3940

4041
# Linting
4142
[tool.ruff]
42-
select = ["E", "F", "I"]
4343
line-length = 88
44+
45+
[tool.ruff.lint]
46+
select = ["E", "F", "I"]
4447
extend-select = ["Q"]
4548
ignore = ["E402", "F403"]
4649

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ macro_rules! _create_pyfunc_without_x {
2525
) -> Bound<'py, PyArray1<usize>> {
2626
let y = y.as_slice().unwrap();
2727
let sampled_indices = $resample_mod::$resample_fn(y, n_out);
28-
sampled_indices.into_pyarray_bound(py)
28+
sampled_indices.into_pyarray(py)
2929
}
3030
// Add the function to the module
3131
$mod.add_wrapped(wrap_pyfunction!($name))?;
@@ -44,7 +44,7 @@ macro_rules! _create_pyfunc_without_x_with_ratio {
4444
) -> Bound<'py, PyArray1<usize>> {
4545
let y = y.as_slice().unwrap();
4646
let sampled_indices = $resample_mod::$resample_fn(y, n_out, ratio);
47-
sampled_indices.into_pyarray_bound(py)
47+
sampled_indices.into_pyarray(py)
4848
}
4949
// Add the function to the module
5050
$mod.add_wrapped(wrap_pyfunction!($name))?;
@@ -84,7 +84,7 @@ macro_rules! _create_pyfunc_with_x {
8484
let x = x.as_slice().unwrap();
8585
let y = y.as_slice().unwrap();
8686
let sampled_indices = $resample_mod::$resample_fn(x, y, n_out);
87-
sampled_indices.into_pyarray_bound(py)
87+
sampled_indices.into_pyarray(py)
8888
}
8989
// Add the function to the module
9090
$mod.add_wrapped(wrap_pyfunction!($name))?;
@@ -105,7 +105,7 @@ macro_rules! _create_pyfunc_with_x_with_ratio {
105105
let x = x.as_slice().unwrap();
106106
let y = y.as_slice().unwrap();
107107
let sampled_indices = $resample_mod::$resample_fn(x, y, n_out, ratio);
108-
sampled_indices.into_pyarray_bound(py)
108+
sampled_indices.into_pyarray(py)
109109
}
110110
// Add the function to the module
111111
$mod.add_wrapped(wrap_pyfunction!($name))?;
@@ -258,7 +258,7 @@ use downsample_rs::minmax as minmax_mod;
258258
fn minmax(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
259259
// ----------------- SEQUENTIAL
260260

261-
let sequential_mod = PyModule::new_bound(_py, "sequential")?;
261+
let sequential_mod = PyModule::new(_py, "sequential")?;
262262

263263
// ----- WITHOUT X
264264
{
@@ -274,7 +274,7 @@ fn minmax(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
274274

275275
// ----------------- PARALLEL
276276

277-
let parallel_mod = PyModule::new_bound(_py, "parallel")?;
277+
let parallel_mod = PyModule::new(_py, "parallel")?;
278278

279279
// ----- WITHOUT X
280280
{
@@ -304,7 +304,7 @@ use downsample_rs::m4 as m4_mod;
304304
fn m4(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
305305
// ----------------- SEQUENTIAL
306306

307-
let sequential_mod = PyModule::new_bound(_py, "sequential")?;
307+
let sequential_mod = PyModule::new(_py, "sequential")?;
308308

309309
// ----- WITHOUT X
310310
{
@@ -320,7 +320,7 @@ fn m4(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
320320

321321
// ----------------- PARALLEL
322322

323-
let parallel_mod = PyModule::new_bound(_py, "parallel")?;
323+
let parallel_mod = PyModule::new(_py, "parallel")?;
324324

325325
// ----- WITHOUT X
326326
{
@@ -350,7 +350,7 @@ use downsample_rs::lttb as lttb_mod;
350350
fn lttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
351351
// ----------------- SEQUENTIAL
352352

353-
let sequential_mod = PyModule::new_bound(_py, "sequential")?;
353+
let sequential_mod = PyModule::new(_py, "sequential")?;
354354

355355
// Create the Python functions for the module
356356
// ----- WITHOUT X
@@ -378,7 +378,7 @@ use downsample_rs::minmaxlttb as minmaxlttb_mod;
378378
fn minmaxlttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
379379
// ----------------- SEQUENTIAL
380380

381-
let sequential_mod = PyModule::new_bound(_py, "sequential")?;
381+
let sequential_mod = PyModule::new(_py, "sequential")?;
382382

383383
// ----- WITHOUT X
384384
{
@@ -394,7 +394,7 @@ fn minmaxlttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
394394

395395
// ----------------- PARALLEL
396396

397-
let parallel_mod = PyModule::new_bound(_py, "parallel")?;
397+
let parallel_mod = PyModule::new(_py, "parallel")?;
398398

399399
// ----- WITHOUT X
400400
{

tests/test_rust_mods.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import tsdownsample._rust._tsdownsample_rs as tsds_rs
12
from test_config import (
23
rust_primitive_types_x,
34
rust_primitive_types_y,
45
rust_primitive_types_y_nan,
56
)
67

7-
import tsdownsample._rust._tsdownsample_rs as tsds_rs
8-
98

109
def _test_rust_mod_correctly_build(mod, sub_mods, has_x_impl: bool):
1110
# Without x

0 commit comments

Comments
 (0)