Skip to content

Commit

Permalink
Add __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
dustalov committed Jun 17, 2024
1 parent a76305e commit 3e40b18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/evalica/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .evalica import py_bradley_terry as bradley_terry, py_newman as newman
from .evalica import __version__, py_bradley_terry as bradley_terry, py_newman as newman

__all__ = ['bradley_terry', 'newman']
__all__ = ['__version__', 'bradley_terry', 'newman']
2 changes: 2 additions & 0 deletions python/evalica/evalica.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ from typing import Tuple
import numpy as np
import numpy.typing as npt

__version__: str = ...

def py_bradley_terry(
m: npt.NDArray[np.int64]
) -> Tuple[npt.NDArray[np.float64], int]: ...
Expand Down
6 changes: 6 additions & 0 deletions python/evalica/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
import evalica


class TestMeta(unittest.TestCase):
def test_version(self) -> None:
self.assertIsInstance(evalica.__version__, str)
self.assertGreater(len(evalica.__version__), 0)


class TestUnordered(unittest.TestCase):
def setUp(self) -> None:
self.M: npt.NDArray[np.int64] = np.array([
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use numpy::{IntoPyArray, PyArray1, PyArray2};
use numpy::PyArrayMethods;
use numpy::{IntoPyArray, PyArray1, PyArray2};
use pyo3::prelude::*;

mod bradley_terry;
Expand Down Expand Up @@ -27,6 +27,7 @@ fn py_newman(

#[pymodule]
fn evalica(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
m.add_function(wrap_pyfunction!(py_bradley_terry, m)?)?;
m.add_function(wrap_pyfunction!(py_newman, m)?)?;
Ok(())
Expand Down

0 comments on commit 3e40b18

Please sign in to comment.