)]}'
{
  "commit": "e73dccf7b1827b1ea1216646ac82c97ae8d1e64b",
  "tree": "bbe54ba0ce14c1b0ea2636220c26b508e4ff1e6f",
  "parents": [
    "28fda8664a1e89f2f055ed7183ad28dbdbeaafc9"
  ],
  "author": {
    "name": "Chris Chua",
    "email": "chris.sirhc@gmail.com",
    "time": "Sun May 25 13:21:44 2025 +0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Sun May 25 05:21:44 2025 +0000"
  },
  "message": "feat: add shebang attribute on py_console_script_binary (#2867)\n\n# Background\nUse case: user is setting up the environment for a docker image, and\nneeds a bash executable from the py_console_script (e.g. to run `ray`\nfrom command line without full bazel bootstrapping). User is responsible\nof setting up the right paths (and hermeticity concerns). There\u0027s no\nchange in default behavior per this diff.\n\nPreviously, prior to Bazel mod, this was possible and simple through the\nuse of `rules_python_wheel_entry_points` ([per\nhere](https://github.com/bazel-contrib/rules_python/blob/9dfa3abba293488a9a1899832a340f7b44525cad/python/private/pypi/whl_library.bzl#L507))\nbut these are not reachable now via Bazel mod.\n\n# Approach\nAdd a shebang attribute that allows users of the console binary to use\nit like a binary executable.\n\nThis is similar to the functionality that came with wheel entry points\nhere:\n\nhttps://github.com/bazel-contrib/rules_python/blob/9dfa3abba293488a9a1899832a340f7b44525cad/python/private/pypi/whl_library.bzl#L507\n\nWith this change, one can specify a shebang like:\n```starlark\npy_console_script_binary(\n    name \u003d \"yamllint\",\n    pkg \u003d \"@pip//yamllint\",\n    shebang \u003d \"#!/usr/bin/env python3\",\n)\n```\n\nSummary:\n- Update tests\n- Add test for this functionality\n- Leave default to without shebang so this is a non-breaking change\n- Documentation (want to hear more about the general approach first, and\nalso want to hear whether this warrants specific docs, or can just leave\nit to API docs)\n\n---------\n\nCo-authored-by: Ignas Anikevicius \u003c240938+aignas@users.noreply.github.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "aa356e0e9456aba2a5320fdedad3cc379e5bec59",
      "old_mode": 33188,
      "old_path": "docs/_includes/py_console_script_binary.md",
      "new_id": "d327091630e27075893ab989155444805336c02a",
      "new_mode": 33188,
      "new_path": "docs/_includes/py_console_script_binary.md"
    },
    {
      "type": "modify",
      "old_id": "154fa3bf2f352742e3c32836905310d0e8ef1ca9",
      "old_mode": 33188,
      "old_path": "python/private/py_console_script_binary.bzl",
      "new_id": "d98457dbe15097cdd94ef6ce4d2cd079e8550640",
      "new_mode": 33188,
      "new_path": "python/private/py_console_script_binary.bzl"
    },
    {
      "type": "modify",
      "old_id": "7dd4dd2dad866aacea5473b62c8a666c03b2f87e",
      "old_mode": 33188,
      "old_path": "python/private/py_console_script_gen.bzl",
      "new_id": "de016036b26b3b8228c409efd1a20a0146d39674",
      "new_mode": 33188,
      "new_path": "python/private/py_console_script_gen.bzl"
    },
    {
      "type": "modify",
      "old_id": "ffc4e81b3ae93a8aa0c1775e1ce2c91a85bdeace",
      "old_mode": 33188,
      "old_path": "python/private/py_console_script_gen.py",
      "new_id": "4b4f2f6986857ad55cc5cbfa10165d4a58f712cd",
      "new_mode": 33188,
      "new_path": "python/private/py_console_script_gen.py"
    },
    {
      "type": "modify",
      "old_id": "a5fceb67f9bdabe6f9eaccaea30c5c2effe6883c",
      "old_mode": 33188,
      "old_path": "tests/entry_points/py_console_script_gen_test.py",
      "new_id": "1bbf5fbf25d0691a8b15bd9bcec9147ac5cfffc3",
      "new_mode": 33188,
      "new_path": "tests/entry_points/py_console_script_gen_test.py"
    }
  ]
}
