Skip to content

Convert sas_core to a thin wrapper around sas_cpp (.deb) + sas_py (PyPI) - #12

Merged
mmmarinho merged 1 commit into
jazzyfrom
feature/thin-wrapper-deb-pypi
Sep 21, 2026
Merged

mmmarinho merged 1 commit into
jazzyfrom
feature/thin-wrapper-deb-pypi

Conversation

@mmmarinho

Copy link
Copy Markdown
Member

What this does

Converts sas_core from a self-contained package (C++ sources + pybind11 bindings inlined) into a thin wrapper around the two packages that now own the core:

Piece Provided by Installed as
C++ core MarinhoLab/sas_cpp libmarinholab-sas-core .deb (target marinholab::sas::core)
Python bindings MarinhoLab/sas_py marinholab-sas-core on PyPI (marinholab.sas.core)

Changes

Removed: src/*.cpp (core + examples), src/*_py.cpp (pybind11 bindings), the pybind11 submodule, cmake/cpplib.cmake + cmake/pythonlib.cmake, .gitmodules.

C++ compatibility shims — include/sas_core/*.hpp are now one-line forwards:

#pragma once
#include <marinholab/sas/core/sas_clock.hpp>   // header from the .deb

namespace sas
{
    using namespace marinholab::sas::core;    // legacy namespace
}

So downstream code keeps working unchanged: #include <sas_core/sas_object.hpp>, namespace sas, and ament_target_dependencies(<pkg> sas_core ...) (the ament target sas_core is an INTERFACE forwarding to marinholab::sas::core + Eigen3::Eigen, with both exported via ament_export_dependencies).

Python compatibility shim — sas_core/__init__.py re-exports Clock, Statistics, RobotDriver, ShutdownSignaler from marinholab.sas.core, so from sas_core import Clock (used e.g. by sas_datalogger) keeps working.

docker environment (per the agreed plan):

  • pip install marinholab-sas-core (PyPI bindings)
  • temporary, until the .deb is published to an apt repo: clones MarinhoLab/sas_cpp at tag 26.09 and runs dpkg-buildpackage + dpkg -i inside the image (architecture-agnostic; dqrobotics C++/Python is already in the base image, so no PPA step) — a marked comment shows the one-line replacement for the end state
  • keeps apt-get remove ros-jazzy-sas-core so the legacy package in the base image doesn't shadow the wrapper

Verification — docker/compose.yml now runs docker/smoke_test.sh:

  1. colcon build of the wrapper
  2. scripts/sas_core_smoke_test.py: Python shim identity + a running Clock, and a CMake consumer probe (real project: find_package(marinholab_sas_core) → link → run)
  3. compiles + runs a consumer using the legacy #include <sas_core/sas_clock.hpp> + namespace sas against the installed library

Verified end-to-end

Ran docker compose build && docker compose up in the docker environment (arm64 base image murilomarinho/sas:jazzy) — all three checks pass, container exits 0. The repo's existing CI (.github/workflows/build.yml already runs docker compose build + docker compose up) re-verifies this on amd64.

Follow-ups (out of scope here)

  • Once the .deb is published to an apt repository (the separate .deb task), replace the in-image build block in docker/Dockerfile with apt-get install -y libmarinholab-sas-core (marked in a comment).
  • The C++ example programs now live with MarinhoLab/sas_cpp (-DMARINHO_LAB_SAS_CORE_BUILD_EXAMPLES=ON); Python examples remain in scripts/.

This pull request was created by an AI agent (OpenHands) on behalf of the repository owner.

…PyPI)

The C++ implementation (src/*.cpp), the pybind11 bindings and the
pybind11 submodule no longer live in this package. Instead:

- C++: depends on the libmarinholab-sas-core .deb (source:
  MarinhoLab/sas_cpp), which provides libmarinholab_sas_core, the
  headers and the CMake package config (find_package(marinholab_sas_core)).
  include/sas_core/*.hpp are now one-line compatibility shims that
  forward to include/marinholab/sas/core/*.hpp and re-alias the legacy
  namespace sas, and the ament target 'sas_core' forwards to
  marinholab::sas::core so downstream ament_target_dependencies(...)
  keeps working.

- Python: sas_core/__init__.py is a pure-Python shim re-exporting
  Clock/Statistics/RobotDriver/ShutdownSignaler from the PyPI package
  marinholab-sas-core (MarinhoLab/sas_py), so
  'from sas_core import Clock' keeps working.

- docker/: the environment now installs marinholab-sas-core from PyPI
  and, until the .deb is published to an apt repository, builds the
  libmarinholab-sas-core .deb from MarinhoLab/sas_cpp (tag 26.09)
  inside the image and installs it. dqrobotics (C++ and Python) is
  already in the base image, so no PPA step is needed.

- docker/compose.yml + docker/smoke_test.sh + scripts/sas_core_smoke_test.py
  verify the whole chain: colcon build, the Python shim, a CMake
  consumer probe (find_package + link + run) and a consumer of the
  legacy C++ include path/namespace.

Verified end-to-end in the docker environment (arm64 base image).
@mmmarinho

Copy link
Copy Markdown
Member Author

CI note (external blocker): the Build job fails at docker compose build → pip install --upgrade marinholab-sas-core with No matching distribution found — but not because of this branch. The PyPI release 26.9.4 of marinholab-sas-core is missing wheels (no cp312 x86_64, no cp310/311 aarch64) due to an artifact-name collision in MarinhoLab/sas_py's publish.yml (wheel-${{ runner.os }}-py… collides between the two Linux runners, so one artifact overwrites the other).

The fix + required republish (new version) are documented at MarinhoLab/sas_py#4. Once the complete wheel set is on PyPI, re-run the Build check here — the branch itself was verified end-to-end in the docker environment (colcon build + Python shim + CMake consumer probe + legacy C++ include/namespace test, all green).

@mmmarinho
mmmarinho merged commit e1552fe into jazzy Sep 21, 2026
2 of 5 checks passed
@mmmarinho
mmmarinho deleted the feature/thin-wrapper-deb-pypi branch September 21, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants