Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: --incompatible_python_disallow_native_rules broken with 0.37.0 #2326

Closed
rickeylev opened this issue Oct 22, 2024 · 1 comment · Fixed by #2327
Closed

bug: --incompatible_python_disallow_native_rules broken with 0.37.0 #2326

rickeylev opened this issue Oct 22, 2024 · 1 comment · Fixed by #2327
Assignees

Comments

@rickeylev
Copy link
Collaborator

🐞 bug report

Affected Rule

py_binary, py_library, py_test

Is this a regression?

Yes. Earlier versions didn't break if --incompatible_python_disallow_native_rules was specified

Description

When specified, all core rules fail to build with the error

Error in fail: @//tests/base_rules/py_binary:test_py_runtime_info_provided_subject not allowed to use native.py_binary

or similar

🔬 Minimal Reproduction

Any build with --incompatible_python_disallow_native_rules set

@rickeylev rickeylev self-assigned this Oct 22, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 22, 2024
…_rules checking (#2327)

When --incompatible_python_disallow_native_rules is enabled, all the
core rules fail with
an error that rules_python should be used. This is incorrect, since the
rules_python rules
are being used. What's happening is
#2257
removed the magic migration tag when pystar is enabled, but the code to
check the tag
was present wasn't removed. This went unnoticed because our CI doesn't
set the migration
flag.

To fix, remove the validation logic entirely. If we're in the
rules_python implementation,
then there is not need to perform this validation. It was just something
copy/pasted from
the original code from Bazel itself.

Also update the bazelrc to always set
--incompatible_python_disallow_native_rules.

Fixes #2326
Fixes #1645
rickeylev added a commit to rickeylev/rules_python that referenced this issue Oct 22, 2024
…_rules checking (bazelbuild#2327)

When --incompatible_python_disallow_native_rules is enabled, all the
core rules fail with
an error that rules_python should be used. This is incorrect, since the
rules_python rules
are being used. What's happening is
bazelbuild#2257
removed the magic migration tag when pystar is enabled, but the code to
check the tag
was present wasn't removed. This went unnoticed because our CI doesn't
set the migration
flag.

To fix, remove the validation logic entirely. If we're in the
rules_python implementation,
then there is not need to perform this validation. It was just something
copy/pasted from
the original code from Bazel itself.

Also update the bazelrc to always set
--incompatible_python_disallow_native_rules.

Fixes bazelbuild#2326
Fixes bazelbuild#1645
@rickeylev
Copy link
Collaborator Author

This is fixed at head and we'll release a patch release today/tomorrow. In the meantime, applying this patch will early return from the validation logic and work around the issue: https://github.com/bazelbuild/rules_python/commit/1fc0495b87b28b243e9aa3d89fe645f5f28071ba.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant