Skip to content

Commit

Permalink
Support Pydantic V2
Browse files Browse the repository at this point in the history
This updates the code to be compatible with Pydantic V2. We also
introduce a smoke test for importing `kiss_icp`. It's still just a smoke
test, but does a bit more than only calling `kiss_icp_pipeline
--version`. The latter would also pass with Pydantic V2 being installed,
while the import would fail.

Co-authored-by: pnikutta <[email protected]>
  • Loading branch information
ahans and pnikutta committed Jan 12, 2024
1 parent 3848ee9 commit 2ea5794
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ jobs:
- name: Test installation
run: |
kiss_icp_pipeline --version
- name: Run unittests
run: |
python -m pip install --verbose './python[test]'
pytest -rA --verbose ./python/
10 changes: 5 additions & 5 deletions python/kiss_icp/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from pathlib import Path
from typing import Any, Dict, Optional

from pydantic import BaseSettings, PrivateAttr
from pydantic import PrivateAttr
from pydantic_settings import BaseSettings

from kiss_icp.config.config import AdaptiveThresholdConfig, DataConfig, MappingConfig

Expand Down Expand Up @@ -60,10 +61,9 @@ def _yaml_source(self) -> Dict[str, Any]:
data = yaml.safe_load(cfg_file)
return data or {}

class Config:
@classmethod
def customise_sources(cls, init_settings, env_settings, file_secret_settings):
return init_settings, KISSConfig._yaml_source
@classmethod
def customise_sources(cls, init_settings, env_settings, file_secret_settings):
return init_settings, KISSConfig._yaml_source


def load_config(
Expand Down
9 changes: 8 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ dependencies = [
"natsort",
"numpy",
"plyfile",
"pydantic <2",
"pydantic>=2",
"pydantic-settings",
"pyquaternion",
"rich",
"tqdm",
Expand All @@ -53,6 +54,9 @@ all = [
"PyYAML",
"trimesh",
]
test = [
"pytest",
]
visualizer = [
"open3d>=0.13",
]
Expand Down Expand Up @@ -89,3 +93,6 @@ skip = ["*-musllinux*", "pp*", "cp36-*"]
[tool.cibuildwheel.macos]
environment = "MACOSX_DEPLOYMENT_TARGET=10.14"
archs = ["auto64", "arm64"]

[tool.pytest.ini_options]
testpaths = ['tests']
4 changes: 4 additions & 0 deletions python/tests/test_kiss_icp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def test_import():
from kiss_icp.kiss_icp import KissICP

assert KissICP is not None

0 comments on commit 2ea5794

Please sign in to comment.