diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 139a1d1..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] + 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..1f15614 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: 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(()) }