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

Clearly document PY2/PY3 mode #6442

Closed
brandjon opened this issue Oct 18, 2018 · 1 comment
Closed

Clearly document PY2/PY3 mode #6442

brandjon opened this issue Oct 18, 2018 · 1 comment
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Python Native rules for Python type: documentation (cleanup)

Comments

@brandjon
Copy link
Member

brandjon commented Oct 18, 2018

Explain on the python rules page the following info:

  • There's a configuration field for selecting the python major version. It can be PY2, PY3, or unset/unknown.

  • This gets set to PY2 or PY3 when you encounter a py_binary target (based on its default_python_version attr), or by a top-level flag --force_python.

  • Once set, the same mode is used recursively for py_library targets that are transitively in the deps attr. But targets in the data attr are reset to unknown, so they can contain py_binarys in a different mode.

  • The mode determines what system python interpreter is used by default (if no py_runtime / --python_top is given). In the future it may also be used to help select among multiple py_runtimes.

  • Users can select() on the force_python flag to condition pieces of the build based on which mode is being used.

  • Bazel validates that python targets marked via srcs_version to be only PY2 or only PY3 are built in the expected mode.

NB: Current bugs that impact the above description:

@brandjon brandjon added type: documentation (cleanup) P2 We'll consider working on this in future. (Assignee optional) team-Rules-Python Native rules for Python labels Oct 18, 2018
@brandjon brandjon self-assigned this Oct 18, 2018
@brandjon brandjon added P1 I'll work on this now. (Assignee required) P2 We'll consider working on this in future. (Assignee optional) and removed P2 We'll consider working on this in future. (Assignee optional) P1 I'll work on this now. (Assignee required) labels Oct 18, 2018
bazel-io pushed a commit that referenced this issue Feb 1, 2019
This isn't perfect in terms of linkifying names of rules/attrs, but it's a vast improvement and needed to get this change migration-ready. Ideally we'd have a dedicated Python concepts page.

Also did a little drive-by cleanup of unrelated attributes' docs and a few redundancies in attribute declarations.

Work toward #6583, #6442.

RELNOTES: None
PiperOrigin-RevId: 231966448
@lberki
Copy link
Contributor

lberki commented Nov 18, 2020

I'll close this since Python 2 support for the native Python rules is going away soon.

@lberki lberki closed this as completed Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Python Native rules for Python type: documentation (cleanup)
Projects
None yet
Development

No branches or pull requests

2 participants