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

add BUILD_ONLY_PYTHON_INTERFACE option #745

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

add BUILD_ONLY_PYTHON_INTERFACE option #745

wants to merge 1 commit into from

Conversation

nim65s
Copy link
Collaborator

@nim65s nim65s commented Feb 13, 2025

Hi,

This is PR is not ready, but we can already start some discussions.

It add the BUILD_PYTHON_INTERFACE option we already have in many places, plus a BUILD_ONLY_PYTHON_INTERFACE one.

The idea of that second one is that, using a single project source, we should be able to package one version without any python interface, then install that, then package another version with only the python interface, linked to the first one with a standard dependency.

The packaging split of those python bindings are already done in robotpkg through some patches there, but would help in many other places, so I think this should be upstreamed.

For example, this would fix stack-of-tasks/pinocchio#2575 because we could have a dependency chain like example-robot-data <- pinocchio <- py-pinocchio <- py-example-robot-data.

It would also allow end users to avoid python dependencies when they only care about our C++ interfaces, since they could apt/brew/conda/nix/pacman/pip install either "pinocchio" or "py-pinocchio" (the later coming with the former as a dependency)

It would also reduce the required resources to build our packages in package managers which offer multiple python versions, since we won't have to rebuild pinocchio-cpp for each pinocchio-py38 .. pinocchio-py313

(obviously, the name of the packages with/without python, eventually with the python version number in the package name will be left to choose for each package manager. eg. I think for pip we should have something like coal-cpp and keep coal for the python bindings, but for robotpkg this is already coal / py312-coal, and for nix this is already coal / python312Packages.coal)

It would also allow support of multiple python versions installed side by side on a system, eg:

Install example of coal with both python 3.12 and 3.13
 /tmp/coal/prefix/merged/
├──  include/
│   └──  coal/
│       └── […]
├──  lib/
│   ├──  cmake/
│   │   └──  coal/
│   │       ├──  coalConfig.cmake
│   │       ├──  coalConfigVersion.cmake
│   │       ├──  coalTargets-relwithdebinfo.cmake
│   │       ├──  coalTargets.cmake
│   │       └──  cxx-standard.cmake
│   ├──  libcoal.so -> libcoal.so.3.0.1
│   ├──  libcoal.so.3.0.1
│   ├──  pkgconfig/
│   │   └──  coal.pc
│   ├──  python3.12/
│   │   └──  site-packages/
│   │       └──  coal/
│   │           ├──  __init__.py
│   │           ├──  coal_pywrap.cpython-312-x86_64-linux-gnu.so
│   │           ├──  viewer.py
│   │           └──  windows_dll_manager.py
│   └──  python3.13/
│       └──  site-packages/
│           └──  coal/
│               ├──  __init__.py
│               ├──  coal_pywrap.cpython-313-x86_64-linux-gnu.so
│               ├──  viewer.py
│               └──  windows_dll_manager.py
└──  share/
    ├──  ament_index/
    │   └──  resource_index/
    │       └──  packages/
    │           └──  coal
    └──  coal/
        ├──  hook/
        │   ├──  ament_prefix_path.dsv
        │   └──  python_path.dsv  # NB: this won't work with ament
        └── 󰗀 package.xml

PS: in HPP, we already have an early version of this feature under the INSTALL_PYTHON_INTERFACE_ONLY name, but this lacks support of various things from jrl-cmakemodules, like not installing the headers / cmake exports / ros stuff

Copy link
Contributor

@jorisv jorisv left a comment

Choose a reason for hiding this comment

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

I will review it as soon as I can

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

Successfully merging this pull request may close these issues.

Remove example-robot-data as a submodule
2 participants