diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f1f218a6..52377fd231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,12 +20,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - bindings/python : Add missing arg names in `visualizer-visitor.hpp` - use deprecation, warning macros already provided by jrl-cmakemodules +- renamed `PINOCCHIO_PRAGMA_DEPRECATED_HEADER` to `PINOCCHIO_DEPRECATED_MOVED_HEADER` ### Removed - Remove unused headers `deprecated-macros.hpp` and `deprecated-namespaces.hpp` - Remove header `pinocchio/deprecation.hpp`, directly use generated `pinocchio/deprecated.hpp` - macros.hpp : remove macros already provided by jrl-cmakemodules +- bindings/python : deprecate and remove contents of `utils/copyable.hpp`, `utils/registration.hpp` and `utils/deprecation.hpp`, include corresponding eigenpy headers instead ## [3.7.0] - 2025-05-21 diff --git a/bindings/python/algorithm/expose-constrained-dynamics.cpp b/bindings/python/algorithm/expose-constrained-dynamics.cpp index 4c63759472..50ebc291ec 100644 --- a/bindings/python/algorithm/expose-constrained-dynamics.cpp +++ b/bindings/python/algorithm/expose-constrained-dynamics.cpp @@ -8,7 +8,6 @@ #include "pinocchio/bindings/python/algorithm/contact-cholesky.hpp" #include "pinocchio/bindings/python/utils/std-vector.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" #include "pinocchio/bindings/python/utils/model-checker.hpp" #include "pinocchio/algorithm/constrained-dynamics.hpp" diff --git a/bindings/python/math/expose-eigen-types.cpp b/bindings/python/math/expose-eigen-types.cpp index 719c6931ad..24a24d11a4 100644 --- a/bindings/python/math/expose-eigen-types.cpp +++ b/bindings/python/math/expose-eigen-types.cpp @@ -1,9 +1,8 @@ // -// Copyright (c) 2020-2021 INRIA +// Copyright (c) 2020-2025 INRIA // #include "pinocchio/bindings/python/fwd.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" #include "pinocchio/bindings/python/utils/std-vector.hpp" #include diff --git a/bindings/python/module.cpp b/bindings/python/module.cpp index 7a1baa6228..2999785104 100644 --- a/bindings/python/module.cpp +++ b/bindings/python/module.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2015-2022 CNRS INRIA +// Copyright (c) 2015-2022 CNRS INRIA, 2025 INRIA // #include "pinocchio/bindings/python/fwd.hpp" @@ -7,7 +7,6 @@ #include "pinocchio/utils/version.hpp" #include "pinocchio/bindings/python/utils/version.hpp" #include "pinocchio/bindings/python/utils/dependencies.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" #include "pinocchio/bindings/python/utils/std-vector.hpp" #include "pinocchio/spatial/cartesian-axis.hpp" diff --git a/bindings/python/parsers/urdf/console-bridge.cpp b/bindings/python/parsers/urdf/console-bridge.cpp index 6a37be3597..3a0d97be0f 100644 --- a/bindings/python/parsers/urdf/console-bridge.cpp +++ b/bindings/python/parsers/urdf/console-bridge.cpp @@ -1,10 +1,10 @@ // -// Copyright (c) 2020 INRIA +// Copyright (c) 2020-2025 INRIA // #include +#include #include "pinocchio/bindings/python/parsers/urdf.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" #ifdef PINOCCHIO_WITH_URDFDOM #include @@ -24,7 +24,7 @@ namespace pinocchio ::console_bridge::setLogLevel(::console_bridge::CONSOLE_BRIDGE_LOG_ERROR); typedef ::console_bridge::LogLevel LogLevel; - if (!register_symbolic_link_to_registered_type()) + if (!eigenpy::register_symbolic_link_to_registered_type()) { bp::enum_("LogLevel") .value("CONSOLE_BRIDGE_LOG_DEBUG", ::console_bridge::CONSOLE_BRIDGE_LOG_DEBUG) diff --git a/include/pinocchio/algorithm/parallel/omp.hpp b/include/pinocchio/algorithm/parallel/omp.hpp index 352d320ba0..050e504b4a 100644 --- a/include/pinocchio/algorithm/parallel/omp.hpp +++ b/include/pinocchio/algorithm/parallel/omp.hpp @@ -6,7 +6,7 @@ #define __pinocchio_algorithm_parallel_omp_hpp__ #include "pinocchio/macros.hpp" -PINOCCHIO_DEPRECATED_HEADER( +PINOCCHIO_DEPRECATED_MOVED_HEADER( pinocchio / algorithm / parallel / omp.hpp, pinocchio / utils / openmp.hpp) #include "pinocchio/utils/openmp.hpp" diff --git a/include/pinocchio/bindings/python/collision/geometry-functors.hpp b/include/pinocchio/bindings/python/collision/geometry-functors.hpp index dcec7487d8..0d009a1078 100644 --- a/include/pinocchio/bindings/python/collision/geometry-functors.hpp +++ b/include/pinocchio/bindings/python/collision/geometry-functors.hpp @@ -5,8 +5,6 @@ #ifndef __pinocchio_python_collision_geometry_functors_hpp__ #define __pinocchio_python_collision_geometry_functors_hpp__ -#include "pinocchio/bindings/python/utils/registration.hpp" - #include "pinocchio/multibody/geometry.hpp" namespace pinocchio diff --git a/include/pinocchio/bindings/python/fwd.hpp b/include/pinocchio/bindings/python/fwd.hpp index e73f56bf1e..005a7357ce 100644 --- a/include/pinocchio/bindings/python/fwd.hpp +++ b/include/pinocchio/bindings/python/fwd.hpp @@ -16,6 +16,8 @@ namespace pinocchio { namespace python { + using eigenpy::register_symbolic_link_to_registered_type; + // Expose spatial classes void exposeSE3(); void exposeForce(); diff --git a/include/pinocchio/bindings/python/multibody/frame.hpp b/include/pinocchio/bindings/python/multibody/frame.hpp index cc87fc4c3a..b70494f458 100644 --- a/include/pinocchio/bindings/python/multibody/frame.hpp +++ b/include/pinocchio/bindings/python/multibody/frame.hpp @@ -12,7 +12,6 @@ #include "pinocchio/bindings/python/utils/cast.hpp" #include "pinocchio/bindings/python/utils/copyable.hpp" #include "pinocchio/bindings/python/utils/printable.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" namespace pinocchio { diff --git a/include/pinocchio/bindings/python/multibody/geometry-data.hpp b/include/pinocchio/bindings/python/multibody/geometry-data.hpp index 0c1ed2e162..8ff33bc675 100644 --- a/include/pinocchio/bindings/python/multibody/geometry-data.hpp +++ b/include/pinocchio/bindings/python/multibody/geometry-data.hpp @@ -1,19 +1,18 @@ // -// Copyright (c) 2015-2022 CNRS INRIA +// Copyright (c) 2015-2022 CNRS INRIA, 2025 INRIA // #ifndef __pinocchio_python_geometry_data_hpp__ #define __pinocchio_python_geometry_data_hpp__ #include +#include #include "pinocchio/serialization/geometry.hpp" #include "pinocchio/bindings/python/utils/address.hpp" #include "pinocchio/bindings/python/utils/printable.hpp" -#include "pinocchio/bindings/python/utils/copyable.hpp" #include "pinocchio/bindings/python/utils/std-vector.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" #include "pinocchio/bindings/python/serialization/serializable.hpp" #if EIGENPY_VERSION_AT_MOST(2, 8, 1) @@ -25,6 +24,7 @@ namespace pinocchio namespace python { namespace bp = boost::python; + using eigenpy::CopyableVisitor; /* --- COLLISION PAIR --------------------------------------------------- */ /* --- COLLISION PAIR --------------------------------------------------- */ diff --git a/include/pinocchio/bindings/python/multibody/geometry-model.hpp b/include/pinocchio/bindings/python/multibody/geometry-model.hpp index 394767619e..add01d3939 100644 --- a/include/pinocchio/bindings/python/multibody/geometry-model.hpp +++ b/include/pinocchio/bindings/python/multibody/geometry-model.hpp @@ -10,7 +10,7 @@ #include "pinocchio/bindings/python/utils/address.hpp" #include "pinocchio/bindings/python/utils/printable.hpp" #include "pinocchio/bindings/python/utils/copyable.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" + #include "pinocchio/bindings/python/utils/pickle.hpp" #include "pinocchio/bindings/python/serialization/serializable.hpp" diff --git a/include/pinocchio/bindings/python/multibody/geometry-object.hpp b/include/pinocchio/bindings/python/multibody/geometry-object.hpp index 2f52471c91..83326a3e6b 100644 --- a/include/pinocchio/bindings/python/multibody/geometry-object.hpp +++ b/include/pinocchio/bindings/python/multibody/geometry-object.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2017-2023 CNRS INRIA +// Copyright (c) 2017-2023 CNRS INRIA, 2025 INRIA // #ifndef __pinocchio_python_geometry_object_hpp__ @@ -9,11 +9,10 @@ #include #include #include +#include +#include #include "pinocchio/bindings/python/utils/address.hpp" -#include "pinocchio/bindings/python/utils/copyable.hpp" -#include "pinocchio/bindings/python/utils/registration.hpp" -#include "pinocchio/bindings/python/utils/deprecation.hpp" #include "pinocchio/bindings/python/utils/pickle.hpp" #include "pinocchio/bindings/python/serialization/serializable.hpp" @@ -28,6 +27,8 @@ namespace pinocchio namespace python { namespace bp = boost::python; + using eigenpy::CopyableVisitor; + using eigenpy::deprecated_function; struct GeometryObjectPythonVisitor : public boost::python::def_visitor diff --git a/include/pinocchio/bindings/python/parsers/python.hpp b/include/pinocchio/bindings/python/parsers/python.hpp index 287ea1456c..29dce53216 100644 --- a/include/pinocchio/bindings/python/parsers/python.hpp +++ b/include/pinocchio/bindings/python/parsers/python.hpp @@ -8,7 +8,7 @@ #include "pinocchio/macros.hpp" // clang-format off -PINOCCHIO_DEPRECATED_HEADER(pinocchio/bindings/python/parsers/python.hpp, pinocchio/parsers/python.hpp) +PINOCCHIO_DEPRECATED_MOVED_HEADER(pinocchio/bindings/python/parsers/python.hpp, pinocchio/parsers/python.hpp) // clang-format on #include "pinocchio/parsers/python.hpp" diff --git a/include/pinocchio/bindings/python/utils/copyable.hpp b/include/pinocchio/bindings/python/utils/copyable.hpp index d33b4127de..4443209ff3 100644 --- a/include/pinocchio/bindings/python/utils/copyable.hpp +++ b/include/pinocchio/bindings/python/utils/copyable.hpp @@ -1,44 +1,21 @@ // -// Copyright (c) 2016-2023 CNRS INRIA +// Copyright (c) 2016-2023 CNRS INRIA, 2025 INRIA // #ifndef __pinocchio_python_utils_copyable_hpp__ #define __pinocchio_python_utils_copyable_hpp__ -#include +#include + +#include "pinocchio/deprecated.hpp" + +PINOCCHIO_DEPRECATED_HEADER("Directly include instead.") namespace pinocchio { namespace python { - - namespace bp = boost::python; - - /// - /// \brief Add the Python method copy to allow a copy of this by calling the copy constructor. - /// - template - struct CopyableVisitor : public bp::def_visitor> - { - template - void visit(PyClass & cl) const - { - cl.def("copy", ©, bp::arg("self"), "Returns a copy of *this."); - cl.def("__copy__", ©, bp::arg("self"), "Returns a copy of *this."); - cl.def( - "__deepcopy__", &deepcopy, bp::args("self", "memo"), "Returns a deep copy of *this."); - } - - private: - static C copy(const C & self) - { - return C(self); - } - static C deepcopy(const C & self, bp::dict) - { - return C(self); - } - }; + using eigenpy::CopyableVisitor; } // namespace python } // namespace pinocchio diff --git a/include/pinocchio/bindings/python/utils/deprecation.hpp b/include/pinocchio/bindings/python/utils/deprecation.hpp index 31141f8886..101ae4bdf3 100644 --- a/include/pinocchio/bindings/python/utils/deprecation.hpp +++ b/include/pinocchio/bindings/python/utils/deprecation.hpp @@ -1,62 +1,25 @@ // -// Copyright (c) 2020 INRIA +// Copyright (c) 2020-2025 INRIA // #ifndef __pinocchio_python_utils_deprecation_hpp__ #define __pinocchio_python_utils_deprecation_hpp__ -#include -#include -#include +#include +#include +#include "pinocchio/deprecated.hpp" + +PINOCCHIO_DEPRECATED_HEADER("Directly include instead.") namespace pinocchio { namespace python { - template - struct deprecated_warning_policy : Policy - { - deprecated_warning_policy(const std::string & warning_message = "") - : Policy() - , m_warning_message(warning_message) - { - } - - template - bool precall(ArgumentPackage const & args) const - { - PyErr_WarnEx(PyExc_UserWarning, m_warning_message.c_str(), 1); - return static_cast(this)->precall(args); - } - - typedef typename Policy::result_converter result_converter; - typedef typename Policy::argument_package argument_package; - - protected: - const std::string m_warning_message; - }; - - template - struct deprecated_member : deprecated_warning_policy - { - deprecated_member( - const std::string & warning_message = "This class member has been marked as deprecated and " - "will be removed in a future release.") - : deprecated_warning_policy(warning_message) - { - } - }; - - template - struct deprecated_function : deprecated_warning_policy - { - deprecated_function( - const std::string & warning_message = - "This function has been marked as deprecated and will be removed in a future release.") - : deprecated_warning_policy(warning_message) - { - } - }; + template + using deprecated_warning_policy = + eigenpy::deprecation_warning_policy; + using eigenpy::deprecated_function; + using eigenpy::deprecated_member; } // namespace python } // namespace pinocchio diff --git a/include/pinocchio/bindings/python/utils/registration.hpp b/include/pinocchio/bindings/python/utils/registration.hpp index 443955a449..e549a1ecbc 100644 --- a/include/pinocchio/bindings/python/utils/registration.hpp +++ b/include/pinocchio/bindings/python/utils/registration.hpp @@ -1,33 +1,20 @@ // -// Copyright (c) 2019-2020 INRIA +// Copyright (c) 2019-2025 INRIA // #ifndef __pinocchio_python_utils_registration_hpp__ #define __pinocchio_python_utils_registration_hpp__ +#include "pinocchio/deprecated.hpp" #include +PINOCCHIO_DEPRECATED_HEADER("Directly include instead.") + namespace pinocchio { namespace python { - - template - inline bool register_symbolic_link_to_registered_type() - { - namespace bp = boost::python; - if (eigenpy::check_registration()) - { - const bp::type_info info = bp::type_id(); - const bp::converter::registration * reg = bp::converter::registry::query(info); - bp::handle<> class_obj(bp::borrowed(reg->get_class_object())); - bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj); - return true; - } - - return false; - } - + using eigenpy::register_symbolic_link_to_registered_type; } // namespace python } // namespace pinocchio diff --git a/include/pinocchio/macros.hpp b/include/pinocchio/macros.hpp index 5ccdec72e7..6020cc8487 100644 --- a/include/pinocchio/macros.hpp +++ b/include/pinocchio/macros.hpp @@ -77,6 +77,9 @@ namespace pinocchio #define PINOCCHIO_MAYBE_UNUSED #endif +#define PINOCCHIO_DEPRECATED_MOVED_HEADER(old_header, new_header) \ + PINOCCHIO_DEPRECATED_HEADER("#old_header has been replaced by #new_header.") + /// Ensure that a matrix (or vector) is of correct size (compile-time and run-time assertion) #define PINOCCHIO_ASSERT_MATRIX_SPECIFIC_SIZE(type, M, nrows, ncols) \ EIGEN_STATIC_ASSERT( \ diff --git a/include/pinocchio/math/cppad.hpp b/include/pinocchio/math/cppad.hpp index 011d1d356b..8555cbe2e9 100644 --- a/include/pinocchio/math/cppad.hpp +++ b/include/pinocchio/math/cppad.hpp @@ -8,7 +8,7 @@ #include "pinocchio/macros.hpp" // clang-format off -PINOCCHIO_DEPRECATED_HEADER(pinocchio/math/cppad.hpp, pinocchio/autodiff/cppad.hpp) +PINOCCHIO_DEPRECATED_MOVED_HEADER(pinocchio/math/cppad.hpp, pinocchio/autodiff/cppad.hpp) // clang-format on #include "pinocchio/autodiff/cppad.hpp" diff --git a/include/pinocchio/math/cppadcg.hpp b/include/pinocchio/math/cppadcg.hpp index a75b1858b9..3ba14bb908 100644 --- a/include/pinocchio/math/cppadcg.hpp +++ b/include/pinocchio/math/cppadcg.hpp @@ -8,7 +8,7 @@ #include "pinocchio/macros.hpp" // clang-format off -PINOCCHIO_DEPRECATED_HEADER(pinocchio/math/cppadcg.hpp, pinocchio/codegen/cppadcg.hpp) +PINOCCHIO_DEPRECATED_MOVED_HEADER(pinocchio/math/cppadcg.hpp, pinocchio/codegen/cppadcg.hpp) // clang-format on #include "pinocchio/codegen/cppadcg.hpp" diff --git a/include/pinocchio/parsers/sample-models.hpp b/include/pinocchio/parsers/sample-models.hpp index dea420c445..c116d0c8e4 100644 --- a/include/pinocchio/parsers/sample-models.hpp +++ b/include/pinocchio/parsers/sample-models.hpp @@ -8,7 +8,7 @@ #include "pinocchio/macros.hpp" // clang-format off -PINOCCHIO_DEPRECATED_HEADER(pinocchio/parsers/sample-models.hpp, pinocchio/multibody/sample-models.hpp) +PINOCCHIO_DEPRECATED_MOVED_HEADER(pinocchio/parsers/sample-models.hpp, pinocchio/multibody/sample-models.hpp) // clang-format on #include "pinocchio/multibody/sample-models.hpp" diff --git a/include/pinocchio/spatial/fcl-pinocchio-conversions.hpp b/include/pinocchio/spatial/fcl-pinocchio-conversions.hpp index f234b6e744..c7872f5e2f 100644 --- a/include/pinocchio/spatial/fcl-pinocchio-conversions.hpp +++ b/include/pinocchio/spatial/fcl-pinocchio-conversions.hpp @@ -8,7 +8,7 @@ #include "pinocchio/macros.hpp" // clang-format off -PINOCCHIO_DEPRECATED_HEADER( +PINOCCHIO_DEPRECATED_MOVED_HEADER( pinocchio/spatial/fcl-pinocchio-conversions.hpp, pinocchio/collision/fcl-pinocchio-conversions.hpp) // clang-format on