Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix doctest failures and build-docs task (#3456)

Edgar Ribabc7b3e3d657a
diff --git a/kornia/core/_compat.py b/kornia/core/_compat.py
index d12d3191f..fa5af28b5 100644
--- a/kornia/core/_compat.py
+++ b/kornia/core/_compat.py
@@ -33,10 +33,6 @@ def torch_version() -> str:
Returns:
The clean version string (e.g., "2.0.1" from "2.0.1+cu118").
-
- Example:
- >>> torch_version()
- '2.0.1'
"""
return torch.__version__.partition("+")[0]
@@ -53,11 +49,6 @@ def torch_version_lt(major: int, minor: int, patch: int) -> bool:
True if the current PyTorch version is strictly less than the specified version,
False otherwise.
- Example:
- >>> torch_version_lt(2, 0, 0) # True if PyTorch < 2.0.0
- False
- >>> torch_version_lt(3, 0, 0) # True if PyTorch < 3.0.0
- True
"""
_version = version.parse(torch_version())
return _version < version.parse(f"{major}.{minor}.{patch}")
@@ -75,11 +66,6 @@ def torch_version_le(major: int, minor: int, patch: int) -> bool:
True if the current PyTorch version is less than or equal to the specified version,
False otherwise.
- Example:
- >>> torch_version_le(2, 0, 0) # True if PyTorch <= 2.0.0
- True
- >>> torch_version_le(1, 13, 0) # True if PyTorch <= 1.13.0
- True
"""
_version = version.parse(torch_version())
return _version <= version.parse(f"{major}.{minor}.{patch}")
diff --git a/kornia/feature/matching.py b/kornia/feature/matching.py
index 384641b91..7cf7a76dc 100644
--- a/kornia/feature/matching.py
+++ b/kornia/feature/matching.py
@@ -387,7 +387,7 @@ class DescriptorMatcherWithSteerer(nn.Module):
Example:
>>> import kornia as K
>>> import kornia.feature as KF
- >>> device = K.utils.get_cuda_or_mps_device_if_available()
+ >>> device = K.core.utils.get_cuda_or_mps_device_if_available()
>>> img1 = torch.randn([1, 3, 768, 768], device=device)
>>> img2 = torch.randn([1, 3, 768, 768], device=device)
>>> dedode = KF.DeDoDe.from_pretrained(detector_weights="L-C4-v2", descriptor_weights="B-SO2").to(device)
diff --git a/pixi.toml b/pixi.toml
index b410780c4..5bd97bad6 100644
--- a/pixi.toml
+++ b/pixi.toml
@@ -50,7 +50,9 @@ doctest = { cmd = "uv run pytest -v --doctest-modules kornia/" }
toml-fmt = { cmd = "tombi format", description = "Format TOML files" }
toml-fmt-check = { cmd = "tombi format --check", description = "Check TOML formatting" }
# Docs
-build-docs = { cmd = "uv run sphinx-build -W -b html docs/source docs/build/html" }
+build-docs = { cmd = "uv run python -m sphinx -W -b html docs/source docs/build/html", depends-on = [
+ "install-docs"
+] }
# Utility
clean = { cmd = "find . -type f -name '*.pyc' -delete && find . -type d -name '__pycache__' -delete && rm -rf .venv" }