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

Feature Request - Add support for optional python dependencies through [extra] #932

Open
Ryanf55 opened this issue Sep 12, 2023 · 1 comment

Comments

@Ryanf55
Copy link

Ryanf55 commented Sep 12, 2023

Use Case

I use parts of a python package that require the EXTRAS dependencies, and want to specify in my package.xml that I depend on the extras of my dependency.

Example

Pip's networkx has marked an extra dependency on scipy. Because my package uses the kamada-kawai layout feature of networkx, I need to ensure rosdep installs the extra dependencies of networkx such as scipy.

Current dependency in my package.xml, where I must include transitive optional dependencies of python3-networkx

<depend>python3-networkx</depend>
<depend>python3-scipy</depend>

Desired:

<depend>python3-networkx[extra]</depend>

Possible Solution

The rosdep key python3-networkx resolves to the command apt install python3-networkx and the rosdep key python3-networkx[extra] resolves to apt install --install-suggests python3-networkx

$ apt info python3-networkx | grep "Depends\|Recommends\|Suggests"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Depends: python3-pkg-resources, python3-decorator (>= 4.3.0), python3:any
Recommends: python3-numpy (>= 1.15.4), python3-yaml
Suggests: python-networkx-doc, python3-gdal, python3-matplotlib, python3-pydot, python3-pygraphviz, python3-scipy

References

https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies

Originally posted by @Ryanf55 in ros2/ros_network_viz#26 (comment)

@Ryanf55
Copy link
Author

Ryanf55 commented Dec 4, 2023

Relates to #900

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

No branches or pull requests

1 participant