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
22 changes: 0 additions & 22 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: pre-commit
on:
pull_request:
push:
branches: [main]
branches: [dev_v0.0.8]

jobs:
pre-commit:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pytest

on:
push:
branches: [dev_v0.0.8]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install uv
uv pip install --system -e ".[dev]"
- name: Test with pytest
run: |
pytest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ docs/_build/
docs/build/
_build/
.doctrees/


# ruff
.ruff_cache/*
7 changes: 0 additions & 7 deletions .isort.cfg

This file was deleted.

29 changes: 6 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,14 @@ repos:
exclude: /README\.rst$|\.pot?$|\.ipynb$
args: ['--no-sort-keys', "--autofix"]

- repo: https://github.com/pycqa/isort
rev: 6.0.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files", '--line-length', '120']
- id: ruff
args: [--fix]
exclude: __init__.py$
- id: ruff-format
exclude: __init__.py$
- repo: https://github.com/ambv/black
rev: 25.1.0
hooks:
- id: black
language_version: python3.12
args: ['--line-length=120']
files: "\\.py$"
- repo: https://github.com/myint/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
exclude: __init__.py$
language_version: python3.12
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
project = "py123d"
copyright = "2025, 123D Contributors"
author = "123D Contributors"
release = "v0.0.7"
release = "v0.0.8"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -23,7 +23,6 @@
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx_copybutton",
"sphinx_inline_tabs",
"sphinx_autodoc_typehints",
"myst_parser",
]
Expand Down
10 changes: 5 additions & 5 deletions notebooks/01_scene_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"from py123d.api.scene.arrow.arrow_scene_builder import ArrowSceneBuilder\n",
"from py123d.api.scene.scene_filter import SceneFilter\n",
"\n",
"\n",
"# from py123d.common.multithreading.worker_ray import RayDistributed\n",
"# from py123d.common.multithreading.worker_ray import RayDistributed\n",
"from py123d.common.multithreading.worker_sequential import Sequential\n",
"from py123d.datatypes.sensors.pinhole_camera import PinholeCameraType\n",
"\n",
"# from py123d.datatypes.sensors.pinhole_camera_type import PinholeCameraType\n",
"\n",
"# splits = [\"kitti360_train\"]\n",
Expand Down Expand Up @@ -83,7 +83,7 @@
"\n",
"# worker = RayDistributed()\n",
"scenes = scene_builder.get_scenes(scene_filter, worker)\n",
"print(f\"Found {len(scenes)} scenes\")\n"
"print(f\"Found {len(scenes)} scenes\")"
]
},
{
Expand All @@ -101,7 +101,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"scene = scenes[0]\n",
"\n",
"log_metadata = scene.get_log_metadata()\n",
Expand All @@ -128,7 +127,6 @@
"source": [
"from py123d.visualization.viser.viser_viewer import ViserViewer\n",
"\n",
"\n",
"visualization_server = ViserViewer(scenes, scene_index=0)"
]
},
Expand All @@ -139,8 +137,10 @@
"metadata": {},
"outputs": [],
"source": [
"from py123d.geometry import EulerAngles\n",
"import numpy as np\n",
"\n",
"from py123d.geometry import EulerAngles\n",
"\n",
"euler_angles = EulerAngles(roll=0.0, pitch=0.0, yaw=np.pi)\n",
"euler_angles.roll\n",
"# 0.0\n",
Expand Down
30 changes: 10 additions & 20 deletions notebooks/bev_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"source": [
"from py123d.api.scene.arrow.arrow_scene_builder import ArrowSceneBuilder\n",
"from py123d.api.scene.scene_filter import SceneFilter\n",
"\n",
"\n",
"from py123d.common.multithreading.worker_sequential import Sequential\n",
"# from py123d.datatypes.sensors.pinhole_camera_type import PinholeCameraType"
]
Expand All @@ -24,11 +22,12 @@
"source": [
"# splits = [\"kitti360_train\"]\n",
"# splits = [\"nuscenes-mini_val\", \"nuscenes-mini_train\"]\n",
"splits = [\"nuplan-mini_test\", \"nuplan-mini_train\", \"nuplan-mini_val\"]\n",
"# splits = [\"nuplan-mini_test\", \"nuplan-mini_train\", \"nuplan-mini_val\"]\n",
"# splits = [\"carla_test\"]\n",
"# splits = [\"wopd_val\"]\n",
"# splits = [\"av2-sensor_train\"]\n",
"# splits = [\"pandaset_test\", \"pandaset_val\", \"pandaset_train\"]\n",
"splits = None\n",
"log_names = None\n",
"scene_uuids = None\n",
"\n",
Expand All @@ -45,7 +44,7 @@
"scene_builder = ArrowSceneBuilder()\n",
"worker = Sequential()\n",
"scenes = scene_builder.get_scenes(scene_filter, worker)\n",
"print(f\"Found {len(scenes)} scenes\")\n"
"print(f\"Found {len(scenes)} scenes\")"
]
},
{
Expand All @@ -59,25 +58,22 @@
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import shapely.geometry as geom\n",
"\n",
"from py123d.api.map.map_api import MapAPI\n",
"from py123d.api.scene.scene_api import SceneAPI\n",
"from py123d.datatypes.map_objects.map_layer_types import MapLayer\n",
"from py123d.datatypes.map_objects.map_objects import Lane, LaneGroup\n",
"from py123d.datatypes.map_objects.map_objects import LaneGroup\n",
"from py123d.geometry import Point2D\n",
"from py123d.visualization.color.color import BLACK, DARK_GREY, DARKER_GREY, LIGHT_GREY, NEW_TAB_10, TAB_10\n",
"from py123d.visualization.color.color import BLACK, DARKER_GREY, NEW_TAB_10, TAB_10\n",
"from py123d.visualization.color.config import PlotConfig\n",
"from py123d.visualization.color.default import CENTERLINE_CONFIG, MAP_SURFACE_CONFIG, ROUTE_CONFIG\n",
"from py123d.visualization.matplotlib.observation import (\n",
" add_box_detections_to_ax,\n",
" add_default_map_on_ax,\n",
" add_ego_vehicle_to_ax,\n",
" add_traffic_lights_to_ax,\n",
")\n",
"from py123d.visualization.matplotlib.utils import add_shapely_linestring_to_ax, add_shapely_polygon_to_ax\n",
"from py123d.api.scene.scene_api import SceneAPI\n",
"\n",
"\n",
"import shapely.geometry as geom\n",
"\n",
"LEFT_CONFIG: PlotConfig = PlotConfig(\n",
" fill_color=TAB_10[2],\n",
Expand Down Expand Up @@ -154,7 +150,6 @@
" patch = geom.box(x_min, y_min, x_max, y_max)\n",
" map_objects_dict = map_api.query(geometry=patch, layers=layers, predicate=\"intersects\")\n",
"\n",
"\n",
" for layer, map_objects in map_objects_dict.items():\n",
" for map_object in map_objects:\n",
" try:\n",
Expand Down Expand Up @@ -192,7 +187,6 @@
" # line_color=NEW_TAB_10[line_type % (len(NEW_TAB_10) - 1)],\n",
" # line_color_alpha=1.0,\n",
" # line_width=1.5,\n",
" # line_style=\"-\",\n",
" # zorder=10,\n",
" # )\n",
" add_shapely_linestring_to_ax(ax, map_object.polyline_3d.linestring, ROAD_LINE_CONFIG)\n",
Expand All @@ -207,12 +201,11 @@
"\n",
"\n",
"def _plot_scene_on_ax(ax: plt.Axes, scene: SceneAPI, iteration: int = 0, radius: float = 80) -> plt.Axes:\n",
"\n",
" ego_vehicle_state = scene.get_ego_state_at_iteration(iteration)\n",
" box_detections = scene.get_box_detections_at_iteration(iteration)\n",
" map_api = scene.get_map_api()\n",
"\n",
" point_2d = ego_vehicle_state.bounding_box.center.point_2d\n",
" point_2d = ego_vehicle_state.bounding_box.center_se2.point_2d\n",
" if map_api is not None:\n",
" # add_debug_map_on_ax(ax, scene.get_map_api(), point_2d, radius=radius, route_lane_group_ids=None)\n",
"\n",
Expand All @@ -230,10 +223,7 @@
" return ax\n",
"\n",
"\n",
"def plot_scene_at_iteration(\n",
" scene: SceneAPI, iteration: int = 0, radius: float = 80\n",
") -> Tuple[plt.Figure, plt.Axes]:\n",
"\n",
"def plot_scene_at_iteration(scene: SceneAPI, iteration: int = 0, radius: float = 80) -> Tuple[plt.Figure, plt.Axes]:\n",
" size = 10\n",
"\n",
" fig, ax = plt.subplots(figsize=(size, size))\n",
Expand Down Expand Up @@ -277,7 +267,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "py123d",
"display_name": "py123d_dev",
"language": "python",
"name": "python3"
},
Expand Down
7 changes: 3 additions & 4 deletions notebooks/bev_render.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"source": [
"from py123d.api.scene.arrow.arrow_scene_builder import ArrowSceneBuilder\n",
"from py123d.api.scene.scene_filter import SceneFilter\n",
"\n",
"from py123d.common.multithreading.worker_sequential import Sequential\n",
"# from py123d.datatypes.sensors.pinhole_camera import PinholeCameraType "
"# from py123d.datatypes.sensors.pinhole_camera import PinholeCameraType"
]
},
{
Expand Down Expand Up @@ -49,8 +48,8 @@
"worker = Sequential()\n",
"scenes = scene_builder.get_scenes(scene_filter, worker)\n",
"\n",
"scenes = [scene for scene in scenes if scene.uuid in scene_uuids]\n",
"print(f\"Found {len(scenes)} scenes\")\n"
"scenes = [scene for scene in scenes if scene.uuid in scene_uuids]\n",
"print(f\"Found {len(scenes)} scenes\")"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions notebooks/camera_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"source": [
"from py123d.api.scene.arrow.arrow_scene_builder import ArrowSceneBuilder\n",
"from py123d.api.scene.scene_filter import SceneFilter\n",
"\n",
"from py123d.common.multithreading.worker_sequential import Sequential\n",
"from py123d.datatypes.sensors.pinhole_camera import PinholeCameraType"
]
Expand Down Expand Up @@ -60,8 +59,9 @@
"outputs": [],
"source": [
"from matplotlib import pyplot as plt\n",
"\n",
"from py123d.api.scene.abstract_scene import AbstractScene\n",
"from py123d.visualization.matplotlib.camera import add_box_detections_to_camera_ax, add_camera_ax\n",
"from py123d.visualization.matplotlib.camera import add_box_detections_to_camera_ax\n",
"\n",
"iteration = 0\n",
"scene = scenes[0]\n",
Expand Down
11 changes: 5 additions & 6 deletions notebooks/camera_render.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"source": [
"from py123d.api.scene.arrow.arrow_scene_builder import ArrowSceneBuilder\n",
"from py123d.api.scene.scene_filter import SceneFilter\n",
"\n",
"from py123d.common.multithreading.worker_sequential import Sequential\n",
"from py123d.datatypes.sensors.pinhole_camera import PinholeCameraType\n",
"\n",
Expand Down Expand Up @@ -51,8 +50,8 @@
"worker = Sequential()\n",
"scenes = scene_builder.get_scenes(scene_filter, worker)\n",
"\n",
"scenes = [scene for scene in scenes if scene.uuid in scene_uuids]\n",
"print(f\"Found {len(scenes)} scenes\")\n"
"scenes = [scene for scene in scenes if scene.uuid in scene_uuids]\n",
"print(f\"Found {len(scenes)} scenes\")"
]
},
{
Expand All @@ -62,11 +61,11 @@
"metadata": {},
"outputs": [],
"source": [
"import imageio\n",
"from matplotlib import pyplot as plt\n",
"\n",
"from py123d.api.scene.abstract_scene import AbstractScene\n",
"from py123d.visualization.matplotlib.camera import add_box_detections_to_camera_ax, add_camera_ax\n",
"import imageio\n",
"import numpy as np\n",
"from py123d.visualization.matplotlib.camera import add_box_detections_to_camera_ax\n",
"\n",
"iteration = 0\n",
"scene = scenes[0]\n",
Expand Down
Loading