From 7df2e16e6e2d9a2f9d9207ddab05c5de0602a9a3 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:48:01 +0100 Subject: [PATCH 1/3] feat: add support for Python 3.14 Co-authored by: Dimitris Iliopoulos --- .github/workflows/ci-tsdownsample.yml | 4 ++-- Cargo.toml | 4 ++-- pyproject.toml | 1 + src/lib.rs | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-tsdownsample.yml b/.github/workflows/ci-tsdownsample.yml index afcff60..91378a4 100644 --- a/.github/workflows/ci-tsdownsample.yml +++ b/.github/workflows/ci-tsdownsample.yml @@ -46,7 +46,7 @@ jobs: matrix: os: ['windows-latest', 'macOS-latest', 'ubuntu-latest'] rust: ['nightly'] # ['stable', 'beta'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', "3.13"] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', "3.13", "3.14"] env: PYTHON: ${{ matrix.python-version }} @@ -155,7 +155,7 @@ jobs: target: ${{ matrix.target }} manylinux: ${{ matrix.manylinux || 'auto' }} container: ${{ matrix.container }} - args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13' }} + args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13 3.14' }} - run: ${{ matrix.ls || 'ls -lh' }} dist/ diff --git a/Cargo.toml b/Cargo.toml index b0b2335..abac645 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ license = "MIT" [dependencies] downsample_rs = { path = "downsample_rs", features = ["half"]} -pyo3 = { version = "0.22", features = ["extension-module"] } -numpy = { version = "0.22", features = ["half"] } +pyo3 = { version = "0.26", features = ["extension-module"] } +numpy = { version = "0.26", features = ["half"] } half = { version = "2.3.1", default-features = false } paste = { version = "1.0.14", default-features = false } diff --git a/pyproject.toml b/pyproject.toml index 876db6e..e21311e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Operating System :: POSIX', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows' diff --git a/src/lib.rs b/src/lib.rs index 9cd30c2..f5a3786 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ macro_rules! _create_pyfunc_without_x { ) -> Bound<'py, PyArray1> { let y = y.as_slice().unwrap(); let sampled_indices = $resample_mod::$resample_fn(y, n_out); - sampled_indices.into_pyarray_bound(py) + sampled_indices.into_pyarray(py) } // Add the function to the module $mod.add_wrapped(wrap_pyfunction!($name))?; @@ -44,7 +44,7 @@ macro_rules! _create_pyfunc_without_x_with_ratio { ) -> Bound<'py, PyArray1> { let y = y.as_slice().unwrap(); let sampled_indices = $resample_mod::$resample_fn(y, n_out, ratio); - sampled_indices.into_pyarray_bound(py) + sampled_indices.into_pyarray(py) } // Add the function to the module $mod.add_wrapped(wrap_pyfunction!($name))?; @@ -84,7 +84,7 @@ macro_rules! _create_pyfunc_with_x { let x = x.as_slice().unwrap(); let y = y.as_slice().unwrap(); let sampled_indices = $resample_mod::$resample_fn(x, y, n_out); - sampled_indices.into_pyarray_bound(py) + sampled_indices.into_pyarray(py) } // Add the function to the module $mod.add_wrapped(wrap_pyfunction!($name))?; @@ -105,7 +105,7 @@ macro_rules! _create_pyfunc_with_x_with_ratio { let x = x.as_slice().unwrap(); let y = y.as_slice().unwrap(); let sampled_indices = $resample_mod::$resample_fn(x, y, n_out, ratio); - sampled_indices.into_pyarray_bound(py) + sampled_indices.into_pyarray(py) } // Add the function to the module $mod.add_wrapped(wrap_pyfunction!($name))?; @@ -258,7 +258,7 @@ use downsample_rs::minmax as minmax_mod; fn minmax(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- SEQUENTIAL - let sequential_mod = PyModule::new_bound(_py, "sequential")?; + let sequential_mod = PyModule::new(_py, "sequential")?; // ----- WITHOUT X { @@ -274,7 +274,7 @@ fn minmax(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- PARALLEL - let parallel_mod = PyModule::new_bound(_py, "parallel")?; + let parallel_mod = PyModule::new(_py, "parallel")?; // ----- WITHOUT X { @@ -304,7 +304,7 @@ use downsample_rs::m4 as m4_mod; fn m4(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- SEQUENTIAL - let sequential_mod = PyModule::new_bound(_py, "sequential")?; + let sequential_mod = PyModule::new(_py, "sequential")?; // ----- WITHOUT X { @@ -320,7 +320,7 @@ fn m4(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- PARALLEL - let parallel_mod = PyModule::new_bound(_py, "parallel")?; + let parallel_mod = PyModule::new(_py, "parallel")?; // ----- WITHOUT X { @@ -350,7 +350,7 @@ use downsample_rs::lttb as lttb_mod; fn lttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- SEQUENTIAL - let sequential_mod = PyModule::new_bound(_py, "sequential")?; + let sequential_mod = PyModule::new(_py, "sequential")?; // Create the Python functions for the module // ----- WITHOUT X @@ -378,7 +378,7 @@ use downsample_rs::minmaxlttb as minmaxlttb_mod; fn minmaxlttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- SEQUENTIAL - let sequential_mod = PyModule::new_bound(_py, "sequential")?; + let sequential_mod = PyModule::new(_py, "sequential")?; // ----- WITHOUT X { @@ -394,7 +394,7 @@ fn minmaxlttb(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // ----------------- PARALLEL - let parallel_mod = PyModule::new_bound(_py, "parallel")?; + let parallel_mod = PyModule::new(_py, "parallel")?; // ----- WITHOUT X { From 3e61508eaebb46149ed3baf4b53be1fc04dd5444 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:09:57 +0100 Subject: [PATCH 2/3] fix: ruff lint errors and update ruff config in pyproject.toml --- pyproject.toml | 4 +++- tests/test_rust_mods.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e21311e..59e10fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,8 +40,10 @@ module-name = "tsdownsample._rust._tsdownsample_rs" # The path to place the comp # Linting [tool.ruff] -select = ["E", "F", "I"] line-length = 88 + +[tool.ruff.lint] +select = ["E", "F", "I"] extend-select = ["Q"] ignore = ["E402", "F403"] diff --git a/tests/test_rust_mods.py b/tests/test_rust_mods.py index 8a50ab8..e0b3cd4 100644 --- a/tests/test_rust_mods.py +++ b/tests/test_rust_mods.py @@ -1,11 +1,10 @@ +import tsdownsample._rust._tsdownsample_rs as tsds_rs from test_config import ( rust_primitive_types_x, rust_primitive_types_y, rust_primitive_types_y_nan, ) -import tsdownsample._rust._tsdownsample_rs as tsds_rs - def _test_rust_mod_correctly_build(mod, sub_mods, has_x_impl: bool): # Without x From 1fed204de5b8a0e00b431a7935c393dc2868ace4 Mon Sep 17 00:00:00 2001 From: Jeroen Van Der Donckt <18898740+jvdd@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:28:28 +0200 Subject: [PATCH 3/3] Update .github/workflows/ci-tsdownsample.yml --- .github/workflows/ci-tsdownsample.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-tsdownsample.yml b/.github/workflows/ci-tsdownsample.yml index 91378a4..c56804f 100644 --- a/.github/workflows/ci-tsdownsample.yml +++ b/.github/workflows/ci-tsdownsample.yml @@ -46,7 +46,7 @@ jobs: matrix: os: ['windows-latest', 'macOS-latest', 'ubuntu-latest'] rust: ['nightly'] # ['stable', 'beta'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', "3.13", "3.14"] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] env: PYTHON: ${{ matrix.python-version }}