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

fix: handle py_binary#main like rules_python does #241

Merged
merged 7 commits into from
Jan 16, 2024
Merged

Conversation

alexeagle
Copy link
Member

@alexeagle alexeagle commented Jan 11, 2024

I don't love the semantics but it's better for us to follow our 'drop-in replacement' philosophy than explain to users how they're meant to change their code.


Type of change

  • Bug fix (change which fixes an issue)

Test plan

  • New test cases added

I don't love the semantics but it's better for us to follow our 'drop-in replacement' philosophy than explain to users how they're meant to change their code.
Copy link
Collaborator

@mattem mattem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests too and update the PR description before landing.

py/defs.bzl Outdated Show resolved Hide resolved
py/defs.bzl Outdated Show resolved Hide resolved
use it to demonstrate how you can opt-out from rules_python semantics on the 'main' attribute
@alexeagle alexeagle marked this pull request as ready for review January 14, 2024 23:31
py/private/py_executable.bzl Outdated Show resolved Hide resolved
@alexeagle alexeagle enabled auto-merge (squash) January 16, 2024 15:36
@alexeagle alexeagle merged commit f2240ac into main Jan 16, 2024
2 checks passed
@alexeagle alexeagle deleted the py_binary-main branch January 16, 2024 15:38
@honnix
Copy link

honnix commented Jun 6, 2024

If I understand it correctly, the following code would stop working:

py_pytest_main(
    name = "__test__",
)

py_test(
    name = "test_all",
    srcs = glob(["**/*.py"]),
    main = ":__test__.py",
    deps = [":__test__", ...],
)

and it should now be:

py_pytest_main(
    name = "__test__",
)

py_test(
    name = "test_all",
    srcs = glob(["**/*.py"]) + [":__test__"],
    main = ":__test__.py",
    deps = [...],
)

Is that correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants