Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Gazelle occasionally overwrites py_binary targets when new .py files are added #2670

Closed as duplicate of#2627
@michael-christen

Description

@michael-christen

🐞 bug report

Affected Rule

  • py_binary

Is this a regression?

I don't think this is a regression as I've seen this since I started using gazelle.

Description

When running gazelle on a directory with a new .py file that satisfies the constraints for a py_binary, it will replace existing py_binary definitions for this new .py file.

🔬 Minimal Reproduction

Here's a reproduction on my personal repo, lmk if it'd be easier to make a whole new repo:

michael-christen/toolbox#213

I'm not having much luck with a simpler attempt at reproduction:

🔥 Exception or Error

No exception, just a silent overriding of behavior.

🌍 Your Environment

Operating System:

  
± lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
  

Output of bazel version:

  
± bazel version
Bazelisk version: v1.24.1
INFO: Invocation ID: ef6a53a8-04a1-4f25-a901-b8283410ff9e
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Jan 01 00:00:00 1970 (0)
Build timestamp: Thu Jan 01 00:00:00 1970 (0)
Build timestamp as int: 0
  

bazel commit: bazelbuild/bazel@0ddcfd3

Rules_python version:

  
0.34.0
  

Anything else relevant?

I've seen this across a wide variety of repos and setups.

# gazelle:python_generation_mode file

is configured in BUILD

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