Skip to content

Commit

Permalink
[pydrake] Move geometry files into subdir (#18684)
Browse files Browse the repository at this point in the history
This helps to unify the build system, but should not affect users.
  • Loading branch information
jwnimmer-tri authored Jan 30, 2023
1 parent 38acd55 commit 3aa7c8f
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 142 deletions.
133 changes: 2 additions & 131 deletions bindings/pydrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -118,43 +118,6 @@ drake_pybind_library(
],
)

drake_pybind_library(
name = "geometry_py",
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:identifier_pybind",
"//bindings/pydrake/common:monostate_pybind",
"//bindings/pydrake/common:serialize_pybind",
"//bindings/pydrake/common:type_pack",
"//bindings/pydrake/common:type_safe_index_pybind",
"//bindings/pydrake/common:value_pybind",
],
cc_srcs = [
"geometry_py.cc",
"geometry_py.h",
"geometry_py_common.cc",
"geometry_py_hydro.cc",
"geometry_py_optimization.cc",
"geometry_py_render.cc",
"geometry_py_scene_graph.cc",
"geometry_py_visualizers.cc",
],
package_info = PACKAGE_INFO,
py_data = [
"//setup:deepnote",
],
py_deps = [
":math_py",
":module_py",
"//bindings/pydrake/solvers",
"//bindings/pydrake/systems:framework_py",
"//bindings/pydrake/systems:lcm_py",
],
py_srcs = ["_geometry_extra.py"],
)

drake_pybind_library(
name = "lcm_py",
cc_deps = [
Expand Down Expand Up @@ -301,6 +264,7 @@ drake_py_library(

PYBIND_SUBPACKAGES_FOR_COVERAGE = [
"//bindings/pydrake/common",
"//bindings/pydrake/geometry",
"//bindings/pydrake/manipulation",
"//bindings/pydrake/multibody",
"//bindings/pydrake/planning",
Expand All @@ -311,7 +275,6 @@ PYBIND_SUBPACKAGES_FOR_COVERAGE = [

PY_LIBRARIES_WITH_INSTALL = [
":autodiffutils_py",
":geometry_py",
":lcm_py",
":math_py",
":perception_py",
Expand Down Expand Up @@ -491,98 +454,6 @@ drake_py_unittest(
],
)

drake_py_unittest(
name = "frame_id_test",
deps = [
":geometry_py",
],
)

drake_py_unittest(
name = "geometry_common_test",
deps = [
":geometry_py",
"//bindings/pydrake/common",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/multibody:parsing_py",
"//bindings/pydrake/multibody:plant_py",
],
)

drake_py_unittest(
name = "geometry_hydro_test",
data = [
"//geometry:test_obj_files",
],
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
],
)

drake_py_unittest(
name = "geometry_optimization_test",
deps = [
":geometry_py",
":math_py",
"//bindings/pydrake/common/test_utilities:deprecation_py",
"//bindings/pydrake/common/test_utilities:pickle_compare_py",
"//bindings/pydrake/multibody:inverse_kinematics_py",
"//bindings/pydrake/multibody:parsing_py",
"//bindings/pydrake/multibody:plant_py",
"//bindings/pydrake/solvers",
],
)

drake_py_unittest(
name = "geometry_render_test",
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "geometry_render_engine_gl_test",
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
],
)

drake_py_unittest(
name = "geometry_render_engine_subclass_test",
flaky = True,
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "geometry_scene_graph_test",
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "geometry_visualizers_test",
deps = [
":geometry_py",
":lcm_py",
":perception_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/multibody:plant_py",
"//bindings/pydrake/systems:analysis_py",
"//bindings/pydrake/systems:lcm_py",
],
)

drake_py_unittest(
name = "lcm_test",
deps = [
Expand Down Expand Up @@ -720,7 +591,7 @@ PYI_FILES = [
"pydrake/examples/rimless_wheel.pyi",
"pydrake/examples/van_der_pol.pyi",
"pydrake/forwarddiff.pyi",
"pydrake/geometry.pyi",
"pydrake/geometry/__init__.pyi",
"pydrake/lcm.pyi",
"pydrake/manipulation/__init__.pyi",
"pydrake/manipulation/all.pyi",
Expand Down
164 changes: 164 additions & 0 deletions bindings/pydrake/geometry/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# -*- python -*-

load("@drake//tools/install:install.bzl", "install")
load(
"@drake//tools/skylark:drake_py.bzl",
"drake_py_unittest",
)
load(
"@drake//tools/skylark:pybind.bzl",
"add_pybind_coverage_data",
"drake_pybind_library",
"get_drake_py_installs",
"get_pybind_package_info",
)
load("//bindings/pydrake:pydrake.bzl", "add_lint_tests_pydrake")

package(default_visibility = [
"//bindings:__subpackages__",
])

# This determines how `PYTHONPATH` is configured, and how to install the
# bindings.
PACKAGE_INFO = get_pybind_package_info(base_package = "//bindings")

drake_pybind_library(
name = "geometry",
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:identifier_pybind",
"//bindings/pydrake/common:monostate_pybind",
"//bindings/pydrake/common:serialize_pybind",
"//bindings/pydrake/common:type_pack",
"//bindings/pydrake/common:type_safe_index_pybind",
"//bindings/pydrake/common:value_pybind",
],
cc_so_name = "__init__",
cc_srcs = [
"geometry_py.cc",
"geometry_py.h",
"geometry_py_common.cc",
"geometry_py_hydro.cc",
"geometry_py_optimization.cc",
"geometry_py_render.cc",
"geometry_py_scene_graph.cc",
"geometry_py_visualizers.cc",
],
package_info = PACKAGE_INFO,
py_data = [
"//setup:deepnote",
],
py_deps = [
"//bindings/pydrake:math_py",
"//bindings/pydrake:module_py",
"//bindings/pydrake/solvers",
"//bindings/pydrake/systems:framework_py",
"//bindings/pydrake/systems:lcm_py",
],
py_srcs = ["_geometry_extra.py"],
)

install(
name = "install",
targets = [":geometry"],
py_dest = PACKAGE_INFO.py_dest,
deps = get_drake_py_installs([":geometry"]),
)

drake_py_unittest(
name = "frame_id_test",
deps = [
":geometry",
],
)

drake_py_unittest(
name = "common_test",
deps = [
":geometry",
"//bindings/pydrake/common",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/multibody:parsing_py",
"//bindings/pydrake/multibody:plant_py",
],
)

drake_py_unittest(
name = "hydro_test",
data = [
"//geometry:test_obj_files",
],
deps = [
":geometry",
"//bindings/pydrake/common/test_utilities",
],
)

drake_py_unittest(
name = "optimization_test",
deps = [
":geometry",
"//bindings/pydrake:math_py",
"//bindings/pydrake/common/test_utilities:deprecation_py",
"//bindings/pydrake/common/test_utilities:pickle_compare_py",
"//bindings/pydrake/multibody:inverse_kinematics_py",
"//bindings/pydrake/multibody:parsing_py",
"//bindings/pydrake/multibody:plant_py",
"//bindings/pydrake/solvers",
],
)

drake_py_unittest(
name = "render_test",
deps = [
":geometry",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "render_engine_gl_test",
deps = [
":geometry",
"//bindings/pydrake/common/test_utilities",
],
)

drake_py_unittest(
name = "render_engine_subclass_test",
flaky = True,
deps = [
":geometry",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "scene_graph_test",
deps = [
":geometry",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "visualizers_test",
deps = [
":geometry",
"//bindings/pydrake:lcm_py",
"//bindings/pydrake:perception_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/multibody:plant_py",
"//bindings/pydrake/systems:analysis_py",
"//bindings/pydrake/systems:lcm_py",
],
)

add_pybind_coverage_data()

add_lint_tests_pydrake()
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "drake/bindings/pydrake/geometry_py.h"
#include "drake/bindings/pydrake/geometry/geometry_py.h"

#include "pybind11/eval.h"

Expand Down Expand Up @@ -31,7 +31,7 @@ PYBIND11_MODULE(geometry, m) {
DefineGeometryOptimization(m.def_submodule("optimization"));
DefineGeometryVisualizers(m);

ExecuteExtraPythonCode(m);
ExecuteExtraPythonCode(m, true);

def_geometry_all(m.def_submodule("all"));
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/identifier_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/geometry_py.h"
#include "drake/bindings/pydrake/geometry/geometry_py.h"
#include "drake/geometry/optimization/cartesian_product.h"
#include "drake/geometry/optimization/graph_of_convex_sets.h"
#include "drake/geometry/optimization/hpolyhedron.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions bindings/pydrake/multibody/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ drake_pybind_library(
":math_py",
":module_py",
":tree_py",
"//bindings/pydrake:geometry_py",
"//bindings/pydrake/geometry",
"//bindings/pydrake/common:cpp_template_py",
],
py_srcs = [
Expand Down Expand Up @@ -296,7 +296,7 @@ drake_jupyter_py_binary(
":jupyter_widgets_py",
":parsing_py",
":plant_py",
"//bindings/pydrake:geometry_py",
"//bindings/pydrake/geometry",
"//bindings/pydrake/systems:analysis_py",
"//bindings/pydrake/systems:framework_py",
"//bindings/pydrake/systems:rendering_py",
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/planning/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ drake_pybind_library(
package_info = PACKAGE_INFO,
py_deps = [
"//bindings/pydrake/common:cpp_template_py",
"//bindings/pydrake:geometry_py",
"//bindings/pydrake/geometry",
"//bindings/pydrake/multibody:parsing_py",
"//bindings/pydrake/multibody:plant_py",
],
Expand Down
Loading

0 comments on commit 3aa7c8f

Please sign in to comment.