bazel run //:requirements.update writes to stdout instead of updating requirements_lock.txt
🐞 bug report
Affected Rule
Not sure
Is this a regression?
Not sure
Description
A clear and concise description of the problem...🔬 Minimal Reproduction
Command:
d:\workdir>bazel run //:requirements.update
INFO: Analyzed target //:requirements.update (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:requirements.update up-to-date:
bazel-bin/requirements.update.zip
bazel-bin/requirements.update.exe
INFO: Elapsed time: 79.753s, Critical Path: 78.37s
INFO: 3 processes: 2 internal, 1 local.
INFO: Build completed successfully, 3 total actions
INFO: Running command line: bazel-bin/requirements.update.exe _main/tools/bb/requirements.txt _main/requirements_lock.txt //:requirements.update '--resolver=backtracking' --allow-unsafe --generate-hashes '--requirements-windows=_main/requirements_windows.txt'
Updating requirements_windows.txt
WARNING: --strip-extras is becoming the default in version 8.0.0. To silence this warning, either use --strip-extras to opt into the new default or use --no-strip-extras to retain the existing behavior.
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# bazel run //:requirements.update
#
(snip)
MODULE.bazel
bazel_dep(name = "rules_python", version = "0.32.2")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.11",
is_default = True,
ignore_root_user_error = True,
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "bb_deps",
python_version = "3.11",
# We can use `envsubst in the above
envsubst = ["PIP_INDEX_URL"],
# Use the bazel downloader to query the simple API for downloading the sources
# Note, that we can use envsubst for this value.
experimental_index_url = "${PIP_INDEX_URL:-https://pypi.org/simple}",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "bb_deps")
BUILD.bazel
load("@gazelle//:def.bzl", "gazelle")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
# gazelle:prefix company.com/bazel2
gazelle(name = "gazelle")
# This stanza calls a rule that generates targets for managing pip dependencies
# with pip-compile.
compile_pip_requirements(
name = "requirements",
timeout = "moderate",
src = "//tools/bb:requirements.txt",
requirements_txt = "requirements_lock.txt",
requirements_windows = "requirements_windows.txt",
)
🔥 Exception or Error
requirements_lock.txt and requirements_windows.txt are not updated.
🌍 Your Environment
Operating System:
Windows 10
Output of bazel version:
7.2.0rc3
Rules_python version:
0.32.2
Anything else relevant?
The output to stdout should be in addition to the output to the file. Is the file and the stdout output different? Could you create a small reproducible example that we could check?
Closing as part of cleaning stale issues, if this is an issue on the latest release, please retest and update the original description.
Adding comment that I also experienced this bug on OSX 15 with rules_python 0.36, but updating to 1.0 resolved the issue and is now correctly generating requirements.txt output instead of silently failing to update the file.