Add CLI tool to get a package's dependencies
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 262
- Forks
- 228
- Avg merge
- 23h 15m
- Merged PRs (30d)
- 12
Description
Feature request
Feature description
It could be nice to have a tool to get the dependencies of a given package. Something like:
ros2 pkg depends <package name>
If we want to get fancier, we could also add options for different types of dependencies (build, exec, test, etc.).
And if we want to get even fancier, we could add an option to get sub-dependencies (essentially calling ros2 pkg depends recursively). This could be a separate feature request, though.
Implementation considerations
My first instinct would be to use the information encoded in the package.xml file. This would require two steps:
- Finding the package.xml for the desired package
ros2 pkg prefix <package_name>is supposed to output the prefix path of a package. However, it seems to alway return the path to the install folder (not sure if this is a bug).
- Parsing the file to extract the relevant information.
- There's python libraries to parse xml files (e.g. xml.etree.ElementTree). I don't know ROS has a prefered library.
- If we want to give options for the different types of dependencies, we would just have a filter during parsing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the existing ros2 pkg command entry points, especially ros2 pkg prefix, and how the target package's package.xml is located. Check the available XML parsing approach and define the initial dependency types to support. Done means ros2 pkg depends <package name> reports that package's declared dependencies; recursive and type-specific options are optional follow-up scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100