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

Document effect of Python version on output path #4504

Open
minorhacks opened this issue Jan 22, 2018 · 3 comments
Open

Document effect of Python version on output path #4504

minorhacks opened this issue Jan 22, 2018 · 3 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Documentation Documentation improvements that cannot be directly linked to other team labels team-Rules-Python Native rules for Python type: documentation (cleanup)

Comments

@minorhacks
Copy link

Description of the problem / feature request:

Bazel 0.9.0 does not put py_binary targets with default_python_version = "PY3" under bazel-bin. Instead, built targets appear under bazel-out/ in a python3-specific bin directory rather than the same bin directory used by other targets (the one that bazel-bin remains symlinked to)

I realize that Python 3 support is experimental, but is this expected behavior? I thought it was expected that any target built with bazel build should have its artifacts appear in bazel-bin.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

some_py_proj/foo.py:

if __name__ == "__main__":
    print("Hello, world!")

some_py_proj/BUILD:

py_binary(
    name = "foo",
    srcs = ["foo.py"],
)

bazel build some_py_proj:foo prints:

Target //some_py_proj:foo up-to-date:
bazel-bin/some_py_proj/foo

Modify some_py_proj/BUILD:

py_binary(
    name = "foo",
    srcs = ["foo.py"],
    default_python_version = "PY3",
)

bazel build some_py_proj:foo now prints:

Target //some_py_proj:foo up-to-date:
bazel-out/k8-py3-fastbuild/bin/some_py_proj/foo

and bazel-bin is symlinked to effectively bazel-out/k8-fastbuild/bin

What operating system are you running Bazel on?

Ubuntu 16.04

What's the output of bazel info release?

release 0.9.0

Have you found anything relevant by searching the web?

Nothing in release notes about the Python3 binary output directory changing since 0.6.1, which we are migrating from (this version did put the built python3 artifact under bazel-bin). Nothing relevant by searching issues for default_python_version or by searching the web for bazel-bin default_python_version.

@iirina iirina added P2 We'll consider working on this in future. (Assignee optional) category: rules > python labels Jan 23, 2018
@iirina iirina self-assigned this Jan 23, 2018
@brandjon
Copy link
Member

This is WAI. Using Python 3 mode changes the build configuration and can cause the same targets to produce different build results, so they get generated under a different path. We should document this behavior better.

@brandjon
Copy link
Member

See also #7593. In Bazel 0.25 this behavior will be reversed and it's PY2 targets that will go in the other (non-bazel-bin) directory.

@brandjon brandjon changed the title Bazel does not put py_binary targets with default_python_version = "PY3" under bazel-bin Document effect of Python version on output path Jun 17, 2019
@lberki lberki added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P2 We'll consider working on this in future. (Assignee optional) labels Nov 18, 2020
@sgowroji sgowroji added the team-Documentation Documentation improvements that cannot be directly linked to other team labels label Jan 11, 2023
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Documentation Documentation improvements that cannot be directly linked to other team labels team-Rules-Python Native rules for Python type: documentation (cleanup)
Projects
None yet
Development

No branches or pull requests

4 participants