Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMake and setuptools logic for the Python bindings #233

Merged
merged 18 commits into from
Jul 13, 2021

Conversation

diegoferigo
Copy link
Contributor

This PR refactors both the CMake project and the setuptools files as follows:

  • Introduces support to install the Python bindings from the CMake project
  • The default destination is inside the CMAKE_INSTALL_PREFIX, and the path is computed as recommended for third-party platform dependent projects
  • A new optional DETECT_ACTIVE_PYTHON_SITEPACKAGES CMake option allows to install the bindings in the active python directory (this means outside the install prefix), that could be a system folder
  • The setup.py has been simplified and most of its logic moved to a modern setup.cfg
  • A new pyproject.toml was added to support PEP517 and PEP518
  • The CMake project is now built with cmake-build-extension
  • When packaging with setuptools, if a recent pip version is found, pybind11 is installed in a temporary directory and the user does not have to install it manually beforehand. Then, cmake-build-extension will make sure that manif's CMake finds it.
  • Alternatively to pip, also pypa/build can be used to generate the sdist / wheel packages
  • The pytest configuration was moved to the unified setup.cfg file

Related to #228. However, this PR does not implement any CI/CD pipeline towards PyPI.

Test this PR with:

docker run -it --rm ubuntu:focal bash

# Install dependencies
apt update
apt install -y build-essential git python3-pip python3-venv libeigen3-dev

# Install pypa/build
python3 -m pip install pip --upgrade
pip3 install build

# Clone the project
cd /tmp
git clone https://github.com/diegoferigo/manif -b feature/setuptools

# Create the sdist and wheel
cd manif
python3 -m build -o dist
Building the wheel: output
root@f9104509b46a:/tmp/manif# python3 -m build -o dist -w
Found existing installation: setuptools 44.0.0
Uninstalling setuptools-44.0.0:
  Successfully uninstalled setuptools-44.0.0
Collecting setuptools>=45
  Using cached setuptools-57.0.0-py3-none-any.whl (821 kB)
Collecting pybind11
  Using cached pybind11-2.6.2-py2.py3-none-any.whl (191 kB)
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting setuptools_scm[toml]>=6.0
  Using cached setuptools_scm-6.0.1-py3-none-any.whl (27 kB)
Collecting cmake-build-extension
  Using cached cmake_build_extension-0.2.0-py3-none-any.whl (8.7 kB)
Collecting cmake>=3.18.2
  Using cached cmake-3.20.3-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (19.4 MB)
Collecting ninja
  Using cached ninja-1.10.0.post2-py3-none-manylinux1_x86_64.whl (107 kB)
Collecting toml; extra == "toml"
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: setuptools, pybind11, wheel, toml, setuptools-scm, cmake-build-extension, cmake, ninja
Successfully installed cmake-3.20.3 cmake-build-extension-0.2.0 ninja-1.10.0.post2 pybind11-2.6.2 setuptools-57.0.0 setuptools-scm-6.0.1 toml-0.10.2 wheel-0.36.2
running egg_info
writing manifpy.egg-info/PKG-INFO
writing dependency_links to manifpy.egg-info/dependency_links.txt
writing requirements to manifpy.egg-info/requires.txt
writing top-level names to manifpy.egg-info/top_level.txt
adding license file 'LICENSE'
writing manifest file 'manifpy.egg-info/SOURCES.txt'
Requirement already satisfied: wheel in /tmp/build-env-gtbc_2p5/lib/python3.8/site-packages (from -r /tmp/build-reqs-lxpoow59.txt (line 1)) (0.36.2)
running bdist_wheel
running build
running build_ext

==> Configuring:
$ cmake -S /tmp/manif -B /tmp/manif/build/temp.linux-x86_64-3.8_CMakeProject -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/tmp/manif/build/lib.linux-x86_64-3.8/manifpy -DCALL_FROM_SETUP_PY:BOOL=ON -DBUILD_PYTHON_BINDINGS:BOOL=ON

==> Building:
$ cmake --build /tmp/manif/build/temp.linux-x86_64-3.8_CMakeProject --config Release

==> Installing:
$ cmake --install /tmp/manif/build/temp.linux-x86_64-3.8_CMakeProject

-- The CXX compiler identification is GNU 9.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- The compiler /usr/bin/c++ has C++11 support.
CMake Warning at CMakeLists.txt:50 (message):
  Eigen3 version 3.3.7 found in /usr/include/eigen3.  Beware that the move
  semantic has a bug and resolves to a simple copy.


-- Found Python: /usr/bin/python3.8 (found version "3.8.5") found components: Interpreter Development Development.Module Development.Embed 
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /tmp/build-env-gtbc_2p5/lib/python3.8/site-packages/pybind11/include (found version "2.6.2" )
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/manif/build/temp.linux-x86_64-3.8_CMakeProject
[8/8] Linking CXX shared module manifpy/bindings/manifpy.cpython-38-x86_64-linux-gnu.so
-- Install configuration: "Release"
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifTargets.cmake
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifConfigVersion.cmake
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifConfig.cmake
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/tl/optional.hpp
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/SE_2_3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/functions.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/random.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/traits.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/lie_group_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/assignment_assert.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/utils.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/macro.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/generator.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_map.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_properties.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/eigen.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/tangent_base.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/Rn.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/SO2.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/SO3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/SE2.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/ceres.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/local_parametrization.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/ceres_utils.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/objective.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/constants.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/constraint.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/SE3.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/constants.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/manif.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/average.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/interpolation.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/bezier.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/decasteljau.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/gtest/gtest_eigen_utils.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/include/manif/gtest/gtest_manif_utils.h
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/bindings/manifpy.cpython-38-x86_64-linux-gnu.so
-- Installing: /tmp/manif/build/lib.linux-x86_64-3.8/manifpy/__init__.py
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/manifpy
creating build/bdist.linux-x86_64/wheel/manifpy/bindings
copying build/lib.linux-x86_64-3.8/manifpy/bindings/manifpy.cpython-38-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel/manifpy/bindings
creating build/bdist.linux-x86_64/wheel/manifpy/include
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/SE_2_3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/functions.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2Tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se2/SE2_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/random.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/traits.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2Tangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so2/SO2_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so2
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/lie_group_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/assignment_assert.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3Tangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/so3/SO3_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/so3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/utils.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/macro.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se_2_3
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/Rn_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/rn/RnTangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/rn
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/generator.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3Tangent.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_map.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/se3/SE3_properties.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl/se3
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/eigen.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/impl/tangent_base.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/impl
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/Rn.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/SO2.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/SO3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/SE2.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/ceres.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/local_parametrization.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/ceres_utils.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/objective.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/constants.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/ceres/constraint.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/ceres
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/SE3.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/constants.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/manif.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/gtest
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/gtest/gtest_manif_utils.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/gtest
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/gtest/gtest_eigen_utils.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/gtest
creating build/bdist.linux-x86_64/wheel/manifpy/include/manif/algorithms
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/average.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/algorithms
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/interpolation.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/algorithms
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/bezier.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/algorithms
copying build/lib.linux-x86_64-3.8/manifpy/include/manif/algorithms/decasteljau.h -> build/bdist.linux-x86_64/wheel/manifpy/include/manif/algorithms
creating build/bdist.linux-x86_64/wheel/manifpy/include/tl
copying build/lib.linux-x86_64-3.8/manifpy/include/tl/optional.hpp -> build/bdist.linux-x86_64/wheel/manifpy/include/tl
creating build/bdist.linux-x86_64/wheel/manifpy/share
creating build/bdist.linux-x86_64/wheel/manifpy/share/manif
creating build/bdist.linux-x86_64/wheel/manifpy/share/manif/cmake
copying build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifConfigVersion.cmake -> build/bdist.linux-x86_64/wheel/manifpy/share/manif/cmake
copying build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifTargets.cmake -> build/bdist.linux-x86_64/wheel/manifpy/share/manif/cmake
copying build/lib.linux-x86_64-3.8/manifpy/share/manif/cmake/manifConfig.cmake -> build/bdist.linux-x86_64/wheel/manifpy/share/manif/cmake
copying build/lib.linux-x86_64-3.8/manifpy/__init__.py -> build/bdist.linux-x86_64/wheel/manifpy
running install_egg_info
running egg_info
writing manifpy.egg-info/PKG-INFO
writing dependency_links to manifpy.egg-info/dependency_links.txt
writing requirements to manifpy.egg-info/requires.txt
writing top-level names to manifpy.egg-info/top_level.txt
adding license file 'LICENSE'
writing manifest file 'manifpy.egg-info/SOURCES.txt'
Copying manifpy.egg-info to build/bdist.linux-x86_64/wheel/manifpy-0.0.5.dev3-py3.8.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/manifpy-0.0.5.dev3.dist-info/WHEEL
creating '/tmp/manif/dist/tmp8oi49s20/manifpy-0.0.5.dev3-cp38-cp38-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'manifpy/__init__.py'
adding 'manifpy/bindings/manifpy.cpython-38-x86_64-linux-gnu.so'
adding 'manifpy/include/manif/Rn.h'
adding 'manifpy/include/manif/SE2.h'
adding 'manifpy/include/manif/SE3.h'
adding 'manifpy/include/manif/SE_2_3.h'
adding 'manifpy/include/manif/SO2.h'
adding 'manifpy/include/manif/SO3.h'
adding 'manifpy/include/manif/constants.h'
adding 'manifpy/include/manif/functions.h'
adding 'manifpy/include/manif/manif.h'
adding 'manifpy/include/manif/algorithms/average.h'
adding 'manifpy/include/manif/algorithms/bezier.h'
adding 'manifpy/include/manif/algorithms/decasteljau.h'
adding 'manifpy/include/manif/algorithms/interpolation.h'
adding 'manifpy/include/manif/ceres/ceres.h'
adding 'manifpy/include/manif/ceres/ceres_utils.h'
adding 'manifpy/include/manif/ceres/constants.h'
adding 'manifpy/include/manif/ceres/constraint.h'
adding 'manifpy/include/manif/ceres/local_parametrization.h'
adding 'manifpy/include/manif/ceres/objective.h'
adding 'manifpy/include/manif/gtest/gtest_eigen_utils.h'
adding 'manifpy/include/manif/gtest/gtest_manif_utils.h'
adding 'manifpy/include/manif/impl/assignment_assert.h'
adding 'manifpy/include/manif/impl/eigen.h'
adding 'manifpy/include/manif/impl/generator.h'
adding 'manifpy/include/manif/impl/lie_group_base.h'
adding 'manifpy/include/manif/impl/macro.h'
adding 'manifpy/include/manif/impl/random.h'
adding 'manifpy/include/manif/impl/tangent_base.h'
adding 'manifpy/include/manif/impl/traits.h'
adding 'manifpy/include/manif/impl/utils.h'
adding 'manifpy/include/manif/impl/rn/Rn.h'
adding 'manifpy/include/manif/impl/rn/RnTangent.h'
adding 'manifpy/include/manif/impl/rn/RnTangent_base.h'
adding 'manifpy/include/manif/impl/rn/RnTangent_map.h'
adding 'manifpy/include/manif/impl/rn/Rn_base.h'
adding 'manifpy/include/manif/impl/rn/Rn_map.h'
adding 'manifpy/include/manif/impl/rn/Rn_properties.h'
adding 'manifpy/include/manif/impl/se2/SE2.h'
adding 'manifpy/include/manif/impl/se2/SE2Tangent.h'
adding 'manifpy/include/manif/impl/se2/SE2Tangent_base.h'
adding 'manifpy/include/manif/impl/se2/SE2Tangent_map.h'
adding 'manifpy/include/manif/impl/se2/SE2_base.h'
adding 'manifpy/include/manif/impl/se2/SE2_map.h'
adding 'manifpy/include/manif/impl/se2/SE2_properties.h'
adding 'manifpy/include/manif/impl/se3/SE3.h'
adding 'manifpy/include/manif/impl/se3/SE3Tangent.h'
adding 'manifpy/include/manif/impl/se3/SE3Tangent_base.h'
adding 'manifpy/include/manif/impl/se3/SE3Tangent_map.h'
adding 'manifpy/include/manif/impl/se3/SE3_base.h'
adding 'manifpy/include/manif/impl/se3/SE3_map.h'
adding 'manifpy/include/manif/impl/se3/SE3_properties.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3Tangent.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_base.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3Tangent_map.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3_base.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3_map.h'
adding 'manifpy/include/manif/impl/se_2_3/SE_2_3_properties.h'
adding 'manifpy/include/manif/impl/so2/SO2.h'
adding 'manifpy/include/manif/impl/so2/SO2Tangent.h'
adding 'manifpy/include/manif/impl/so2/SO2Tangent_base.h'
adding 'manifpy/include/manif/impl/so2/SO2Tangent_map.h'
adding 'manifpy/include/manif/impl/so2/SO2_base.h'
adding 'manifpy/include/manif/impl/so2/SO2_map.h'
adding 'manifpy/include/manif/impl/so2/SO2_properties.h'
adding 'manifpy/include/manif/impl/so3/SO3.h'
adding 'manifpy/include/manif/impl/so3/SO3Tangent.h'
adding 'manifpy/include/manif/impl/so3/SO3Tangent_base.h'
adding 'manifpy/include/manif/impl/so3/SO3Tangent_map.h'
adding 'manifpy/include/manif/impl/so3/SO3_base.h'
adding 'manifpy/include/manif/impl/so3/SO3_map.h'
adding 'manifpy/include/manif/impl/so3/SO3_properties.h'
adding 'manifpy/include/tl/optional.hpp'
adding 'manifpy/share/manif/cmake/manifConfig.cmake'
adding 'manifpy/share/manif/cmake/manifConfigVersion.cmake'
adding 'manifpy/share/manif/cmake/manifTargets.cmake'
adding 'manifpy-0.0.5.dev3.dist-info/LICENSE'
adding 'manifpy-0.0.5.dev3.dist-info/METADATA'
adding 'manifpy-0.0.5.dev3.dist-info/WHEEL'
adding 'manifpy-0.0.5.dev3.dist-info/top_level.txt'
adding 'manifpy-0.0.5.dev3.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel

@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #233 (dc75455) into devel (0d42c2d) will increase coverage by 0.39%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##            devel     #233      +/-   ##
==========================================
+ Coverage   97.51%   97.90%   +0.39%     
==========================================
  Files          49       49              
  Lines        1531     1531              
==========================================
+ Hits         1493     1499       +6     
+ Misses         38       32       -6     

@artivis artivis self-assigned this Jun 16, 2021
@artivis artivis added the enhancement New feature or request label Jun 16, 2021
@artivis
Copy link
Owner

artivis commented Jun 16, 2021

Hi,
Thanks for the contribution, looks a lot simpler than what I was tinkering with 👍

@diegoferigo
Copy link
Contributor Author

Hi,
Thanks for the contribution, looks a lot simpler than what I was tinkering with +1

Great! I'm going to debug the failure in CI, I'm not sure why pip install . fails there. Locally it does not give me any trouble.

@diegoferigo
Copy link
Contributor Author

Mmh Github is blocking CI since this is my first contribution. @artivis I suspect you have to manually approve every run. I've just enabled Actions in my fork, I'll do a force push to trigger the build and continue in this way until I solve the problem.

Copy link
Owner

@artivis artivis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh Github is blocking CI since this is my first contribution. @artivis I suspect you have to manually approve every run. I've just enabled Actions in my fork, I'll do a force push to trigger the build and continue in this way until I solve the problem.

I had approved the run already this morning. Could it be because of the force-push?

CMakeLists.txt Outdated Show resolved Hide resolved
@diegoferigo
Copy link
Contributor Author

diegoferigo commented Jun 18, 2021

I addressed all the comments and cleaned the history.

There's a last remark I have to make and it regards the branching strategy that is used. The version of the Python package is determined by pypa/setuptools_scm from the closest tag found from the HEAD. Currently, devel has no parent commit associated with a tag since all the tagging happens in master.

What I recommend in order to get correct development tags in devel is merging master into devel after a new tag. Referring to robotology-legacy/gym-ignition#278, here's a descriptive image:

Screenshot_20201123_131218

@artivis
Copy link
Owner

artivis commented Jun 21, 2021

There's a last remark I have to make and it regards the branching strategy that is used.

Say no more, I'm well aware it is kind of crappy 😅 as it makes my own work more complicated. I'll somehow merge both branches asap and possibly get rid of master. This should make things easier.

Thanks again for iterating on this PR.
Unfortunately I'm about to go on a summer break and I'm afraid this will have to wait for ~ a couple weeks. I'd prefer no to rush the merge now and forget about it...

@diegoferigo
Copy link
Contributor Author

diegoferigo commented Jun 22, 2021

There's a last remark I have to make and it regards the branching strategy that is used.

Say no more, I'm well aware it is kind of crappy 😅 as it makes my own work more complicated. I'll somehow merge both branches asap and possibly get rid of master. This should make things easier.

A single branch with a quick release cycle is a great choice, especially in research :) The logic of the automatic versioning is a bit obscure and indeed makes these branching needs a bit odd, but after a couple of years of usage I have to say that it is handy, especially if you maintain a nightly channel corresponding to new commits landing the development branch (that could be main). The release version will be something like v0.5.0.devX and it's automatically generated from the git repo (example).

Thanks again for iterating on this PR.
Unfortunately I'm about to go on a summer break and I'm afraid this will have to wait for ~ a couple weeks. I'd prefer no to rush the merge now and forget about it...

Thank you for the feedback and no problem for the delay, have a nice vacation and good rest 😉

@@ -1,5 +1,5 @@
set(PYBIND11_CPP_STANDARD -std=c++11)
pybind11_add_module(manifpy
pybind11_add_module(manifpy MODULE
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself, MODULE is the default when nothing's specified.

@artivis
Copy link
Owner

artivis commented Jul 9, 2021

Hi @diegoferigo,

So I'm back on this PR and gave it a shot yesterday in a clean 18.04 container. Unfortunately the plain CMake build of the Python bindings does not work anymore. It first fails finding Python3 (not sure why since we provide the module) and then on the install rule. I've revisited the FindPython logic and will push that on a separate branch later today to run it through the CI (don't worry about fixing anything at the moment). As for the install rule, I'll open a separate comment.

Comment on lines 22 to 42
option(
DETECT_ACTIVE_PYTHON_SITEPACKAGES
"Do you want manif to detect and use the active site-package directory? (it could be a system dir)"
FALSE)

# Installation in the active site-packages folder (could be a system folder)
if(DETECT_ACTIVE_PYTHON_SITEPACKAGES)
set(PYTHON_INSTDIR "${Python3_SITELIB}/manifpy")
# Installation from the build extension of setup.py
elseif(CALL_FROM_SETUP_PY)
set(PYTHON_INSTDIR "${CMAKE_INSTALL_PREFIX}")
# Installation in the CMAKE_INSTALL_PREFIX
else()
execute_process(
COMMAND
${Python3_EXECUTABLE} -c
"import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=False, prefix=''))"
OUTPUT_VARIABLE _PYTHON_INSTDIR)
string(STRIP ${_PYTHON_INSTDIR} _PYTHON_INSTDIR_CLEAN)
set(PYTHON_INSTDIR "${_PYTHON_INSTDIR_CLEAN}/manifpy")
endif()
Copy link
Owner

@artivis artivis Jul 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I don't quite understand this chunk. Correct me if I'm wrong but the overall idea is to choose whether to install in the CMake install path or the Python's site-package right?

Now the logic seems odd; aren't the last two blocks inverted? Shouldn't it be

elseif(CALL_FROM_SETUP_PY)
  execute_process(...)
else()
  set(PYTHON_INSTDIR "${CMAKE_INSTALL_PREFIX}")

??

Furthermore, the variable Python3_SITELIB is provided by the FindPython3 module and is the results of distutils.sysconfig.get_python_lib(plat_specific=True, standard_lib=False) (see doc). So why do we have two distinct cases leading to the same result?

I don't know what's the common practice (if any) but shouldn't we install by default in the Python site-package?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch my previous comment about the 'if' block logic being odd, I went down the rabbit hole 😭.
Still, the CMAKE_INSTALL_PREFIX variable populated by cmake-build-extension is anything but a prefix 😅.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sorry for replying too late, it would have saved you quite some digging 😅 For the records, in our projects we always find odd when a CMake projects installs files outside CMAKE_INSTALL_PREFIX, this is the rationale behind this logic. This is a behavior that could surprise users and third-party packagers and we try to avoid it.

However, in this specific case, using the detected site-packages folder (that could be a system folder) makes sense in some use cases. In fact, installing in a custom CMAKE_INSTALL_PREFIX, in most cases, requires the user to extend manually PYTHONPATH if they are using the system interpreter. Nowadays I believe this is not the most common case and this is the reason why the default behavior of this CMake logic in to install the bindings inside the CMAKE_INSTALL_PREFIX, where the right installation path has to be structured. Here is where distutils enters in the picture.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, it's actually a good thing that I investigated as it allowed me to better understand what's going on.
I generally agree with your point on installing things under the CMAKE_INSTALL_PREFIX but for the particular case of python bindings installed from plain CMake, I'm not sure if that makes sense and at the very least it is not convenient since it may requires (as you noted) to augment the PYTHONPATH. Now, I don't actually expect anyone to use the plain CMake install for the bindings tho, and I'd encourage using pip.

artivis and others added 6 commits July 9, 2021 19:22
  - separate python release workflow
  - separate plain cmake python bindings build/test/install
Comment on lines 15 to +18
*.so
*__pycache__
.pytest_cache
dist
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the long term, you can consider using the official gitignore for Python:

https://github.com/github/gitignore/blob/master/Python.gitignore

@artivis
Copy link
Owner

artivis commented Jul 13, 2021

All green! Thanks a lot @diegoferigo for the feature and iterating this PR! Merging :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants