From 9881565be6767fad71df6b8e1adfd6f808ea9326 Mon Sep 17 00:00:00 2001 From: Yohei Tamura Date: Mon, 18 Jul 2022 12:44:22 +0900 Subject: [PATCH 1/3] add python3.10 --- .github/workflows/main.yml | 2 +- .github/workflows/manylinux_build.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 139a1d1..af1f9d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.7, 3.8, 3.9, 3.10] os: [macos-latest, windows-latest, ubuntu-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/manylinux_build.yml b/.github/workflows/manylinux_build.yml index 03116ea..274fcc1 100644 --- a/.github/workflows/manylinux_build.yml +++ b/.github/workflows/manylinux_build.yml @@ -13,6 +13,7 @@ jobs: - 3.7 - 3.8 - 3.9 + - 3.10 container: image: quay.io/pypa/manylinux2010_x86_64 env: From bec31500b3553097940f8b09f3f9085365308157 Mon Sep 17 00:00:00 2001 From: Yohei Tamura Date: Mon, 18 Jul 2022 13:00:37 +0900 Subject: [PATCH 2/3] update pyo3 --- python/src/lib.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/python/src/lib.rs b/python/src/lib.rs index 26e8583..0dc9173 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -1,24 +1,24 @@ #![allow(clippy::deprecated)] use pyo3::prelude::*; -use tokenizations::{get_alignments, get_charmap, Alignment, CharMap}; +use tokenizations::{ + get_alignments as get_alignments_orig, get_charmap as get_charmap_orig, Alignment, CharMap, +}; + +#[pyfunction] +pub fn get_alignments(a: Vec<&str>, b: Vec<&str>) -> PyResult<(Alignment, Alignment)> { + Ok(get_alignments_orig(&a, &b)) +} + +#[pyfunction] +pub fn get_charmap(a: &str, b: &str) -> PyResult<(CharMap, CharMap)> { + Ok(get_charmap_orig(a, b)) +} #[pymodule] fn tokenizations(_py: Python, m: &PyModule) -> PyResult<()> { m.add("__version__", "0.8.4")?; - - #[pyfn(m, "get_alignments")] - pub fn get_alignments_py( - _py: Python, - a: Vec<&str>, - b: Vec<&str>, - ) -> PyResult<(Alignment, Alignment)> { - Ok(get_alignments(&a, &b)) - } - - #[pyfn(m, "get_charmap")] - pub fn get_charmap_py(_py: Python, a: &str, b: &str) -> PyResult<(CharMap, CharMap)> { - Ok(get_charmap(a, b)) - } + m.add_function(wrap_pyfunction!(get_alignments, m)?)?; + m.add_function(wrap_pyfunction!(get_charmap, m)?)?; Ok(()) } From 1c47524e8a1c863c1e34b2e2a8ee1a31afd6ebfc Mon Sep 17 00:00:00 2001 From: Yohei Tamura Date: Mon, 18 Jul 2022 13:02:23 +0900 Subject: [PATCH 3/3] fix ci --- .github/workflows/main.yml | 2 +- .github/workflows/manylinux_build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af1f9d3..14531c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.7, 3.8, 3.9, 3.10] + python-version: [3.7, 3.8, 3.9, "3.10"] os: [macos-latest, windows-latest, ubuntu-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/manylinux_build.yml b/.github/workflows/manylinux_build.yml index 274fcc1..1f15614 100644 --- a/.github/workflows/manylinux_build.yml +++ b/.github/workflows/manylinux_build.yml @@ -13,7 +13,7 @@ jobs: - 3.7 - 3.8 - 3.9 - - 3.10 + - "3.10" container: image: quay.io/pypa/manylinux2010_x86_64 env: