Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support PEP 338 invocation of rosdep2 module #862

Merged
merged 1 commit into from
May 16, 2022
Merged

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Apr 1, 2022

This package has a well-established entry point. It would be great to gain access to that entry point in a way that allows use of a specific interpreter and bypasses PATH.

This package has a well-established entry point. It would be great to
gain access to that entry point in a way that allows use of a specific
interpreter and bypasses PATH.
@cottsay cottsay self-assigned this Apr 1, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2022

Codecov Report

Merging #862 (89d621e) into master (6b05600) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #862      +/-   ##
==========================================
- Coverage   75.03%   74.97%   -0.07%     
==========================================
  Files          42       43       +1     
  Lines        3333     3336       +3     
==========================================
  Hits         2501     2501              
- Misses        832      835       +3     
Impacted Files Coverage Δ
src/rosdep2/__main__.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b05600...89d621e. Read the comment docs.

@nuclearsandwich
Copy link
Contributor

So I understand correctly, is goal of this PR is to enable the use of

python3 -m rosdep2 update so that it's equivalent (assuming your path is rational and the rosdep bin and python3 bin are from the same environment) to rosdep update

I don't doubt that this is the way to go about it but I'm not quite able to connect the dots myself between the runpy.run_module signature in https://peps.python.org/pep-0338/ and the addition of this file. So I'd appreciate some support in understanding how this works.

@cottsay
Copy link
Member Author

cottsay commented Apr 15, 2022

I'm not quite able to connect the dots myself between the runpy.run_module signature in https://peps.python.org/pep-0338/ and the addition of this file.

From the abstract:

This PEP defines semantics for executing any Python module as a script, either with the -m command line switch, or by invoking it via runpy.run_module(modulename).

I referenced this pep because it describes the "desired behavior" of how I'd like to invoke this module (both via -m and runpy.run_module). Unfortunately, I'm a little lost on the details of how the connection to __main__ is made, but the non-pep documentation is pretty clear, and also references pep 338: https://docs.python.org/3/using/cmdline.html#cmdoption-m

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.

I forgot to circle back after my questions were answered.

Looks like an entirely useful change. Thanks!

@cottsay cottsay merged commit ebd7f6d into master May 16, 2022
@cottsay cottsay deleted the cottsay/pep338 branch May 16, 2022 17:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants