Skip to content

[pull] main from bazel-contrib:main#286

Merged
pull[bot] merged 1 commit into
garymm:mainfrom
bazel-contrib:main
May 25, 2025
Merged

[pull] main from bazel-contrib:main#286
pull[bot] merged 1 commit into
garymm:mainfrom
bazel-contrib:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 25, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

# Background
Use case: user is setting up the environment for a docker image, and
needs a bash executable from the py_console_script (e.g. to run `ray`
from command line without full bazel bootstrapping). User is responsible
of setting up the right paths (and hermeticity concerns). There's no
change in default behavior per this diff.

Previously, prior to Bazel mod, this was possible and simple through the
use of `rules_python_wheel_entry_points` ([per
here](https://github.com/bazel-contrib/rules_python/blob/9dfa3abba293488a9a1899832a340f7b44525cad/python/private/pypi/whl_library.bzl#L507))
but these are not reachable now via Bazel mod.

# Approach
Add a shebang attribute that allows users of the console binary to use
it like a binary executable.

This is similar to the functionality that came with wheel entry points
here:

https://github.com/bazel-contrib/rules_python/blob/9dfa3abba293488a9a1899832a340f7b44525cad/python/private/pypi/whl_library.bzl#L507

With this change, one can specify a shebang like:
```starlark
py_console_script_binary(
    name = "yamllint",
    pkg = "@pip//yamllint",
    shebang = "#!/usr/bin/env python3",
)
```

Summary:
- Update tests
- Add test for this functionality
- Leave default to without shebang so this is a non-breaking change
- Documentation (want to hear more about the general approach first, and
also want to hear whether this warrants specific docs, or can just leave
it to API docs)

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
@pull pull Bot added the ⤵️ pull label May 25, 2025
@pull pull Bot merged commit e73dccf into garymm:main May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant