Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ jobs:
cmd: "pytest -m lcm"
dev-image: dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true') && needs.dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }}

run-mypy:
needs: [check-changes, ros-dev]
if: always()
uses: ./.github/workflows/tests.yml
secrets: inherit
with:
should-run: ${{
needs.check-changes.result == 'success' &&
((needs.ros-dev.result == 'success') ||
(needs.ros-dev.result == 'skipped' &&
needs.check-changes.outputs.tests == 'true'))
}}
cmd: "MYPYPATH=/opt/ros/humble/lib/python3.10/site-packages mypy dimos"
dev-image: ros-dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true' || needs.check-changes.outputs.ros == 'true') && needs.ros-dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }}

# Run module tests directly to avoid pytest forking issues
# run-module-tests:
# needs: [check-changes, dev]
Expand Down
19 changes: 19 additions & 0 deletions bin/mypy-ros
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

cd "$ROOT"

main() {
if [ -z "$(docker images -q dimos-ros-dev)" ]; then
(cd docker/ros; docker build -t dimos-ros .)
docker build -t dimos-ros-python --build-arg FROM_IMAGE=dimos-ros -f docker/python/Dockerfile .
docker build -t dimos-ros-dev --build-arg FROM_IMAGE=dimos-ros-python -f docker/dev/Dockerfile .
fi

docker run --rm -v $(pwd):/app -w /app dimos-ros-dev bash -c "source /opt/ros/humble/setup.bash && MYPYPATH=/opt/ros/humble/lib/python3.10/site-packages mypy dimos"
}

main "$@"
106 changes: 0 additions & 106 deletions bin/mypy-strict

This file was deleted.

2 changes: 1 addition & 1 deletion dimos/core/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def transport(self) -> Transport[T]:
def publish(self, msg) -> None: # type: ignore[no-untyped-def]
self.transport.broadcast(self, msg) # type: ignore[arg-type]

@transport.setter # type: ignore[attr-defined, misc, no-redef]
@transport.setter # type: ignore[attr-defined, misc, no-redef, untyped-decorator]
def transport(self, value: Transport[T]) -> None:
self.owner.set_transport(self.name, value).result() # type: ignore[union-attr]
self._transport = value
2 changes: 1 addition & 1 deletion dimos/hardware/camera/zed/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def __init__( # type: ignore[no-untyped-def]
self.tf = TF()

# Initialize storage for recording if path provided
self.storages = None
self.storages: dict[str, Any] | None = None
if self.recording_path:
from dimos.utils.testing import TimedSensorStorage

Expand Down
4 changes: 2 additions & 2 deletions dimos/hardware/gstreamer_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
if "/usr/lib/python3/dist-packages" not in sys.path:
sys.path.insert(0, "/usr/lib/python3/dist-packages")

import gi # type: ignore[import-not-found]
import gi # type: ignore[import-untyped,import-not-found]

gi.require_version("Gst", "1.0")
gi.require_version("GstApp", "1.0")
from gi.repository import GLib, Gst # type: ignore[import-not-found]
from gi.repository import GLib, Gst # type: ignore[import-untyped,import-not-found]

logger = setup_logger(level=logging.INFO)

Expand Down
4 changes: 2 additions & 2 deletions dimos/hardware/gstreamer_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
if "/usr/lib/python3/dist-packages" not in sys.path:
sys.path.insert(0, "/usr/lib/python3/dist-packages")

import gi # type: ignore[import-not-found]
import gi # type: ignore[import-untyped,import-not-found]

gi.require_version("Gst", "1.0")
gi.require_version("GstVideo", "1.0")
from gi.repository import GLib, Gst # type: ignore[import-not-found]
from gi.repository import GLib, Gst # type: ignore[import-untyped,import-not-found]

# Initialize GStreamer
Gst.init(None)
Expand Down
2 changes: 1 addition & 1 deletion dimos/hardware/piper_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from piper_sdk import * # type: ignore[import-not-found] # from the official Piper SDK
import pytest
from reactivex.disposable import Disposable
from scipy.spatial.transform import Rotation as R
from scipy.spatial.transform import Rotation as R # type: ignore[import-untyped]

import dimos.core as core
from dimos.core import In, Module, rpc
Expand Down
2 changes: 1 addition & 1 deletion dimos/manipulation/visual_servoing/pbvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from dimos_lcm.vision_msgs import Detection3D # type: ignore[import-untyped]
import numpy as np
from scipy.spatial.transform import Rotation as R
from scipy.spatial.transform import Rotation as R # type: ignore[import-untyped]

from dimos.manipulation.visual_servoing.utils import (
create_pbvs_visualization,
Expand Down
2 changes: 1 addition & 1 deletion dimos/models/vl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def warmup(self) -> None:
pass

# requery once if JSON parsing fails
@retry(max_retries=2, on_exception=json.JSONDecodeError, delay=0.0) # type: ignore[misc]
@retry(max_retries=2, on_exception=json.JSONDecodeError, delay=0.0) # type: ignore[misc, untyped-decorator]
def query_json(self, image: Image, query: str) -> dict: # type: ignore[type-arg]
response = self.query(image, query)
return extract_json(response) # type: ignore[return-value]
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/Pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
Point as ROSPoint,
Pose as ROSPose,
Quaternion as ROSQuaternion,
Expand Down
4 changes: 3 additions & 1 deletion dimos/msgs/geometry_msgs/PoseStamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
from dimos_lcm.geometry_msgs import PoseStamped as LCMPoseStamped # type: ignore[import-untyped]

try:
from geometry_msgs.msg import PoseStamped as ROSPoseStamped # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[import-untyped]
PoseStamped as ROSPoseStamped, # type: ignore[attr-defined]
)
except ImportError:
ROSPoseStamped = None # type: ignore[assignment, misc]

Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/PoseWithCovariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from plum import dispatch

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
PoseWithCovariance as ROSPoseWithCovariance,
)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/PoseWithCovarianceStamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from plum import dispatch

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
PoseWithCovarianceStamped as ROSPoseWithCovarianceStamped,
)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/Quaternion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from dimos_lcm.geometry_msgs import Quaternion as LCMQuaternion # type: ignore[import-untyped]
import numpy as np
from plum import dispatch
from scipy.spatial.transform import Rotation as R
from scipy.spatial.transform import Rotation as R # type: ignore[import-untyped]

from dimos.msgs.geometry_msgs.Vector3 import Vector3

Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/Transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
Quaternion as ROSQuaternion,
Transform as ROSTransform,
TransformStamped as ROSTransformStamped,
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/Twist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from plum import dispatch

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
Twist as ROSTwist,
Vector3 as ROSVector3,
)
Expand Down
4 changes: 3 additions & 1 deletion dimos/msgs/geometry_msgs/TwistStamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from plum import dispatch

try:
from geometry_msgs.msg import TwistStamped as ROSTwistStamped # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[import-untyped]
TwistStamped as ROSTwistStamped, # type: ignore[attr-defined]
)
except ImportError:
ROSTwistStamped = None # type: ignore[assignment, misc]

Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/TwistWithCovariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from plum import dispatch

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
TwistWithCovariance as ROSTwistWithCovariance,
)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/geometry_msgs/TwistWithCovarianceStamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from plum import dispatch

try:
from geometry_msgs.msg import ( # type: ignore[attr-defined]
from geometry_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
TwistWithCovarianceStamped as ROSTwistWithCovarianceStamped,
)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/nav_msgs/OccupancyGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
from dimos_lcm.std_msgs import Time as LCMTime # type: ignore[import-untyped]
import numpy as np
from scipy import ndimage
from scipy import ndimage # type: ignore[import-untyped]

from dimos.msgs.geometry_msgs import Pose, Vector3, VectorLike
from dimos.types.timestamped import Timestamped
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/nav_msgs/Odometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from plum import dispatch

try:
from nav_msgs.msg import Odometry as ROSOdometry # type: ignore[attr-defined]
from nav_msgs.msg import Odometry as ROSOdometry # type: ignore[attr-defined, import-untyped]
except ImportError:
ROSOdometry = None # type: ignore[assignment, misc]

Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/nav_msgs/Path.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from dimos_lcm.std_msgs import Header as LCMHeader, Time as LCMTime # type: ignore[import-untyped]

try:
from nav_msgs.msg import Path as ROSPath # type: ignore[attr-defined]
from nav_msgs.msg import Path as ROSPath # type: ignore[attr-defined, import-untyped]
except ImportError:
ROSPath = None # type: ignore[assignment, misc]

Expand Down
4 changes: 2 additions & 2 deletions dimos/msgs/sensor_msgs/CameraInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

# Import ROS types
try:
from sensor_msgs.msg import ( # type: ignore[attr-defined]
from sensor_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
CameraInfo as ROSCameraInfo,
RegionOfInterest as ROSRegionOfInterest,
)
from std_msgs.msg import Header as ROSHeader # type: ignore[attr-defined]
from std_msgs.msg import Header as ROSHeader # type: ignore[attr-defined, import-untyped]

ROS_AVAILABLE = True
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/sensor_msgs/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
cp = None

try:
from sensor_msgs.msg import Image as ROSImage # type: ignore[attr-defined]
from sensor_msgs.msg import Image as ROSImage # type: ignore[attr-defined, import-untyped]
except ImportError:
ROSImage = None # type: ignore[assignment, misc]

Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/sensor_msgs/Joy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from dimos_lcm.sensor_msgs import Joy as LCMJoy # type: ignore[import-untyped]

try:
from sensor_msgs.msg import Joy as ROSJoy # type: ignore[attr-defined]
from sensor_msgs.msg import Joy as ROSJoy # type: ignore[attr-defined, import-untyped]
except ImportError:
ROSJoy = None # type: ignore[assignment, misc]

Expand Down
4 changes: 2 additions & 2 deletions dimos/msgs/sensor_msgs/PointCloud2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

# Import ROS types
try:
from sensor_msgs.msg import ( # type: ignore[attr-defined]
from sensor_msgs.msg import ( # type: ignore[attr-defined, import-untyped]
PointCloud2 as ROSPointCloud2,
PointField as ROSPointField,
)
from std_msgs.msg import Header as ROSHeader # type: ignore[attr-defined]
from std_msgs.msg import Header as ROSHeader # type: ignore[attr-defined, import-untyped]

ROS_AVAILABLE = True
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion dimos/msgs/std_msgs/Bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from dimos_lcm.std_msgs import Bool as LCMBool # type: ignore[import-untyped]

try:
from std_msgs.msg import Bool as ROSBool # type: ignore[attr-defined]
from std_msgs.msg import Bool as ROSBool # type: ignore[attr-defined, import-untyped]
except ImportError:
ROSBool = None # type: ignore[assignment, misc]

Expand Down
Loading
Loading