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

Expose PyRuntimeInfo from py_binary and py_test #7805

Closed
brandjon opened this issue Mar 21, 2019 · 2 comments
Closed

Expose PyRuntimeInfo from py_binary and py_test #7805

brandjon opened this issue Mar 21, 2019 · 2 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Rules-Python Native rules for Python type: feature request

Comments

@brandjon
Copy link
Member

PyRuntimeInfo is the provider type produced by py_runtime-like rules. It is consumed (either through toolchains (#7375) or legacy flags) by executable Python rules. We can have these executable rules re-export the provider so downstream targets can see what Python interpreter a given py_binary is configured to use.

@brandjon
Copy link
Member Author

Aiming to do this in 0.27.

@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 May 23, 2019
@brandjon brandjon self-assigned this May 23, 2019
@brandjon
Copy link
Member Author

0.28 it is.

siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
This allows targets that depend on an executable Python target to see what runtime was chosen from the toolchain. The returned `PyRuntimeInfo` provider is the same type of value as what's returned by the `py_runtime` rule.

For example, the path to the system interpreter (if not using an in-workspace interpreter) can be accessed from a dependency as `mydep[PyRuntimeInfo].interpreter_path`. The Python major version for a target can also indirectly be obtained from the version of its runtime, as `mydep[PyRuntimeInfo].python_version`.

Fixes bazelbuild#7805.

RELNOTES: None
PiperOrigin-RevId: 254212408
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
This allows targets that depend on an executable Python target to see what runtime was chosen from the toolchain. The returned `PyRuntimeInfo` provider is the same type of value as what's returned by the `py_runtime` rule.

For example, the path to the system interpreter (if not using an in-workspace interpreter) can be accessed from a dependency as `mydep[PyRuntimeInfo].interpreter_path`. The Python major version for a target can also indirectly be obtained from the version of its runtime, as `mydep[PyRuntimeInfo].python_version`.

Fixes bazelbuild#7805.

RELNOTES: None
PiperOrigin-RevId: 254212408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Rules-Python Native rules for Python type: feature request
Projects
None yet
Development

No branches or pull requests

1 participant