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

Selection of dependency types with cmd line option #727

Closed
wants to merge 10 commits into from

Conversation

nalt
Copy link
Contributor

@nalt nalt commented Oct 28, 2019

Select dependency types (build, buildtool, run, test) to install with --dependency-types. can be given multiple. Standard behaviour (all types) unchanged.

In rospack.py, a fake and empty options object was created for the call to _get_default_RosdepLookup. This was replaced by a similarly hacky global object for command line options.

@nuclearsandwich
Copy link
Contributor

Question for other rosdep contributors and maintainer: An approach similar to this one was proposed in #646 (comment) with a slightly different interface. Does anyone have a preference between the two and if so for which one and why?

@nuclearsandwich nuclearsandwich self-assigned this Apr 2, 2020
@gavanderhoorn
Copy link
Contributor

@nuclearsandwich: you are essentially asking whether ppl would have a preference for:

--dependency-types <names_of_dep_types_separated_by_spaces>

or:

--dependency-types <name_of_dep_type> --dependency-types <name_of_dep_type> etc

right?

@NikolausDemmel
Copy link
Contributor

@nuclearsandwich: you are essentially asking whether ppl would have a preference for:

--dependency-types <names_of_dep_types_separated_by_spaces>

or:

--dependency-types <name_of_dep_type> --dependency-types <name_of_dep_type> etc

right?

Side remark: On this question there is precedent for offering both options at the same time in rosdep:

rosdep/src/rosdep2/main.py

Lines 404 to 406 in c1c220e

# flatten list of skipped keys and filter-for-installers
options.skip_keys = [key for s in options.skip_keys for key in s.split(' ')]
options.filter_for_installers = [inst for s in options.filter_for_installers for inst in s.split(' ')]

@ruffsl
Copy link
Contributor

ruffsl commented Apr 6, 2020

IMO, inputs separated by spaces are bit friendlier to work with in scripts and pipes using the CLI.

@dirk-thomas
Copy link
Member

inputs separated by spaces are bit friendlier to work with

Btw this is also the only way supported by argparse. So in order to not do custom command line argument parsing I would say we should use what is offered by the "standard" in Python.

@mortenfyhn
Copy link

Just chiming in that I'm very excited about this feature.

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-noetic-ninjemys-release/14262/9

@iluetkeb
Copy link

This seems to have stalled a bit -- any particular reason, or can we revive it?

@mateus-amarante
Copy link
Contributor

I opened a Pull Request to @nalt's branch (nalt#1) finishing this update. Let's see if he answers. I'm not sure this is the best move in this situation. Alternatively, I could open a new PR but then we would have two PR's for the same thing. Please, let me know if there is a more adequate action.

@emersonknapp
Copy link

Should this have been closed by that PR? Seems like this is probably still open until merged into upstream here

@gavanderhoorn
Copy link
Contributor

Getting this merged would make using multi-stage Docker builds finally really scalable (no more manual runtime dependency management 🎉).

What's the major blocker?

@nuclearsandwich
Copy link
Contributor

What's the major blocker?

At this point it's review time. I'll schedule it for next week and try my best to meet that appointment.

Copy link
Contributor

@mateus-amarante mateus-amarante left a comment

Choose a reason for hiding this comment

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

There are some problems with the last merge. The following suggestions might fix most of the problems.

@@ -27,4 +27,4 @@ testsetup:
echo "running rosdep tests"

test: testsetup
nosetests --with-coverage --cover-package=rosdep2 --with-xunit test
nosetests3 --with-coverage --cover-package=rosdep2 --with-xunit test
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
nosetests3 --with-coverage --cover-package=rosdep2 --with-xunit test
nosetests --with-coverage --cover-package=rosdep2 --with-xunit test

It was my bad. I accidentally committed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

If changes to the test runners are proposed I'd prefer them in a separate PR for ease of review.

Copy link
Contributor

Choose a reason for hiding this comment

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

Originally, the tests use nosetests (Python 2 version). I didn't intend to propose a test runner change. I changed it locally to try some stuff and committed it unintentionally. This suggestion reverts this change.

@@ -295,6 +300,7 @@ def setup_environment_variables(ros_distro):

def _rosdep_main(args):
# sources cache dir is our local database.
global _global_options
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
global _global_options

This is not needed


options, args = parser.parse_args(args)
_global_options = options
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_global_options = options

Not needed

@@ -339,6 +339,8 @@ def create_from_rospkg(rospack=None, rosstack=None,
instance used to crawl ROS stacks.
:param sources_loader: (optional) Override SourcesLoader used
for managing sources.list data sources.
:param dependency_types: (optional) List of dependency types.
Allowed: "build", "buildtool", "run", "test"
Copy link
Contributor

@mateus-amarante mateus-amarante Oct 9, 2020

Choose a reason for hiding this comment

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

Suggested change
Allowed: "build", "buildtool", "run", "test"
Allowed: "build", "buildtool", "build_export", "run", "test", "exec", "doc"

It also supports build_export, exec, and doc dependencies

Copy link
Contributor

Choose a reason for hiding this comment

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

Should these docs also link to the specification for dependency types either in catkin_pkg or the ROS REPs defining the package.xml format?

Copy link
Contributor

@mateus-amarante mateus-amarante Nov 12, 2020

Choose a reason for hiding this comment

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

Good point. The doc_depend seems to be introduced only in format 2 ( REP127, schema files ), so maybe it is better not to consider it.

Comment on lines +133 to +135
global _global_options
if options is None:
options = _global_options
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer needed

Suggested change
global _global_options
if options is None:
options = _global_options

def _get_default_RosdepLookup(options):
_global_options = None

def _get_default_RosdepLookup(options=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to keep this

Suggested change
def _get_default_RosdepLookup(options=None):
def _get_default_RosdepLookup(options):

@@ -123,16 +123,21 @@ class UsageError(Exception):
"""


def _get_default_RosdepLookup(options):
_global_options = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_global_options = None
_global_options = None

This is not needed

Copy link
Contributor

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

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

Overall these changes are looking promising. Thank you very much for adding tests along with this new feature.

I generally agree with the review suggestions from @mateus-amarante, would you have the opportunity to respond to that feedback before another round of review?

@mateus-amarante
Copy link
Contributor

@nuclearsandwich, if you agree, I can create a new PR from my fork, so that I can finish the updates and you can do another review. I'm very interested in this feature, so I will be committed to fixing any problem pointed out.

@nuclearsandwich
Copy link
Contributor

I can create a new PR from my fork, so that I can finish the updates and you can do another review. I'm very interested in this feature, so I will be committed to fixing any problem pointed out.

Please go ahead!

@emersonknapp
Copy link

@nuclearsandwich i think we can close this PR, #789 is looking good (and could use maintainer review :))

@nuclearsandwich
Copy link
Contributor

Replaced by #789

nuclearsandwich added a commit that referenced this pull request Jun 25, 2021
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.