Repository: felixdivo/ros2-easy-test (language: python)

Issue:
`makefun` not listed as dependency
If should be part of the `exec_depend` in the package.xml.

And an entry should be added to the rosdistro https://github.com/ros/rosdistro/blob/80576121cd588793659f626976c813dca4a9c301/rosdep/python.yaml#L6844

But since this dependency is only used for a 5 line function:

```python
def remove_signature_parameters(s, param_names):
    """
    Removes the provided parameters from the signature `s` (returns a new `Signature` instance).

    :param s:
    :param param_names: a list of parameter names to remove
    """
    params = OrderedDict(s.parameters.items())
    for param_name in param_names:
        del params[param_name]
    return s.replace(parameters=params.values())
```

It might also just be rephrased here depending on preference.
Is it possible to add this package as a rosdep dependency
I am wondering if it is possible to have this package be added as a <test_depend> in the package manifest. I did not find this package on the rosdep list https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml.


Discussion / hints:

Oh yeah, why not?! I haven't done this yet because I didn't find the time yet but also because I was unsure about the maturity of the tool. But yeah, adding it sounds reasonable. Would you mind adding it there?
The tool is great, it has allowed us to cleanly test our nodes. One thing that would put it over the top is support for actions. 
For now I was planning to use the env node to try testing actions do you have any advise or examples?

When I get some time I will create a PR for rosdep. Cheers. 


Started PR https://github.com/ros/rosdistro/pull/39892
Excellent, thank you @vik748!
 #33 is now merged.
Awesome thanks for putting in the work, I see how much it involved.
You're welcome. :)

Is it now sufficient to allow packaging as a ROS package? Or is it still a problem that we require `makefun` via pip (instead of via rosdep)? Code reference:

https://github.com/felixdivo/ros2-easy-test/blob/3d075d1b5721ce7f9ed65fa5d3aadefc31bc46fe/ros2_easy_test/setup.py#L39
I am not 100% sure but I think all the dependencies in the tree should be rosdep installable.  I think we have 2 options:
1. We should be able to add makefun to [rosdep](https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml), similar to how we were planning to add ros2-test-easy.  Here are the instructions for that: https://github.com/ros/rosdistro/blob/master/CONTRIBUTING.md#rosdep-rules-contributions
2. I don't know exactly how you are using makefun, but maybe there is another package already in [rosdep](https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml) that gets you what you need.

Once we get through this step, I believe the next will be to Release it through the ROS2 buildfarm.  Again, I haven't done this before, but looks like the process should be: https://docs.ros.org/en/foxy/How-To-Guides/Releasing/Releasing-a-Package.html
Well, makefun is a very specific piece of software, so I doubts it's easily replaceable. But at least, [it's in the Ubuntu packages](https://packages.ubuntu.com/noble/python3-makefun), so it is even a bit nice to do (1.) .

Fix patch:
diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml
index f90b4c9..238d610 100644
--- a/.github/workflows/python-package.yaml
+++ b/.github/workflows/python-package.yaml
@@ -30,7 +30,7 @@ jobs:
           apt-get update -q
           apt-get install -qy python3-pip python-is-python3 ros-dev-tools
           rosdep init
-          # There seems to be no other way to install the PiPI dependencies:
+          # There seems to be no other way to install the PiPI extra dependencies:
           export PIP_BREAK_SYSTEM_PACKAGES=1
           pip install -e './ros2_easy_test[dev]'
       - run: echo "ROS_DISTRO=$ROS_DISTRO" >> "$GITHUB_OUTPUT"
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index d754079..578bf2a 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -3,7 +3,7 @@
 
 version: 2
 build:
-  os: "ubuntu-22.04"
+  os: "ubuntu-lts-latest"
   tools:
     python: "3"  # Latest stable CPython 3.x
 


Test patch:
diff --git a/ros2_easy_test/ros2_easy_test/decorators.py b/ros2_easy_test/ros2_easy_test/decorators.py
index 38d459a..592bd7a 100644
--- a/ros2_easy_test/ros2_easy_test/decorators.py
+++ b/ros2_easy_test/ros2_easy_test/decorators.py
@@ -7,7 +7,7 @@
 
 # Standard library
 from functools import wraps
-from inspect import signature
+from inspect import Signature, signature
 from pathlib import Path
 from signal import SIGINT
 from subprocess import Popen, TimeoutExpired
@@ -28,10 +28,6 @@
 # Helpers
 from .launch_file import LaunchFileProvider
 
-# Function manipulation
-from makefun import remove_signature_parameters  # isort: skip
-
-
 __all__ = ["with_launch_file", "with_single_node"]
 
 
@@ -384,3 +380,15 @@ def wrapper(*args_inner, **kwargs_inner) -> None:
         return wrapper
 
     return decorator
+
+
+def remove_signature_parameters(s: Signature, *names: str) -> Signature:
+    """Creates a new signature with the given parameters removed.
+
+    References:
+        Inspired by the makefun library, version 1.15.2.
+        `Direct link <https://github.com/smarie/python-makefun/blob/c1d189c320cb89381a7f7de21ca61d5dcc24c4db/src/makefun/main.py#L1079-L1091>`__.
+    """
+    return s.replace(
+        parameters=[value for name, value in s.parameters.items() if name not in names],
+    )
diff --git a/ros2_easy_test/setup.py b/ros2_easy_test/setup.py
index e69d3fd..52afde6 100644
--- a/ros2_easy_test/setup.py
+++ b/ros2_easy_test/setup.py
@@ -36,7 +36,7 @@
         "Typing :: Typed",
     ],
     requires_python=">=3.8",
-    install_requires=["makefun>=1.15.2"],
+    install_requires=[],  # They wouldn't be picked up by the ROS build system anyway
     extras_require={
         "dev": [
             "ruff",