Skip to content

Action conflicts when new Python version transition semantics are enabled #7655

@brandjon

Description

@brandjon

There've been multiple reports of action conflicts when --incompatible_allow_python_version_transitions is enabled. Here's a minimal repro:

cc_binary(
    name = "foo",
    srcs = ["foo.cc"],
)

py_binary(
    name = "bar",
    srcs = ["bar.py"],
    data = [":foo"],
)
bazel build --nobuild :foo :bar --incompatible_allow_python_version_transitions

Note that :foo is built in two configurations: the top-level configuration, and a config transitioned by the py_binary rule. The transition serves two purposes:

  1. It changes the Python version if necessary (not the case here).

  2. It changes the value of the physical --force_python flag (above it's null since it's absent) to be consistent with the Python version, so that select()s on "force_python" will work. This is done to improve backward compatibility, but once code is migrated for --incompatible_remove_old_python_version, selecting on "force_python" is actually prohibited anyway and this is moot.

The logic for whether or not the transition occurs is here. If I prevent the transition from happening, the action conflict goes away. This can be done by passing either an explicit (but semantically redundant) --force_python=PY2 flag, or the --incompatible_remove_old_python_version_api flag.

The question is what are the exact conflicting actions, and why did the two nearly identical configurations produce different results? It can't be due to hidden select()s on "force_python" (via implicit dependencies), because they would be errors under --incompatible_remove_old_python_version_api.

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-Rules-PythonNative rules for Pythontype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions