Skip to content

Support src-less invocation of py_binary #2765

Closed
@aignas

Description

@aignas

With the recent addition of the #2671, I find that in most cases I can replace the py_console_script_binary with just a py_binary, e.g:

py_console_script_binary(
    name = "foo",
    deps = [...],
    pkg = "foo",
    script = "bar",
)

versus

py_binary(
    name = "foo",
    deps = [...], # assuming "foo" is in the deps
    main_module = "bar"
)

However I cannot do this, because the srcs cannot be empty here.

An alternative to this could be to use the python_interpreter introduced in #2507

interpreter_binary(
    name = "foo",
    deps = [...],
    args = ["-m", "foo"],
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions