Skip to content

Commit

Permalink
Remove usage of stx in favor of C++17 std::optional and std::variant (R…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesnape authored Oct 28, 2019
1 parent 3c9ef6d commit b563c59
Show file tree
Hide file tree
Showing 31 changed files with 22 additions and 273 deletions.
2 changes: 0 additions & 2 deletions bindings/pydrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ drake_pybind_library(
"//bindings/pydrake/common:cpp_template_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:type_pack",
"//bindings/pydrake/common:value_pybind",
"//lcmtypes:viewer",
Expand All @@ -148,7 +147,6 @@ drake_pybind_library(
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
],
cc_srcs = ["lcm_py.cc"],
package_info = PACKAGE_INFO,
Expand Down
18 changes: 10 additions & 8 deletions bindings/pydrake/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ drake_cc_library(
name = "drake_optional_pybind",
hdrs = ["drake_optional_pybind.h"],
declare_installed_headers = 0,
deprecation = " ".join([
"//bindings/pydrake/common:drake_optional_pybind is deprecated and",
"will be removed on 2020-02-01.",
]),
tags = ["manual"],
visibility = ["//visibility:public"],
deps = ["//:drake_shared_library"],
)
Expand All @@ -250,6 +255,11 @@ drake_cc_library(
name = "drake_variant_pybind",
hdrs = ["drake_variant_pybind.h"],
declare_installed_headers = 0,
deprecation = " ".join([
"//bindings/pydrake/common:drake_variant_pybind is deprecated and",
"will be removed on 2020-02-01.",
]),
tags = ["manual"],
visibility = ["//visibility:public"],
deps = ["//:drake_shared_library"],
)
Expand Down Expand Up @@ -468,14 +478,6 @@ drake_pybind_cc_googletest(
py_deps = [":cpp_template_py"],
)

drake_pybind_cc_googletest(
name = "drake_variant_pybind_test",
cc_deps = [
":drake_variant_pybind",
"//bindings/pydrake:test_util_pybind",
],
)

drake_pybind_library(
name = "eigen_geometry_test_util_py",
testonly = 1,
Expand Down
23 changes: 0 additions & 23 deletions bindings/pydrake/common/drake_optional_pybind.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,4 @@

#include "pybind11/stl.h"

// TODO(eric.cousineau): Merge this with `pydrake_pybind` when it is available
// (#7829).
#include "drake/common/drake_optional.h"

#ifdef STX_NO_STD_OPTIONAL

namespace pybind11 {
namespace detail {

// Ensure that we expose a type_caster for `stx::optional`.
// @see pybind11/stl.h, `optional_caster`.

template <typename T>
struct type_caster<stx::optional<T>>
: public optional_caster<stx::optional<T>> {};

template <>
struct type_caster<stx::nullopt_t> // BR
: public void_caster<stx::nullopt_t> {};

} // namespace detail
} // namespace pybind11

#endif // STX_NO_STD_OPTIONAL
15 changes: 0 additions & 15 deletions bindings/pydrake/common/drake_variant_pybind.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,3 @@
#include "pybind11/stl.h"

#include "drake/common/drake_variant.h"

namespace pybind11 {
namespace detail {

// Ensure that we expose a type_caster for `stx::variant`.
// @see pybind11/stl.h, `variant_caster`.

#ifdef STX_NO_STD_VARIANT
template <typename... Types>
struct type_caster<stx::variant<Types...>>
: public variant_caster<stx::variant<Types...>> {};
#endif

} // namespace detail
} // namespace pybind11
61 changes: 0 additions & 61 deletions bindings/pydrake/common/test/drake_variant_pybind_test.cc

This file was deleted.

1 change: 0 additions & 1 deletion bindings/pydrake/examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ drake_pybind_library(
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
],
cc_srcs = ["manipulation_station_py.cc"],
package_info = PACKAGE_INFO,
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/examples/manipulation_station_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/examples/manipulation_station/manipulation_station.h"
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/geometry_py.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "pybind11/eigen.h"
#include "pybind11/operators.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/type_pack.h"
#include "drake/bindings/pydrake/common/value_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/lcm_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/lcm/drake_lcm.h"
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/manipulation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ drake_pybind_library(
name = "planner_py",
cc_deps = [
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:eigen_pybind",
],
cc_srcs = ["planner_py.cc"],
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/manipulation/planner_py.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "pybind11/eigen.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/manipulation/planner/differential_inverse_kinematics.h"
Expand Down
2 changes: 0 additions & 2 deletions bindings/pydrake/multibody/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ drake_pybind_library(
"//bindings/pydrake/common:cpp_template_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:eigen_geometry_pybind",
"//bindings/pydrake/common:type_pack",
"//bindings/pydrake/common:type_safe_index_pybind",
Expand All @@ -91,7 +90,6 @@ drake_pybind_library(
"//bindings/pydrake/common:cpp_template_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:eigen_geometry_pybind",
"//bindings/pydrake/common:type_pack",
"//bindings/pydrake/common:type_safe_index_pybind",
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/multibody/plant_py.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "pybind11/eigen.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "pybind11/stl_bind.h"

#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/eigen_geometry_pybind.h"
#include "drake/bindings/pydrake/common/type_pack.h"
#include "drake/bindings/pydrake/common/value_pybind.h"
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/multibody/tree_py.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "pybind11/eigen.h"
#include "pybind11/eval.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/type_pack.h"
#include "drake/bindings/pydrake/common/type_safe_index_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ drake_pybind_library(
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake:symbolic_types_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
],
cc_srcs = ["mathematicalprogram_py.cc"],
package_info = PACKAGE_INFO,
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/solvers/mathematicalprogram_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/autodiff_types_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/bindings/pydrake/symbolic_types_pybind.h"
Expand Down
5 changes: 0 additions & 5 deletions bindings/pydrake/systems/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ drake_pybind_library(
"//bindings/pydrake/common:cpp_template_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:drake_variant_pybind",
"//bindings/pydrake/common:eigen_pybind",
"//bindings/pydrake/common:type_safe_index_pybind",
"//bindings/pydrake/common:value_pybind",
Expand Down Expand Up @@ -89,8 +87,6 @@ drake_pybind_library(
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake/common:cpp_template_pybind",
"//bindings/pydrake/common:default_scalars_pybind",
"//bindings/pydrake/common:drake_optional_pybind",
"//bindings/pydrake/common:drake_variant_pybind",
],
cc_srcs = ["primitives_py.cc"],
package_info = PACKAGE_INFO,
Expand Down Expand Up @@ -179,7 +175,6 @@ drake_pybind_library(
"//bindings/pydrake:documentation_pybind",
"//bindings/pydrake:symbolic_types_pybind",
"//bindings/pydrake/common:deprecation_pybind",
"//bindings/pydrake/common:drake_variant_pybind",
],
cc_srcs = ["trajectory_optimization_py.cc"],
package_info = PACKAGE_INFO,
Expand Down
2 changes: 0 additions & 2 deletions bindings/pydrake/systems/framework_py_semantics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/drake_variant_pybind.h"
#include "drake/bindings/pydrake/common/eigen_pybind.h"
#include "drake/bindings/pydrake/common/type_safe_index_pybind.h"
#include "drake/bindings/pydrake/common/wrap_pybind.h"
Expand Down
2 changes: 0 additions & 2 deletions bindings/pydrake/systems/framework_py_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/drake_variant_pybind.h"
#include "drake/bindings/pydrake/common/eigen_pybind.h"
#include "drake/bindings/pydrake/common/wrap_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
Expand Down
3 changes: 1 addition & 2 deletions bindings/pydrake/systems/primitives_py.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include "pybind11/eigen.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/cpp_template_pybind.h"
#include "drake/bindings/pydrake/common/default_scalars_pybind.h"
#include "drake/bindings/pydrake/common/drake_optional_pybind.h"
#include "drake/bindings/pydrake/common/drake_variant_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/systems/primitives/adder.h"
Expand Down
1 change: 0 additions & 1 deletion bindings/pydrake/systems/trajectory_optimization_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "pybind11/stl.h"

#include "drake/bindings/pydrake/common/deprecation_pybind.h"
#include "drake/bindings/pydrake/common/drake_variant_pybind.h"
#include "drake/bindings/pydrake/documentation_pybind.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/bindings/pydrake/symbolic_types_pybind.h"
Expand Down
1 change: 0 additions & 1 deletion common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ drake_cc_library(
"@eigen",
"@fmt",
"@spdlog",
"@stx",
],
)

Expand Down
Loading

0 comments on commit b563c59

Please sign in to comment.