Skip to content

feat: provide access to arbitrary interpreters#2507

Merged
rickeylev merged 42 commits intobazel-contrib:mainfrom
philsc:unreviewed/philsc/interpreter
Feb 16, 2025
Merged

feat: provide access to arbitrary interpreters#2507
rickeylev merged 42 commits intobazel-contrib:mainfrom
philsc:unreviewed/philsc/interpreter

Conversation

@philsc
Copy link
Copy Markdown
Contributor

@philsc philsc commented Dec 16, 2024

There are some use cases that folks want to cover here. They are
discussed in this Slack thread. The high-level summary is:

  1. Users want to run the exact same interpreter that Bazel is running
    to minimize environmental issues.
  2. It is useful to pass a target label to third-party tools like mypy
    so that they can use the correct interpreter.

This patch adds to @rickeylev's work from #2359 by adding docs
and a few integration tests.

rickeylev and others added 10 commits October 29, 2024 21:05
Run a specific interpreter:
* `bazel run @rules_python//tools/run --@rules_python//python/config_settings:python_version=3.12`

Run interpreter from a binary:
* `bazel run @rules_python//tools/run --@rules_python//tools/run:bin=//my:binary`
    $ bazel run //python/bin:repl
    $ bazel run //python/bin:repl --//python/bin:repl_dep=//python/runfiles
Comment thread docs/toolchains.md Outdated
Copy link
Copy Markdown
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

I know this is still a draft, so take my suggestions with a grain of salt :)

Comment thread docs/toolchains.md Outdated
Comment thread python/bin/interpreter.bzl Outdated
Comment thread docs/toolchains.md Outdated
Comment thread tests/integration/interpreter_test.py Outdated
Comment thread docs/toolchains.md Outdated
Comment thread tests/integration/BUILD.bazel Outdated
Comment thread python/private/interpreter.bzl
@philsc philsc requested a review from aignas February 10, 2025 00:34
Comment thread python/private/interpreter.bzl Outdated
Comment thread python/private/py_executable.bzl Outdated
Comment thread tests/interpreter/BUILD.bazel Outdated
Comment thread python/private/interpreter.bzl
Comment thread python/private/interpreter.bzl Outdated
@rickeylev
Copy link
Copy Markdown
Collaborator

Implementation wise, I think this looks good. Just the cleanup as discussed needed

@philsc
Copy link
Copy Markdown
Contributor Author

philsc commented Feb 16, 2025

I don't think the changes here are causing the mypy failure 🤔

@philsc philsc requested a review from aignas February 16, 2025 19:24
@rickeylev
Copy link
Copy Markdown
Collaborator

re: mypy failures: Yeah, its unrelated. It started failing a couple days ago, but nobody has yet looked into why.

@rickeylev rickeylev enabled auto-merge February 16, 2025 21:21
@rickeylev rickeylev added this pull request to the merge queue Feb 16, 2025
Merged via the queue into bazel-contrib:main with commit 34e82cd Feb 16, 2025
@rickeylev
Copy link
Copy Markdown
Collaborator

Ah, I got a bit excited and merged this a bit soon -- CHANGELOG.md updates are missing

github-merge-queue Bot pushed a commit that referenced this pull request Feb 17, 2025
This was a forgotten part of the original PR (#2507) implementing it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants