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

Support both Python 2 and 3 in tools (i.e. host configuration) #6443

Closed
brandjon opened this issue Oct 18, 2018 · 8 comments
Closed

Support both Python 2 and 3 in tools (i.e. host configuration) #6443

brandjon opened this issue Oct 18, 2018 · 8 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Python Native rules for Python type: feature request

Comments

@brandjon
Copy link
Member

We need to provide a way for genrules to invoke python 3 binaries as tools. Currently the tools attribute uses the special HOST config, which prevents switching the PY2/PY3 mode. Design doc to come.

Targeting 2018 Q4.

@brandjon brandjon added type: feature request 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) and removed P2 We'll consider working on this in future. (Assignee optional) labels Oct 18, 2018
@brandjon
Copy link
Member Author

(P1 for a feature request essentially means "this quarter", so not as urgent as P1 for a bug.)

@brandjon
Copy link
Member Author

This crosses over into Configurability team's domain and I understand they're prioritizing it, so until we understand more I'm marking this P2.

@brandjon brandjon added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Jan 30, 2019
@brandjon
Copy link
Member Author

This is blocked on work by Configurability team to add an "execution transition". Unlike the host transition, this transition will allow for subsequent transitions such as changes to the Python version.

Once that's in, we can add new attributes to rules to use this transition in place of the host transition, e.g. create genrule.exec_tools to replace genrule.tools. Users can incrementally migrate dependencies from tools to exec_tools and likewise for other rules.

Over the long term, the difference between the host configuration and the "execution platform configuration" will decrease, as more things are migrated to use platforms and toolchains rather than ad hoc flags.

@brandjon
Copy link
Member Author

Update: This is being actively worked on by configurability team but there likely won't be anything in the 0.27 release, which is the release that will turn on Python toolchains. See #7899 for migration-related concerns.

The new plan may in fact be to not create an exec_tools attribute but just change genrule's tools attribute to use the execution config instead of host config.

@brandjon brandjon changed the title Python 3 mode for genrules Support both Python 2 and 3 in tools (i.e. host configuration) May 16, 2019
@brandjon
Copy link
Member Author

Latest update is that exec_tools will be added to genrule until blockers for migrating tools to exec config can be worked out. For starlark rules there's already a cfg="exec" value for attribute definitions.

@brandjon
Copy link
Member Author

FYI exec_tools for genrule will be in 0.28 (implemented in d97392f).

@speedskater
Copy link

@brandjon Thanks for this hint of using cfg="exec". It safed my day. Do you know if there is a specific reason, why this is not part of the official documentation?

mihaimaruseac pushed a commit to tensorflow/estimator that referenced this issue Jun 30, 2020
This is required to use py3 targets as part of a genrule; cf:
bazelbuild/bazel#6443

PiperOrigin-RevId: 319104056
@lberki
Copy link
Contributor

lberki commented Nov 18, 2020

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

@lberki lberki closed this as completed Nov 18, 2020
jvolkman added a commit to jvolkman/bazel that referenced this issue Jul 1, 2022
These messages are rarely helpful and often misleading. The associated TODO (bazelbuild#6443) was closed years ago.
copybara-service bot pushed a commit that referenced this issue Jul 21, 2022
These messages are rarely helpful and often misleading. The associated TODO (#6443) was closed years ago.

Closes #15783.

PiperOrigin-RevId: 462371940
Change-Id: I62f903f66927fdd7fb2e8c1205b1af2b220677a1
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: feature request
Projects
None yet
Development

No branches or pull requests

3 participants