bazel-contrib / bazel-contrib/rules_python

`bazel run` should run in bazel env working directory

Offen
#2,679 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
help wanted P4
Vorherrschende Sprache
Starlark
Sterne
688
Forks
721
Ø Merge
15 Std. 7 Min.
Gemergte PRs (30 T.)
76

Beschreibung

# 🚀 feature request

### Relevant Rules
This is meant to change the behavior of `py_binary`

### Description
Currently if you run a binary with `bazel run` then the working directory will be the sandboxed bazel directory. This behavior is inconsistent with other implementations, for example in `rules_go` it is set like this https://github.com/bazel-contrib/rules_go/blob/b60f4475e3d97431318da1a0a81752a8884e6994/go/tools/go_bin_runner/main.go#L250

### Describe the solution you'd like

`bazel run` should use the `BUILD_WORKING_DIRECTORY` environment variable to set the working directory.

### Describe alternatives you've considered

You can do this hack where you add `--run_under="cd $PWD &&"` to the command but it only works on POSIX systems and you basically have to know the trick to have the command do what you might expect

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start at the py_binary implementation involved in bazel run and compare its behavior with the rules_go runner linked in the issue. Verify how BUILD_WORKING_DIRECTORY is exposed, then confirm that bazel run uses it as the working directory rather than the sandbox directory.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.