rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Support for additional `py_binary` kwargs in `entry_point`

Open phlax opened this issue 4 years ago • 4 comments

🚀 feature request

Relevant Rules

  • entry_point
  • py_binary

Description

afaict, you cant pass kwargs - eg args, data etc into an entry_point rule, it would be handy if you could

Describe the solution you'd like

To be able to do something like


alias(
    name = "my_command",
    actual = entry_point(
        pkg = "my.upstream.command",
        script = "my.upstream.command",
        data = [":some_local_data"],
        args = ["$(location :some_local_data)"],
    ),
)

Describe alternatives you've considered

wrapping the entry_point one way or another to call it with the required data, args

phlax avatar Jan 07 '22 17:01 phlax

one possible solution would be if you could use an entry_point alias in the srcs/main of a py_binary rule

i tried to do it but it needs a .py file, so maybe that wouldnt work with alias

phlax avatar Jan 08 '22 11:01 phlax

i have a ~hacky workaround for this problem here https://github.com/envoyproxy/envoy/pull/19450/files#diff-41e9a812f4081144b27bc30f768b83820451109ca362e1b1ad125a04a9ffcd0bR76

phlax avatar Jan 08 '22 11:01 phlax

https://github.com/bazelbuild/rules_python/pull/575 expands on the same pattern. I think there's value in having isolated targets but perhaps there can be an additional macro that defines a py_binary in place that allows you to add dependencies?

Or, perhaps with package_annotation (https://github.com/bazelbuild/rules_python/pull/589) a new field could be added that adds additional dependencies to the generated binary targets?

UebelAndre avatar Jan 21 '22 02:01 UebelAndre

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

github-actions[bot] avatar Jul 20 '22 22:07 github-actions[bot]

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar Aug 20 '22 22:08 github-actions[bot]