diff --git a/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi b/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi index d3c6987a..57b590d2 100644 --- a/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +++ b/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi @@ -1,3 +1,4 @@ +# pyright: reportMissingTypeArgument=false import numpy as np from jaxtyping import Float, Int, UInt diff --git a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi index 40446530..efdeab4d 100644 --- a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi +++ b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi @@ -1,3 +1,4 @@ +# pyright: reportMissingTypeArgument=false from collections.abc import Iterator, Sized import numpy as np diff --git a/differt/src/differt/geometry/_triangle_mesh.py b/differt/src/differt/geometry/_triangle_mesh.py index 9ebfb290..6138114e 100644 --- a/differt/src/differt/geometry/_triangle_mesh.py +++ b/differt/src/differt/geometry/_triangle_mesh.py @@ -471,7 +471,7 @@ def plane( normal = normalize(w)[0] u, v = orthogonal_basis( - normal, # type: ignore[reportArgumentType] + normal, normalize=True, ) diff --git a/differt/src/differt/py.typed b/differt/src/differt/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/differt/src/differt/rt/_utils.py b/differt/src/differt/rt/_utils.py index 137464af..9878d0a0 100644 --- a/differt/src/differt/rt/_utils.py +++ b/differt/src/differt/rt/_utils.py @@ -3,7 +3,7 @@ import sys from collections.abc import Callable, Iterator, Sized from functools import cache -from typing import Any, Generic, TypeVar +from typing import Any, TypeVar import equinox as eqx import jax @@ -24,7 +24,7 @@ @typechecker -class SizedIterator(Iterator, Sized, Generic[_T]): +class SizedIterator(Iterator[_T], Sized): """A custom generic class that is both :class:`Iterator` and :class:`Sized`. The main purpose of this class is to be able to use @@ -330,7 +330,7 @@ def rays_intersect_any_triangle( dtype = jnp.result_type(ray_origins, ray_directions, triangle_vertices) hit_tol = 10.0 * jnp.finfo(dtype).eps - hit_threshold = 1.0 - hit_tol # type: ignore[reportOperatorIssue] + hit_threshold = 1.0 - hit_tol # Put 'num_triangles' axis as leading axis triangle_vertices = jnp.moveaxis(triangle_vertices, -3, 0) diff --git a/differt/src/differt/scene/_triangle_scene.py b/differt/src/differt/scene/_triangle_scene.py index 6554df1f..74a16604 100644 --- a/differt/src/differt/scene/_triangle_scene.py +++ b/differt/src/differt/scene/_triangle_scene.py @@ -943,7 +943,7 @@ def compute_paths( # noqa: C901 if path_candidates is None: path_candidates = generate_all_path_candidates( num_objects, - order, # type: ignore[reportArgumentType] + order, ) if self.mesh.assume_quads: diff --git a/differt/tests/em/test_utd.py b/differt/tests/em/test_utd.py index 1e3366aa..7cb0b3d5 100644 --- a/differt/tests/em/test_utd.py +++ b/differt/tests/em/test_utd.py @@ -1,3 +1,4 @@ +# pyright: reportMissingTypeArgument=false import chex import jax.numpy as jnp import numpy as np diff --git a/differt/tests/plotting/test_core.py b/differt/tests/plotting/test_core.py index abaafa6e..f900d5de 100644 --- a/differt/tests/plotting/test_core.py +++ b/differt/tests/plotting/test_core.py @@ -1,3 +1,4 @@ +# pyright: reportMissingTypeArgument=false from contextlib import nullcontext as does_not_raise import numpy as np diff --git a/differt/tests/plotting/test_utils.py b/differt/tests/plotting/test_utils.py index 4302ae83..6abd0da8 100644 --- a/differt/tests/plotting/test_utils.py +++ b/differt/tests/plotting/test_utils.py @@ -23,12 +23,12 @@ from pytest_missing_modules.plugin import MissingModulesContextGenerator -@dispatch # type: ignore[reportArgumentType] +@dispatch def my_plot_unimplemented(**kwargs: Any) -> SceneCanvas | MplFigure | Figure: # type: ignore[reportReturnType] """A plot function with no backend implementation.""" -@dispatch # type: ignore[reportArgumentType] +@dispatch def my_plot(**kwargs: Any) -> SceneCanvas | MplFigure | Figure: # type: ignore[reportReturnType] """A plot function with dummy backend implementations.""" diff --git a/pyproject.toml b/pyproject.toml index 1b2207df..1f360fad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,8 +122,11 @@ precision = 2 omit = ["**/*/conftest.py"] [tool.pyright] -deprecateTypingAliases = true include = ["differt/src/differt", "differt/tests", "differt-core/src/differt_core"] +reportIncompatibleMethodOverride = true +reportIncompatibleVariableOverride = false # Incompatible with eqx.AbstractVar +reportMissingTypeArgument = true +reportUnnecessaryTypeIgnoreComment = true venv = ".venv" venvPath = "."