Skip to content

Output generated by gazelle_python_manifest is not deterministic #812

@abhishekshivanna

Description

@abhishekshivanna

🐞 bug report

Affected Rule

The issue is caused by the rule:

load("@rules_python//gazelle/manifest:defs.bzl", "gazelle_python_manifest")

Is this a regression?

Don't think so, probably always existed

Description

When invoking the update rule on gazelle_python_manifest the output generated to the gazelle_python.yaml mapping file is not deterministic. This non-determinism causes the test rule (gazelle_python_manifest.test) to always fail.

🔬 Minimal Reproduction

I've created a sample repository with a dependency that triggers this bug: https://github.com/abhishekshivanna/rules_python_bug

You can run bazel run //:gazelle_python_manifest.update to see that the gazelle_python.yaml constantly changes on subsequent runs.

🔥 Exception or Error

bazel run //:gazelle_python_manifest.test
INFO: Analyzed target //:gazelle_python_manifest.test (8 packages loaded, 213 targets configured).
INFO: Found 1 target...
Target //:gazelle_python_manifest.test up-to-date:
  bazel-bin/gazelle_python_manifest.test
INFO: Elapsed time: 0.707s, Critical Path: 0.44s
INFO: 6 processes: 4 internal, 2 darwin-sandbox.
INFO: Build completed successfully, 6 total actions
INFO: Build completed successfully, 6 total actions
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //:gazelle_python_manifest.test
-----------------------------------------------------------------------------
2022/08/28 19:36:37 ERROR: "/Users//code/rules_python_bug/gazelle_python.yaml" is out-of-date, follow the intructions on this file for updating.

🌍 Your Environment

Operating System:

  
Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
  

Output of bazel version:

  
Bazelisk version: development
Build label: 5.2.0
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:11:09 2022 (1654618269)
Build timestamp: 1654618269
Build timestamp as int: 1654618269
  

Rules_python version:

  
http_archive(
    name = "rules_python",
    sha256 = "a3a6e99f497be089f81ec082882e40246bfd435f52f4e82f37e89449b04573f6",
    strip_prefix = "rules_python-0.10.2",
    url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.10.2.tar.gz",
)
  

Anything else relevant?

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